Skip to content

πŸš€ MCP REST Adapter - Bridge any REST API to AI agents (Claude, GPT-4) without code changes. Auto-generates AI tools from OpenAPI specs. Zero-config microservice integration for Model Context Protocol.

License

Notifications You must be signed in to change notification settings

deepwissen/mcp_rest_adapter

Repository files navigation

MCP β†’ REST Adapter

Make your existing REST APIs instantly accessible to AI agents (Claude, GPT-4, etc.) without changing a single line of code.

πŸš€ Quick Start (5 minutes)

# 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}'

🎯 What This Does

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

πŸ› οΈ Manual Setup

Prerequisites

  • Docker & Docker Compose
  • Python 3.11+
  • Your REST APIs with OpenAPI/Swagger specs

Step 1: Configure Your Services

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

Step 2: Start the Adapter

# 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

Step 3: Verify It's Working

# 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}'

πŸ“‹ Requirements for Your APIs

Your REST APIs need:

  1. Health endpoint (/health) that returns 200 OK
  2. OpenAPI spec (/openapi.json or /swagger.json)
  3. Standard REST patterns (GET, POST, PUT, DELETE)

That's it. No code changes required.

πŸ”§ Configuration

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"
    }
}

πŸ§ͺ Testing

Run the test suite:

# Run all tests
./run_tests.py

# Run with Docker
docker-compose -f docker-compose.test.yml up

πŸ“Š What You Get

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:

  1. Search for the customer
  2. Get their customer ID
  3. Fetch all orders
  4. Return formatted results

🚨 Troubleshooting

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

🀝 Contributing

We welcome contributions! Please check out our Contributing Guide.

πŸ“ License

MIT License - see LICENSE file for details.

πŸ”— Links


Built with ❀️ to make AI integration simple

About

πŸš€ MCP REST Adapter - Bridge any REST API to AI agents (Claude, GPT-4) without code changes. Auto-generates AI tools from OpenAPI specs. Zero-config microservice integration for Model Context Protocol.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •