Skip to content

limcheekin/mcp-proxy-to-api-nocode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

MCP Proxy to API NoCode

A Docker Compose solution that exposes the Fabric AI REST API through the MCP Access Point protocol conversion gateway, enabling MCP clients like Cursor Desktop to interact with Fabric's AI pattern management capabilities.

πŸš€ Overview

This project provides a no-code solution for converting Fabric's REST API into MCP (Model Context Protocol) compatible services. It combines:

  • Fabric Main REST API: The comprehensive AI pattern management system by Daniel Miessler
  • MCP Access Point: A protocol conversion gateway that converts HTTP services to MCP services for MCP clients

πŸ›  Architecture

graph TD
    A[MCP Clients<br/>Cursor Desktop, MCP Inspector] --> |SSE/Streamable HTTP| B[MCP Access Point :9999]
    B --> |HTTP Requests| C[Fabric REST API :9991]
    C --> D[AI Models & Patterns]
    
    E[OpenAPI Spec] --> B
    F[Config Files] --> B
    G[Docker Volumes] --> C
Loading

πŸ“¦ Components

Fabric Service

  • Port: 9991 (mapped from internal 8080)
  • Purpose: Core AI pattern management and LLM interaction
  • Features:
    • Chat completions with various LLM providers
    • Pattern management (create, read, update, delete)
    • Session management for conversation history
    • Context management for additional data
    • Configuration management

MCP Access Point

  • Port: 9999 (mapped from internal 8080)
  • Purpose: Protocol conversion gateway (HTTP β†’ MCP)
  • Features:
    • Converts HTTP services to MCP-compatible services
    • Supports SSE and Streamable HTTP protocols for MCP clients
    • Multi-tenancy support for multiple services
    • OpenAPI specification integration
    • Load balancing and routing capabilities

πŸ”§ Configuration Files

config.yaml

Main configuration for the MCP Access Point service:

  • MCP Services: Defines services accessible via MCP protocol
  • Upstream Services: Backend HTTP service configuration
  • Routing: Maps MCP operations to HTTP endpoints
  • Headers: Authentication and request header management

docker-compose.yaml

Orchestrates both services with:

  • Service Dependencies: Proper startup order and networking
  • Volume Mounts: Persistent data storage for configurations and patterns
  • Environment Variables: Secure API key management
  • Port Mappings: External access configuration

config/fabric/openapi.json

OpenAPI 3.0 specification defining Fabric's REST API endpoints that will be converted to MCP operations.

πŸš€ Quick Start

Prerequisites

  • Docker and Docker Compose installed
  • API key for Fabric service

Installation

  1. Clone the repository:

    git clone https://github.com/limcheekin/mcp-proxy-to-api-nocode.git
    cd mcp-proxy-to-api-nocode
  2. Set your Fabric API key:

    export FABRIC_API_KEY=your_actual_api_key_here

    Or edit the docker-compose.yaml file and replace your_fabric_key_here with your actual API key.

  3. Update the proxy configuration: Edit config.yaml and replace your_fabric_key_here in the upstreams section:

    upstreams:
      - id: 1
        headers:
          X-API-Key: "your_actual_api_key_here"
        nodes:
          "fabric:8080": 1
  4. Start the services:

    docker-compose up -d
  5. Verify the deployment:

    # Check service status
    docker-compose ps
    
    # Test with MCP Inspector
    npx @modelcontextprotocol/inspector
    # Connect to: http://localhost:9999/sse (SSE) or http://localhost:9999/mcp/ (Streamable HTTP)

πŸ“‹ MCP Client Usage

Supported MCP Clients

  • Cursor Desktop: Configure MCP server with http://localhost:9999/sse
  • MCP Inspector: Use for debugging and testing MCP operations

Connection Endpoints

  • SSE Protocol: http://localhost:9999/sse
  • Streamable HTTP: http://localhost:9999/mcp/
  • Service-specific: http://localhost:9999/api/fabric/sse or http://localhost:9999/api/fabric/mcp/

MCP Operations Available

Based on the Fabric API, available MCP operations include:

  • Chat Operations: Interact with AI models through chat completions
  • Pattern Management: Create, read, update, and delete AI patterns
  • Session Management: Manage conversation sessions
  • Context Management: Handle additional context data

πŸ”§ Configuration Examples

Basic config.yaml Structure

mcps:
  - id: fabric
    upstream_id: 1
    path: config/fabric/openapi.json

upstreams:
  - id: 1
    headers:
      X-API-Key: "your_fabric_api_key"
    nodes:
      "fabric:8080": 1
    scheme: http

Multi-service Configuration

mcps:
  - id: fabric-main
    upstream_id: 1
    path: config/fabric/openapi.json
  - id: fabric-patterns
    upstream_id: 1
    routes:
      - id: 1
        operation_id: list_patterns
        uri: /patterns/names
        method: GET
        meta:
          name: List Available Patterns
          description: Get all available AI patterns

upstreams:
  - id: 1
    headers:
      X-API-Key: "your_fabric_api_key"
    nodes:
      "fabric:8080": 1
    type: roundrobin
    scheme: http

πŸ”’ Security

API Key Authentication

Configure API keys in the upstreams section of config.yaml:

upstreams:
  - id: 1
    headers:
      X-API-Key: "your_fabric_api_key"
      Authorization: "Bearer your_token"

Network Security

  • MCP clients connect via SSE or Streamable HTTP protocols
  • Internal Docker networking for service communication
  • Configurable headers for upstream authentication

πŸ“Š Monitoring and Debugging

Using MCP Inspector

# Start MCP Inspector for debugging
npx @modelcontextprotocol/inspector

# Access at http://localhost:6274/
# Connect to your MCP Access Point:
# - SSE: http://localhost:9999/sse
# - Streamable HTTP: http://localhost:9999/mcp/

Service Health Checks

# Check container status
docker-compose ps

# View logs
docker-compose logs fabric
docker-compose logs mcp-access-point

# Test direct Fabric API
curl http://localhost:9991/patterns/names -H "X-API-Key: your_api_key"

πŸ› Troubleshooting

Common Issues

  1. MCP Client Connection Failures:

    • Verify MCP Access Point is running on port 9999
    • Check that the correct protocol endpoint is used (SSE vs Streamable HTTP)
    • Ensure OpenAPI specification is properly loaded
  2. Authentication Errors:

    • Verify API keys are correctly configured in both services
    • Check that upstream headers are properly set in config.yaml
  3. Service Communication Issues:

    • Ensure Fabric service is accessible from MCP Access Point
    • Verify Docker networking and port configurations

Debug Commands

# Check MCP Access Point configuration
docker-compose exec mcp-access-point cat /app/config/config.yaml

# Test upstream connectivity
docker-compose exec mcp-access-point wget -O- http://fabric:8080/patterns/names

# Restart with fresh configuration
docker-compose down && docker-compose up -d

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/new-feature
  3. Commit your changes: git commit -am 'Add new feature'
  4. Push to the branch: git push origin feature/new-feature
  5. Submit a pull request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

πŸ“š Additional Resources


Note: This setup converts Fabric's REST API into MCP-compatible services for use with MCP clients like Cursor Desktop. Replace API keys with your actual values before deployment.

About

MCP Proxy to API without code

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published