Skip to content

lknik/privacy-mcp-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Privacy MCP Demo

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.

What It Does

  • 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

Installation

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

Usage

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"

Testing

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"

How It Works

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.

Remote Setup

To run on different hosts, update the client URL configuration and ensure the server port is accessible.

Files

  • privacy_mcp_server.py - FastMCP server with privacy tools
  • privacy_mcp_client.py - qwen-agent client with raw output
  • blog_text.txt - Technical explanation of the implementation

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages