Skip to main content
Glama

πŸ”’ Secure MCP Server

Production-ready Multi-Context Protocol server with web search and persistent memory

Works on Windows, Linux, and Mac - Built with Python for maximum security and compatibility.

✨ Features

Feature

Description

πŸ” Security First

JWT authentication, rate limiting, input sanitization, encryption

🧠 Persistent Memory

Vector database with semantic search using AI embeddings

πŸ” Web Search

Built-in web search (DuckDuckGo + optional Brave API)

πŸ‘₯ Multi-User

Isolated memory spaces and authentication per user

πŸͺŸ Windows Ready

Full support for Windows, Linux, and Mac

πŸš€ Easy Setup

Automated installation with sensible defaults

Related MCP server: PMCP - Perfect Model Context Protocol Server

🎯 Quick Start

Windows (5 minutes)

setup.bat
venv\Scripts\activate
python manage_users.py
python src\server.py

See QUICKSTART_WINDOWS.md for detailed Windows instructions

Linux/Mac (5 minutes)

chmod +x setup.sh
./setup.sh
source venv/bin/activate
python3 manage_users.py
python3 src/server.py

See QUICKSTART.md for detailed Linux/Mac instructions

πŸ“‹ Requirements

  • Python 3.8+ (Download)

    • ⚠️ Windows: Check "Add Python to PATH" during installation

  • 2GB RAM recommended

  • Internet connection (for web search)

πŸ› οΈ What's Included

MCP tools (memory, search, SwarmUI skills)

  1. web_search - Search the internet for information

  2. store_memory - Save information with tags for later

  3. search_memory - Find memories using semantic search

  4. get_recent_memories - Retrieve recent context

  5. memory_stats - View storage statistics

  6. clear_memories - Reset memory storage

  7. delete_memory - Remove one memory by ID

  8. list_swarmui_skills / get_swarmui_skill - Load SwarmUI agent skills from .agents/skills/*/SKILL.md when swarmui.path or SWARMUI_PATH is set

  9. SwarmUI HTTP API (when swarmui.api_url or SWARMUI_API_URL): swarmui_get_queue_status, swarmui_list_models, swarmui_list_t2i_params, swarmui_generate_image, swarmui_interrupt β€” calls SwarmUI’s JSON POST /API/... (session + optional login). For broad compatibility, call swarmui_list_models with an empty arguments object ({}) first, then narrow by path/subtype if needed. swarmui_generate_image also auto-resolves nickname/partial model text to a valid model path by querying listmodels internally, and accepts a natural-language instruction string (it parses model/steps/cfg/resolution/images). It downloads outputs and returns embedded MCP image content so clients like LM Studio can render images directly in chat (rather than URL-only Markdown links); if the client sends a progress token with the tool call, queue/backend updates are sent while generation runs. See config.example.yaml.

Core Components

  • βœ… MCP Server (src/server.py) - Main server with stdio transport

  • βœ… Security Module - JWT auth, encryption, rate limiting

  • βœ… Memory System - Vector database with ChromaDB

  • βœ… Web Search - DuckDuckGo (free) + Brave API (optional)

  • βœ… User Management - CLI tool for user administration

  • βœ… Test Client - Automated testing and verification

πŸ”’ Security Features

  • βœ… JWT token-based authentication (30-min expiration)

  • βœ… Per-user rate limiting (60/min, 1000/hour)

  • βœ… AES-256 encryption for sensitive data

  • βœ… Bcrypt password hashing

  • βœ… Input sanitization (prevents injection attacks)

  • βœ… URL filtering for web search

  • βœ… Isolated user memory spaces

  • βœ… Comprehensive audit logging

πŸ“ Project Structure

secure-mcp-server/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ server.py          # Main MCP server ⭐
β”‚   β”œβ”€β”€ security.py        # Authentication & encryption
β”‚   β”œβ”€β”€ memory_system.py   # Vector database & memory
β”‚   └── web_search.py      # Web search functionality
β”œβ”€β”€ data/                  # Runtime data (auto-created)
β”‚   β”œβ”€β”€ memory_db/         # Memory storage
β”‚   └── server.log         # Activity logs
β”œβ”€β”€ setup.bat             # Windows installation ⭐
β”œβ”€β”€ setup.sh              # Linux/Mac installation ⭐
β”œβ”€β”€ manage_users.py       # User management CLI ⭐
β”œβ”€β”€ test_client.py        # Testing utility ⭐
β”œβ”€β”€ QUICKSTART_WINDOWS.md # Windows guide ⭐
β”œβ”€β”€ QUICKSTART.md         # Linux/Mac guide
└── requirements.txt      # Python dependencies

⭐ = Most important files

πŸ§ͺ Testing Your Server

Automated Tests (Windows)

venv\Scripts\activate
python test_client.py

Automated Tests (Linux/Mac)

source venv/bin/activate
python test_client.py

Interactive Mode

python test_client.py --interactive

πŸ’‘ Usage Example

# Store a memory
await session.call_tool(
    "store_memory",
    arguments={
        "content": "User prefers Python and dark mode",
        "tags": ["preferences"]
    },
    meta={"user_id": "john"}
)

# Search memories
await session.call_tool(
    "search_memory",
    arguments={"query": "What are user preferences?"},
    meta={"user_id": "john"}
)

# Web search
await session.call_tool(
    "web_search",
    arguments={"query": "Python MCP tutorial"},
    meta={"user_id": "john"}
)

πŸ”§ Configuration

Edit .env file for settings:

# Security
JWT_SECRET_KEY=your-secret-key
ENCRYPTION_KEY=your-encryption-key

# Memory
MEMORY_DB_PATH=./data/memory_db
MEMORY_MAX_RESULTS=10

# Web Search
SEARCH_API_KEY=optional-brave-api-key
SEARCH_MAX_RESULTS=10

# Rate Limiting
RATE_LIMIT_PER_MINUTE=60
RATE_LIMIT_PER_HOUR=1000

πŸͺŸ Windows-Specific Notes

Python Installation

  1. Download from python.org

  2. ⚠️ IMPORTANT: Check "Add Python to PATH" during installation

  3. Restart Command Prompt after installation

Running Scripts

  • Use python (not python3)

  • Use \ for paths (e.g., data\memory_db)

  • Activate venv: venv\Scripts\activate

Claude Desktop Integration

Config file location: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "secure-mcp": {
      "command": "python",
      "args": ["C:\\path\\to\\secure-mcp-server\\src\\server.py"]
    }
  }
}

πŸ› Troubleshooting

Windows

Issue

Solution

"Python not recognized"

Add Python to PATH or reinstall with PATH option

Module errors

Run pip install -r requirements.txt

Activation fails

Use venv\Scripts\activate.bat

Linux/Mac

Issue

Solution

Permission denied

Run chmod +x setup.sh

Module errors

Run pip install -r requirements.txt

Python version

Ensure Python 3.8+ with python3 --version

All Platforms

Issue

Solution

Slow first run

Embedding model downloads once (~80MB)

Web search fails

Check internet; DuckDuckGo works without API key

Auth failures

Verify user exists with manage_users.py

πŸ“Š Performance

  • Memory search: <100ms for 1000 memories

  • Web search: 1-3 seconds (network dependent)

  • Authentication: <10ms

  • Supports: Hundreds of concurrent users

🚨 Security Checklist

Before deploying:

  • Change default admin password (admin/changeme123)

  • Generate unique JWT_SECRET_KEY

  • Generate unique ENCRYPTION_KEY

  • Review rate limits in .env

  • Enable logging and monitoring

  • Backup data/ directory regularly

  • Keep dependencies updated

πŸ“š Documentation

πŸŽ“ Learning Resources

πŸ“ License

Provided as-is for educational and development purposes.


πŸŽ‰ You're All Set!

Your MCP server is:

  • βœ… Fully functional

  • βœ… Production-ready

  • βœ… Windows compatible

  • βœ… Security-hardened

  • βœ… Multi-user capable

  • βœ… Well-documented

Questions? Check the documentation or review code comments.

Ready to start? Follow your platform's Quick Start guide!

Built with ❀️ for Windows, Linux, and Mac. Happy building! πŸš€

Related MCP Connectors

Related MCP Servers

  • -
    license
    Not graded
    quality
    Not graded
    maintenance
    A sophisticated MCP server providing advanced memory capabilities with RAG, hallucination detection, and enterprise-grade AI infrastructure for intelligent agent ecosystems.
    -
  • -
    license
    Not graded
    quality
    Not graded
    maintenance
    A comprehensive production-ready MCP server with AI integration, plugin management, and web-based administration. Features multi-database support, RAG capabilities, SSH/SFTP access, and a built-in plugin hub for managing the MCP ecosystem.
    -
  • A
    license
    Not graded
    quality
    C
    maintenance
    A production-ready MCP server that enables multiple AI agents to collaborate through a shared, concurrency-safe memory space. It supports advanced search, full CRUD operations, and automatic backups to facilitate asynchronous communication between agents.
    MIT