Watch SMCP orchestrate multiple AI agents to generate real business intelligence reports! This demo shows CrewAI + SMCP working together to analyze e-commerce, SaaS, and IoT data using Qwen3 models, DuckDB, and secure multi-agent coordination.
SMCP (Secure Model Context Protocol) is a proof-of-concept that demonstrates how the Model Context Protocol (MCP) can be extended with security features and multi-agent coordination capabilities. This project explores potential improvements to MCP for scenarios requiring authentication, encryption, and agent-to-agent communication.
While MCP provides an excellent foundation for AI-model interactions, certain use cases may benefit from:
- π Security: Authentication and encryption capabilities
- π€ Multi-Agent Coordination: Agent-to-agent communication patterns
- π§ Flexible Configuration: Additional deployment options
- π Extended Features: Audit trails and compliance considerations
SMCP is a technical exploration that shows how MCP could be enhanced with:
- Multiple Security Approaches: From simple API keys to JWT and encryption experiments
- A2A Coordination Concepts: Multi-agent orchestration patterns
- Native Connectors: DuckDB and filesystem integration examples
- Security Experiments: JWT/OAuth2, ECDH key exchange, and AES encryption
- MCP Compatibility: Maintains compatibility while adding optional security layers
- Architecture Overview - Complete system architecture, data flows, and design patterns
- Demo Architectures - Detailed walkthroughs of each demo with step-by-step flows
- MCP vs SMCP Comparison - Comprehensive comparison between standard MCP and SMCP
- Use Cases - Real-world applications and implementation scenarios
- AI SQL Generation Guide - Using LLMs for SQL query generation
- Connector Development Guide - Building custom connectors
- CrewAI Integration - Integrating CrewAI with SMCP
- Simple Mode: Basic API key authentication for testing
- Basic Mode: JWT + HTTPS/TLS exploration
- Encrypted Mode: ECDH + AES-256 encryption proof-of-concept
- Enterprise Mode: OAuth2 + audit trail concepts
- Multi-agent task orchestration
- Dynamic agent discovery
- Parallel and sequential workflows
- Load balancing and failover
- DuckDB: High-performance analytical queries
- Filesystem: Secure local storage
- Extensible: Easy to add custom connectors
- Configuration via TOML/YAML/ENV
- Logging and monitoring examples
- Connection pooling experiments
- Scaling pattern demonstrations
- Python 3.8+
- Ollama (for AI features)
- Docker (for MindsDB)
- Pixi package manager
- Clone the repository:
git clone https://github.com/KellerKev/smcp.git
cd smcp- Install dependencies using pixi:
# Install pixi if you don't have it
curl -fsSL https://pixi.sh/install.sh | bash
# Install all dependencies
pixi install- Setup Ollama and AI Models:
# Install Ollama
curl -fsSL https://ollama.ai/install.sh | sh
# Start Ollama service
ollama serve &
# Pull required models (Qwen models recommended)
ollama pull qwen2.5-coder:7b-instruct-q4_K_M
ollama pull qwen3-coder:30b-a3b-q4_K_M- Initialize DuckDB with Sample Data:
# Generate sample data
pixi run python tools/generate_sample_data.py
# Create database and tables
pixi run python examples/duckdb_integration_example.py- Setup MindsDB (Optional - for ML features):
# Run MindsDB in Docker
docker run -d --name mindsdb_smcp \
-p 47335:47334 \
-p 47336:47335 \
mindsdb/mindsdb
# Verify it's running
curl http://localhost:47335/π Full Setup Guide: See SETUP_GUIDE.md for detailed instructions
This demo shows multi-agent AI coordination:
# Start Ollama (in another terminal)
ollama serve
# Run the demo
python examples/basic/basic_poem_sample.pyWhat happens:
- TinyLLama generates an initial poem
- Mistral enhances it
- Result is securely stored locally
- Uses JWT authentication
Shows database integration with AI analysis:
# Generate sample data
python tools/generate_sample_data.py
# Run analytics demo
python examples/duckdb_integration_example.pyFeatures demonstrated:
- SQL queries via SMCP connector
- AI-powered data analysis
- Business intelligence generation
See all features in action:
python examples/showcase_complete_system.py- Create configuration (optional):
python smcp_server_main.py --create-config- Start the server:
python smcp_server_main.pyfrom smcp_client import SMCPClient
from smcp_config import SMCPConfig
# Create configuration
config = SMCPConfig(
mode="basic",
server_url="ws://localhost:8765"
)
# Connect and use
client = SMCPClient(config)
await client.connect()
# Discover capabilities
capabilities = client.capabilities
# Invoke a tool
result = await client.invoke_tool("echo", {"message": "Hello SMCP!"})
# Disconnect
await client.disconnect()# Demonstrates CrewAI + SMCP for business intelligence
python examples/crewai_report_orchestration.pyCreates executive reports using:
- Data Analyst agent (queries DuckDB)
- Business Analyst agent (strategic insights)
- Report Writer agent (document generation)
- Quality Reviewer agent (validation)
# Shows enterprise-grade security features
python examples/encrypted/encrypted_enterprise_sample.pyFeatures:
- ECDH key exchange
- AES-256 encryption
- Audit trails
- Compliance logging
smcp/
βββ smcp_*.py # Core SMCP modules
βββ connectors/ # Native connector implementations
β βββ smcp_duckdb_connector.py
β βββ smcp_filesystem_connector.py
βββ examples/ # Demo applications
β βββ basic/ # Basic security mode examples
β βββ encrypted/ # Encrypted mode examples
β βββ *.py # Integration examples
βββ tools/ # Utility scripts
β βββ generate_sample_data.py
β βββ setup_dev_security.py
βββ docs/ # Documentation
βββ sample_data/ # Sample datasets
SMCP supports multiple configuration sources:
# smcp_config.toml
[core]
node_id = "production_node"
mode = "basic" # or "encrypted", "enterprise"
[server]
host = "0.0.0.0"
port = 8765
[security]
jwt_secret = "your-secret-key-min-32-chars"
require_signature = trueexport SMCP_NODE_ID="production_node"
export SMCP_MODE="basic"
export SMCP_JWT_SECRET="your-secret-key"from smcp_config import SMCPConfig
config = SMCPConfig(
mode="basic",
node_id="my_node",
jwt_secret="secret_key"
)-
Use appropriate security mode:
- Development:
simplemode - Production:
basicmode with HTTPS - High security:
encryptedmode - Compliance:
enterprisemode
- Development:
-
Secure your keys:
- Use strong JWT secrets (32+ characters)
- Rotate keys regularly
- Never commit secrets to version control
-
Enable HTTPS for deployment:
config.server_url = "wss://your-domain.com" # WSS for secure WebSocket
SMCP is 100% compatible with existing MCP tools and clients:
# Works with standard MCP clients
# SMCP server appears as enhanced MCP server
# All MCP tools continue to work- Message Processing: <10ms overhead for encryption
- A2A Coordination: <50ms for agent discovery
- Database Queries: Sub-second on 100K+ records
- Horizontal Scaling: Supports multiple nodes
Run the test suite:
# Compile all examples (syntax check)
find examples/ -name "*.py" -exec python3 -m py_compile {} \;
# Run basic test
python examples/basic/basic_poem_sample.pyWe welcome contributions! Please see our contributing guidelines.
This project is licensed under the MIT License.
- Built on top of the Model Context Protocol
- Uses Ollama for local AI models
- Integrates with CrewAI for orchestration
- Database features powered by DuckDB
- β Core SMCP: Proof-of-concept working
- β Basic/Encrypted modes: Functional demonstrations
- β A2A System: Working prototype
- β DuckDB Connector: Example implementation
- β CrewAI Integration: Working demo (requires CrewAI)
- π§ Enterprise Mode: Experimental
Want to explore MCP security concepts? Start with the Quick Demo above!
