A FastAPI-based gateway for the Model Context Protocol (MCP) designed to unify and scale AI toolchains.
A powerful, FastAPI-based gateway for the Model Context Protocol (MCP), designed to unify and scale your AI toolchain.
MCPilot is now fully functional with the following working features:
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
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
# Using uv (recommended)
uv sync
# Or using pip
pip install -e .
# 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
Open your browser to http://localhost:8000
to access the admin dashboard.
http://localhost:8000/docs
http://localhost:8000/redoc
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
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
)
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}
]
}
]
)
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 resourceGET /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 wrapperGET /health
- Health check endpointGET /api/v1/status
- Gateway and server statusGET /admin/metrics
- System metricsConnect 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": {}
}));
# Install development dependencies
uv sync --dev
# Run with auto-reload
uvicorn mcpilot.main:app --reload --host 0.0.0.0 --port 8000
# Run tests (when implemented)
uv run pytest
# Type checking
uv run mypy src/mcpilot
This project is licensed under the MIT License.
Contributions are welcome! Please feel free to submit a Pull Request.
MCPilot also includes the original MCP server functionality for development and testing:
The server implements a simple note storage system with:
The server provides a single prompt:
The server implements one tool:
[TODO: Add configuration details specific to your implementation]
On MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json
To prepare the package for distribution:
uv sync
uv build
This will create source and wheel distributions in the dist/
directory.
uv publish
Note: You'll need to set PyPI credentials via environment variables or command flags:
--token
or UV_PUBLISH_TOKEN
--username
/UV_PUBLISH_USERNAME
and --password
/UV_PUBLISH_PASSWORD
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.
MCP Server to control and interact with Unity3d Game Engine for game development
APIMatic MCP Server is used to validate OpenAPI specifications using APIMatic. The server processes OpenAPI files and returns validation summaries by leveraging APIMaticβs API.
A code observability MCP enabling dynamic code analysis based on OTEL/APM data to assist in code reviews, issues identification and fix, highlighting risky code etc.
A secure command-line interface server for the Model Context Protocol (MCP) that allows AI models to interact with a user's terminal.
Turns any command-line interface (CLI) command into a simple StdIO-based MCP server.
Provides API documentation from Apifox projects as a data source for AI programming tools that support MCP.
Enable AI agents to interact with the Atla API for state-of-the-art LLMJ evaluation.
An MCP server for AI coding assistants to control, inspect, and modify Bevy applications using the Bevy Remote Protocol (BRP).
Query information about dependencies in a Ruby project's Gemfile.
A Model Context Protocol (MCP) server that enables AI assistants to integrate with Prometheus Alertmanager