Make your existing REST APIs instantly accessible to AI agents (Claude, GPT-4, etc.) without changing a single line of code.
# Clone the repository
git clone https://github.com/deepwissen/mcp_rest_adapter.git
cd mcp_rest_adapter
# Start everything with one command
./quick_start.sh
That's it! Your REST APIs are now AI-accessible. Test it:
curl -X POST http://localhost:8000/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "tools/list", "params": {}, "id": 1}'
The MCP Adapter acts as a bridge between AI agents and your existing microservices:
AI Agent (Claude/GPT) β MCP Protocol β MCP Adapter β Your REST APIs
Before: Months of custom AI integration code
After: 5 minutes to AI-enable your entire API ecosystem
- Docker & Docker Compose
- Python 3.11+
- Your REST APIs with OpenAPI/Swagger specs
Edit docker-compose.yml
to point to your services:
environment:
- CUSTOMER_SERVICE_URL=http://your-customer-api:8080
- ORDER_SERVICE_URL=http://your-order-api:8080
- INVENTORY_SERVICE_URL=http://your-inventory-api:8080
# Start with Docker Compose
docker-compose up -d
# Or run directly with Python
pip install -r requirements.txt
python -m uvicorn mcp_adapter.server:app --port 8000
# Check health
curl http://localhost:8000/health
# List available tools (auto-generated from your APIs)
curl -X POST http://localhost:8000/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "tools/list", "params": {}, "id": 1}'
Your REST APIs need:
- Health endpoint (
/health
) that returns 200 OK - OpenAPI spec (
/openapi.json
or/swagger.json
) - Standard REST patterns (GET, POST, PUT, DELETE)
That's it. No code changes required.
Create a config.py
file:
SERVICE_CONFIGS = {
"customer": {
"base_url": "http://customer-service:8001",
"health_endpoint": "/health",
"openapi_endpoint": "/openapi.json"
},
"order": {
"base_url": "http://order-service:8002",
"health_endpoint": "/health",
"openapi_endpoint": "/openapi.json"
}
}
Run the test suite:
# Run all tests
./run_tests.py
# Run with Docker
docker-compose -f docker-compose.test.yml up
Once running, AI agents can:
- Discover all your API endpoints automatically
- Call any endpoint with proper parameters
- Handle complex workflows across multiple services
- Get structured responses in MCP format
Example: An AI agent can now say "Show me all orders for customer John Doe" and automatically:
- Search for the customer
- Get their customer ID
- Fetch all orders
- Return formatted results
Services not discovered?
- Check your services have
/health
endpoints returning 200 OK - Verify
/openapi.json
is accessible
No tools generated?
- Ensure your OpenAPI spec is valid
- Check logs:
docker-compose logs mcp-adapter
Connection errors?
- Verify network connectivity between adapter and your services
- Check service URLs in configuration
We welcome contributions! Please check out our Contributing Guide.
MIT License - see LICENSE file for details.
Built with β€οΈ to make AI integration simple