A deterministic, schema-driven execution engine for Model Context Protocol (MCP) servers. This system requires zero code changes to add new tools and uses no LLMs in the execution path.
βββββββββββββββββββ
β User Input β
ββββββββββ¬βββββββββ
β
ββββββΌββββββββββββββ
β 1. NLP Module β Extract entities (spaCy)
ββββββ¬ββββββββββββββ
β
ββββββΌββββββββββββββ
β 2. Intent Engine β Classify intent (ML)
ββββββ¬ββββββββββββββ
β
ββββββΌββββββββββββββ
β 3. Rule Engine β Apply business logic
ββββββ¬ββββββββββββββ
β
ββββββΌββββββββββββββ
β 4. Tool Registry β Match tool from DB
ββββββ¬ββββββββββββββ
β
ββββββΌββββββββββββββ
β 5. Schema Exec β Build params from schema
ββββββ¬ββββββββββββββ
β
ββββββΌββββββββββββββ
β 6. MCP Client β Execute on MCP server
ββββββ¬ββββββββββββββ
β
ββββββΌββββββββββββββ
β 7. Audit Logger β Store full trace
ββββββ¬ββββββββββββββ
β
ββββββΌββββββββββββββ
β Result β
ββββββββββββββββββββ
- Zero Code Changes: Add new tools by just registering MCP servers
- No LLMs: Fully deterministic execution using schemas only
- Schema-Driven: Uses JSON Schema for parameter extraction
- Full Audit: Complete execution trace for every request
- Production-Ready: PostgreSQL, async, error handling, tests
- FastAPI - High-performance async API
- PostgreSQL - Production database with SQLAlchemy
- spaCy - NLP for entity extraction
- scikit-learn - Intent classification
- json-logic-py - Rule engine
- JSON Schema - Parameter validation
- Vanilla HTML/CSS/JavaScript - No build tools required
- Modern CSS - Responsive design with flexbox/grid
- Fetch API - REST client
- JWT Auth - Token-based authentication
cd client_mcp_hybrid
python -m pip install -r requirements.txt
python -m spacy download en_core_web_smCreate PostgreSQL database and .env file:
DATABASE_URL=postgresql+asyncpg://user:password@localhost/mcp_client
SECRET_KEY=your-secret-key-here
DEBUG=trueCreate mcp_servers.json:
{
"servers": [
{
"name": "filesystem",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/files"]
}
]
}python main.pyAccess at: http://localhost:8000
Demo Credentials:
- Username:
admin/ Password:admin - Username:
user/ Password:user
- System statistics
- Active servers
- Recent executions
- Auto-refresh
- Natural language input
- Example commands
- Real-time results
- Parameter display
- Browse all tools
- Search and filter
- View JSON schemas
- Server grouping
- MCP server list
- Status monitoring
- Trigger discovery
- Statistics
- Execution history
- Filter by status/date
- Detailed traces
- Pipeline information
POST /api/v1/auth/login
POST /api/v1/auth/refreshPOST /api/v1/execute
# Body: {"input": "list files in /tmp"}GET /api/v1/tools
GET /api/v1/tools/{tool_id}
GET /api/v1/tools/{tool_id}/schemaGET /api/v1/servers
POST /api/v1/servers/discover
GET /api/v1/servers/{server_id}/statsGET /api/v1/audit
GET /api/v1/audit/{execution_id}client_mcp_hybrid/
βββ main.py # FastAPI application
βββ requirements.txt # Dependencies
β
βββ config/ # Configuration
βββ database/ # Database models
βββ nlp/ # Entity extraction
βββ intent/ # Intent classification
βββ rules/ # Rule engine
βββ registry/ # Tool registry
βββ executor/ # Schema executor
βββ mcp/ # MCP client
βββ discovery/ # Server discovery
βββ audit/ # Audit logging
βββ api/ # REST API
βββ pipeline/ # Pipeline orchestrator
β
βββ frontend/ # Web UI (vanilla JS)
β βββ login.html
β βββ dashboard.html
β βββ execute.html
β βββ tools.html
β βββ servers.html
β βββ audit.html
β βββ css/
β β βββ style.css
β βββ js/
β βββ auth.js
β βββ api.js
β βββ utils.js
β βββ dashboard.js
β βββ execute.js
β βββ tools.js
β βββ servers.js
β βββ audit.js
β
βββ tests/ # Test suite
curl -X POST http://localhost:8000/api/v1/execute \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"input": "list all files in /tmp"}'{
"status": "success",
"tool_name": "list_directory",
"server_name": "filesystem",
"result": {
"files": ["file1.txt", "file2.txt"]
},
"parameters": {
"path": "/tmp"
},
"duration_ms": 156,
"execution_id": "exec_123"
}- Add new MCP server to
mcp_servers.json - Restart application (or POST to
/api/v1/servers/discover) - Tools are automatically available - no code changes!
- Execute commands using new tools immediately
# Run all tests
pytest
# Specific test
pytest tests/test_pipeline.py
# With coverage
pytest --cov=. --cov-report=htmldocker build -t mcp-client .
docker run -p 8000:8000 \
-e DATABASE_URL=postgresql://... \
-e SECRET_KEY=... \
mcp-client[Unit]
Description=MCP Client
After=network.target postgresql.service
[Service]
Type=simple
User=mcp
WorkingDirectory=/opt/mcp-client
Environment="DATABASE_URL=postgresql://..."
ExecStart=/opt/mcp-client/venv/bin/python main.py
Restart=always
[Install]
WantedBy=multi-user.targetserver {
listen 80;
server_name mcp.example.com;
location / {
proxy_pass http://localhost:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}INSERT INTO business_rules (intent, conditions, actions, priority)
VALUES (
'file_operation',
'{"and": [{"var": "action"}, {"==": [{"var": "action"}, "read"]}]}',
'{"require_permission": "read"}',
100
);from intent.classifier import IntentClassifier
classifier = IntentClassifier()
classifier.train(training_data)
classifier.save_model("intent_model.pkl")# Check PostgreSQL
sudo systemctl status postgresql
# Test connection
psql -h localhost -U user -d mcp_client# Test server manually
npx -y @modelcontextprotocol/server-filesystem /tmp
# Validate config
python -m json.tool mcp_servers.json- Check browser console for errors
- Verify FastAPI is serving static files
- Ensure all JS files are loaded (auth.js, api.js, utils.js)
Zero code changes β’ No LLMs β’ Fully deterministic