MCPilot
A powerful gateway for the Model Context Protocol (MCP) that unifies AI toolchains by federating multiple MCP servers, wrapping REST APIs as MCP tools, and supporting multiple transport methods with an admin dashboard.
README
MCPilot - MCP Gateway
A powerful, FastAPI-based gateway for the Model Context Protocol (MCP), designed to unify and scale your AI toolchain.
✅ Current Status
MCPilot is now fully functional with the following working features:
✅ Working Features
- FastAPI Gateway Server - Running on http://localhost:8000/docs
- Admin Dashboard - Beautiful web UI at http://localhost:8000
- REST API Endpoints - Full CRUD operations via /api/v1/*
- API Wrapper System - Convert REST APIs to MCP tools (tested with JSONPlaceholder)
- Configuration Management - Environment-based settings
- Transport Framework - Ready for HTTP, WebSocket, SSE, stdio
- Modular Architecture - Clean separation of concerns
- Interactive Documentation - OpenAPI/Swagger UI at /docs
🔄 In Progress
- MCP Server Federation - Basic framework ready, needs MCP client integration fixes
- WebSocket Real-time Communication - Framework ready
- Admin UI Management - Backend ready, frontend interactions needed
🧪 Tested Examples
The API wrapper successfully converts REST APIs to MCP tools:
# Example: JSONPlaceholder API → MCP Tool
result = await gateway.call_tool(
"api:jsonplaceholder:get_user",
{"user_id": "1"}
)
# Returns: Full user data from REST API
- Federation of multiple MCP servers into one unified endpoint
- REST API and function wrapping as virtual MCP-compliant tools
- Multiple transport support: HTTP/JSON-RPC, WebSocket, SSE, and stdio
- Centralized tools, prompts, and resources with full JSON-Schema validation
- Admin UI with built-in auth, observability, and transport layers
📁 Project Structure
src/mcpilot/
├── main.py # FastAPI application entry point
├── config.py # Configuration management
├── gateway.py # Core MCP federation logic
├── api.py # REST API endpoints
├── admin.py # Admin management endpoints
├── transports.py # Transport layer implementations
├── api_wrapper.py # REST API to MCP tool wrapper
├── middleware.py # Request/response middleware
└── server.py # Original MCP server implementation
🛠️ Installation
Prerequisites
- Python 3.10 or higher
- uv package manager (recommended) or pip
Install Dependencies
# Using uv (recommended)
uv sync
# Or using pip
pip install -e .
🚀 Quick Start
1. Start the Gateway Server
# Run the FastAPI server
uv run python -m mcpilot.main
# Or using uvicorn directly
uvicorn mcpilot.main:app --reload --host 0.0.0.0 --port 8000
2. Access the Admin UI
Open your browser to http://localhost:8000 to access the admin dashboard.
3. API Documentation
- OpenAPI/Swagger UI:
http://localhost:8000/docs - ReDoc:
http://localhost:8000/redoc
🔧 Configuration
MCPilot can be configured via environment variables or a .env file:
# Server Configuration
MCPILOT_HOST=0.0.0.0
MCPILOT_PORT=8000
MCPILOT_DEBUG=false
# CORS Settings
MCPILOT_CORS_ORIGINS=["*"]
# Logging
MCPILOT_LOG_LEVEL=INFO
Adding MCP Servers
Configure MCP servers via the admin API or by setting up the configuration:
from mcpilot.config import MCPServerConfig
server_config = MCPServerConfig(
name="my-server",
type="stdio",
command="python",
args=["-m", "my_mcp_server"],
enabled=True
)
Adding API Wrappers
Convert REST APIs to MCP tools:
from mcpilot.config import APIWrapperConfig
api_config = APIWrapperConfig(
name="my-api",
base_url="https://api.example.com",
auth_type="bearer",
auth_config={"token": "your-token"},
endpoints=[
{
"name": "get_user",
"method": "GET",
"path": "/users/{user_id}",
"description": "Get user information",
"path_params": [
{"name": "user_id", "type": "string", "required": True}
]
}
]
)
📖 API Endpoints
Core MCP Operations
GET /api/v1/tools- List all available toolsPOST /api/v1/tools/call- Call a toolGET /api/v1/prompts- List all available promptsPOST /api/v1/prompts/get- Get a promptGET /api/v1/resources- List all available resourcesPOST /api/v1/resources/read- Read a resource
Admin Operations
GET /admin/servers- List MCP serversPOST /admin/servers- Add new MCP serverPUT /admin/servers/{name}- Update MCP serverDELETE /admin/servers/{name}- Remove MCP serverGET /admin/api-wrappers- List API wrappersPOST /admin/api-wrappers- Add new API wrapper
Health & Monitoring
GET /health- Health check endpointGET /api/v1/status- Gateway and server statusGET /admin/metrics- System metrics
🔌 WebSocket Support
Connect to the WebSocket endpoint for real-time MCP communication:
const ws = new WebSocket('ws://localhost:8000/api/v1/ws');
// Send MCP JSON-RPC message
ws.send(JSON.stringify({
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list",
"params": {}
}));
🧪 Development
Running in Development Mode
# Install development dependencies
uv sync --dev
# Run with auto-reload
uvicorn mcpilot.main:app --reload --host 0.0.0.0 --port 8000
Testing
# Run tests (when implemented)
uv run pytest
# Type checking
uv run mypy src/mcpilot
📄 License
This project is licensed under the MIT License.
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Original MCP Server Components
MCPilot also includes the original MCP server functionality for development and testing:
Resources
The server implements a simple note storage system with:
- Custom note:// URI scheme for accessing individual notes
- Each note resource has a name, description and text/plain mimetype
Prompts
The server provides a single prompt:
- summarize-notes: Creates summaries of all stored notes
- Optional "style" argument to control detail level (brief/detailed)
- Generates prompt combining all current notes with style preference
Tools
The server implements one tool:
- add-note: Adds a new note to the server
- Takes "name" and "content" as required string arguments
- Updates server state and notifies clients of resource changes
Configuration
[TODO: Add configuration details specific to your implementation]
Quickstart
Install
Claude Desktop
On MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json
<details> <summary>Development/Unpublished Servers Configuration</summary>
"mcpServers": {
"MCPilot": {
"command": "uv",
"args": [
"--directory",
"C:\Users\ary7s\OneDrive\Desktop\MCPilot",
"run",
"MCPilot"
]
}
}
</details>
<details> <summary>Published Servers Configuration</summary>
"mcpServers": {
"MCPilot": {
"command": "uvx",
"args": [
"MCPilot"
]
}
}
</details>
Development
Building and Publishing
To prepare the package for distribution:
- Sync dependencies and update lockfile:
uv sync
- Build package distributions:
uv build
This will create source and wheel distributions in the dist/ directory.
- Publish to PyPI:
uv publish
Note: You'll need to set PyPI credentials via environment variables or command flags:
- Token:
--tokenorUV_PUBLISH_TOKEN - Or username/password:
--username/UV_PUBLISH_USERNAMEand--password/UV_PUBLISH_PASSWORD
Debugging
Since MCP servers run over stdio, debugging can be challenging. For the best debugging experience, we strongly recommend using the MCP Inspector.
You can launch the MCP Inspector via npm with this command:
npx @modelcontextprotocol/inspector uv --directory C:\Users\ary7s\OneDrive\Desktop\MCPilot run mcpilot
Upon launching, the Inspector will display a URL that you can access in your browser to begin debugging.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。