A minimal demonstration of Model Context Protocol (MCP) with local privacy tools. This demo shows how to connect a local Qwen3 model to custom privacy functions using FastMCP and qwen-agent libraries.
DEMONSTRATION ONLY - NOT FOR PRODUCTION USE
This is a learning example to showcase MCP implementation. The privacy detection patterns are basic and the anonymization is simple masking. For production privacy applications, use established libraries with comprehensive PII detection, proper anonymization techniques, and security auditing.
- Analyzes text for personally identifiable information (PII)
- Calculates privacy risk scores based on detected sensitive data
- Anonymizes text by masking emails, phone numbers, credit cards, and SSNs
- Demonstrates MCP tool calling with transparent AI reasoning
Install Python dependencies
pip install mcp qwen-agent uvicorn
Install Ollama and Qwen3 model
#1. Install Ollama
#2. Pull Qwen3 model (reduce quantization, if needed)
ollama pull qwen3:30b-a3b-q8_0
# Start Ollama
ollama serve
Start the MCP server
python3 privacy_mcp_server.py
Run the client with your text
python3 privacy_mcp_client.py "Contact me at [email protected] or call 555-1234"
High-risk data
python3 privacy_mcp_client.py "My SSN is 123-45-6789 and credit card is 4532-1234-5678-9012"
Low-risk data
python3 privacy_mcp_client.py "kitty 111"
Ambiguous input
python3 privacy_mcp_client.py "call me later"
The demo connects a local Qwen3 model to privacy tools via MCP protocol. The AI model automatically selects appropriate tools based on input content. Raw output shows the complete reasoning process including tool calls and responses, proving that MCP tools perform the actual work rather than the model generating responses.
To run on different hosts, update the client URL configuration and ensure the server port is accessible.
privacy_mcp_server.py
- FastMCP server with privacy toolsprivacy_mcp_client.py
- qwen-agent client with raw outputblog_text.txt
- Technical explanation of the implementation