Skip to content

loocor/api2mcp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 

Repository files navigation

API2MCP: Intelligent OpenAPI-to-MCP Server Conversion Platform

License: MIT Rust MCP

Transform any OpenAPI service into an AI-ready MCP server with intelligent tool curation and zero-configuration deployment.

API2MCP is not just another OpenAPI-to-MCP converter. It's an intelligent platform that solves the "tool overload" problem by providing AI-optimized tool curation, document enhancement, and seamless integration with modern AI development workflows.

🎯 Why API2MCP?

The Problem: API-AI Integration Complexity

Traditional REST APIs were designed for deterministic software clients, not probabilistic AI agents. Simply mapping every API endpoint to an MCP tool creates the "one-to-one mapping trap" that leads to:

  • Tool Overload: LLMs perform poorly when faced with hundreds of low-level tools
  • Intent Mismatch: API structure reflects system implementation, not user intent
  • Context Explosion: Excessive token consumption from unoptimized tool descriptions

Our Mission: Democratizing AI Integration

API2MCP was born from the realization that every OpenAPI-compliant service deserves to be AI-ready. Our mission is to eliminate the manual toil of creating MCP tools by providing:

  • Universal Accessibility: Any service with OpenAPI can become AI-accessible
  • Zero Integration Cost: No code changes required on the API side
  • Progressive Enhancement: From zero-config to advanced customization
  • Local-First Control: Full control over your tools without vendor lock-in

The Solution: Intelligent Tool Curation

API2MCP transforms OpenAPI specifications into intent-driven, AI-optimized tool collections through:

  • 🧠 Smart Tool Aggregation: Combines related endpoints into high-level, task-oriented tools
  • πŸ“ Document Patch Enhancement: Enriches poor-quality OpenAPI documentation with AI-friendly descriptions
  • πŸ”„ Hybrid Tool/Resource Mapping: Intelligent mapping of GET methods to both MCP Tools and Resources
  • πŸŽ›οΈ Visual Configuration Interface: MCPMate integration for drag-and-drop tool design

Design Principles

  • Minimal Integration Cost: Zero changes required to existing APIs
  • Universal Compatibility: Works with any OpenAPI-compliant service
  • Zero-Configuration Start: Just provide an OpenAPI URL to get started
  • Progressive Configuration: From simple to complex use cases
  • Local-First Priority: Full control without vendor dependencies

πŸ† Competitive Advantage

Our analysis of the OpenAPI-to-MCP market reveals four distinct solution categories. API2MCP uniquely positions itself in the sweet spot:

Feature Basic CLI Tools Enterprise Gateways Commercial Platforms API2MCP
Local Deployment βœ… βœ… ❌ βœ…
Visual Configuration ❌ ❌ βœ… βœ…
Tool Curation ❌ Limited βœ… βœ…
Document Enhancement ❌ ❌ ❌ βœ…
Zero Vendor Lock-in βœ… βœ… ❌ βœ…
Enterprise Features ❌ βœ… βœ… βœ…

Our Unique Value Proposition:

  • Local-First + Visual: Combines Speakeasy's UX with local deployment control
  • Document Patch System: First platform to systematically address OpenAPI documentation deficiencies
  • Intelligent Mapping: GET methods can be exposed as both Tools and Resources
  • MCPMate Ecosystem: Deep integration with the broader MCP management platform
  • Progressive Enhancement: From zero-config to advanced customization

πŸš€ Quick Start

Installation

# From releases (recommended)
curl -L https://github.com/MCPMate/api2mcp/releases/latest/download/api2mcp-$(uname -s)-$(uname -m).tar.gz | tar xz
sudo mv api2mcp /usr/local/bin/

# From source
git clone https://github.com/MCPMate/api2mcp.git
cd api2mcp
cargo install --path .

Basic Usage

# Minimal setup - just provide OpenAPI URL
api2mcp --openapi-url https://api.example.com/openapi.json

# With configuration
api2mcp --config config.yaml

Example Configuration

# config.yaml
source:
  openapi_url: "https://api.example.com/openapi.json"
  api_base_url: "https://api.example.com"

naming:
  pattern: "{project}_{tag}_{action}"
  project: "myapi"

filtering:
  include_tags: ["users", "projects", "billing"]
  exclude_paths: ["/internal/*", "/admin/*"]

mapping_rules:
  resources:
    - pattern: "GET /api/*/list"
    - pattern: "GET /api/*/schema"
  tools:
    - pattern: "GET /api/*/search"
    - pattern: "POST /api/*"
  mixed:
    - pattern: "GET /api/users/*"

auth:
  type: "bearer"
  token_source: "env:API_TOKEN"

πŸ› οΈ Core Features

1. Intelligent Tool Curation

Problem: A typical REST API with 100+ endpoints becomes unmanageable for AI agents.

Solution: API2MCP intelligently groups and curates tools:

# Instead of exposing 5 separate user endpoints:
# - POST /users (create)
# - GET /users/{id} (read)
# - PUT /users/{id} (update)
# - DELETE /users/{id} (delete)
# - GET /users/{id}/profile (profile)

# API2MCP creates intent-based tools:
tools:
  - name: "manage_user_profile"
    description: "Complete user profile management including creation, updates, and profile access"
    aggregates: ["POST /users", "PUT /users/{id}", "GET /users/{id}/profile"]

2. Document Patch Enhancement

Problem: Many OpenAPI specs have poor descriptions, missing examples, and unclear parameters.

Solution: Overlay system for document enhancement:

# patches.yaml
patches:
  operations:
    "GET /users/{id}":
      summary: "Get detailed user information"
      description: "Retrieves complete user profile including preferences and settings"
      parameters:
        id:
          description: "Unique user identifier (numeric ID)"
          example: "12345"
  schemas:
    User:
      properties:
        email:
          example: "user@example.com"

3. Hybrid Tool/Resource Mapping

GET Method Intelligence: Automatically determines whether GET endpoints should be:

  • MCP Resources: For simple data retrieval (lists, schemas)
  • MCP Tools: For complex operations (search, export)
  • Mixed Mode: Both, for maximum flexibility

4. Visual Configuration (MCPMate Integration)

  • Real-time tool preview as you configure
  • Drag-and-drop tool design interface
  • Export configurations for standalone deployment
  • Template library for common API patterns

πŸ“‹ Architecture & Design

Design Principles

  • Minimal Integration Cost: Zero-configuration start with progressive enhancement
  • Universal Compatibility: Works with any OpenAPI-compliant service
  • Local-First: No vendor lock-in, full control over your tools
  • Progressive Configuration: Simple start β†’ advanced customization

Technical Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   OpenAPI       β”‚    β”‚   API2MCP       β”‚    β”‚   MCP Server    β”‚
β”‚   Specification │───▢│   Engine        │───▢│   Runtime       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             β”‚
                       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                       β”‚   MCPMate       β”‚
                       β”‚   Web UI        β”‚
                       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key Components:

  • Lazy Loading Engine: HTTP-based OpenAPI fetching with retry/caching
  • Patch Overlay System: Non-destructive document enhancement
  • Tool Aggregation Engine: Intelligent endpoint grouping
  • Authentication Mapper: Secure credential management
  • Hot Reload System: Zero-downtime configuration updates

πŸŽ›οΈ Advanced Configuration

Authentication Mapping

auth:
  # Parsed from OpenAPI securitySchemes
  schemes:
    - type: "bearer"
      header: "Authorization"
    - type: "apikey"
      name: "X-API-Key"
      location: "header"

  # Runtime credential management
  management:
    enabled: true
    management_key: "${MGMT_KEY}"
    tools: ["set_bearer_token", "set_api_key"]

Filtering & Scoping

filtering:
  # Path-based filtering (glob patterns)
  include_paths: ["/api/v1/*", "/api/v2/users/*"]
  exclude_paths: ["/api/*/internal/*"]

  # Tag-based filtering
  include_tags: ["public", "users", "billing"]
  exclude_tags: ["admin", "internal"]

  # HTTP method filtering
  methods: ["GET", "POST", "PUT", "DELETE"]

Performance & Reliability

performance:
  # Caching strategy
  cache:
    enabled: true
    etag_support: true
    local_cache: "/tmp/api2mcp-cache"

  # HTTP client settings
  http:
    timeout: 30s
    retry_count: 3
    rate_limit: 100  # requests per minute
    concurrency: 10

  # Refresh behavior
  refresh:
    interval: 60s
    backoff_max: 300s

πŸ—οΈ Development Roadmap

Phase 1: Core Engine (M1) - Q1 2025

  • βœ… OpenAPI parsing and tool generation
  • βœ… Basic authentication support (Bearer, API Key)
  • βœ… Path/tag filtering
  • βœ… CLI interface with configuration files
  • 🎯 Goal: Feature parity with existing OpenAPI-MCP tools

Phase 2: Enhanced Capabilities (M2) - Q2 2025

  • πŸ“ Document patch enhancement system
  • πŸ”„ Smart tool/resource mapping for GET methods
  • πŸ”„ Advanced authentication (OAuth 2.1, DCR)
  • πŸ“Š Auto-refresh with ETag/hash detection
  • 🎯 Goal: Differentiated document enhancement capabilities

Phase 3: Visual Integration (M3) - Q3 2025

  • 🎨 MCPMate web UI integration
  • πŸŽ›οΈ Visual tool curation interface
  • πŸ“‹ Configuration templates and presets
  • πŸ“ˆ Real-time monitoring and analytics
  • 🎯 Goal: Best-in-class visual configuration experience

Phase 4: Enterprise Features (M4) - Q4 2025

  • 🏒 Multi-source aggregation
  • πŸ” Advanced credential management
  • πŸ“Š Observability and diagnostics
  • πŸš€ High-performance optimizations
  • 🎯 Goal: Enterprise-ready platform capabilities

πŸ” Competitive Analysis

Based on our comprehensive market analysis, the OpenAPI-to-MCP space is rapidly evolving:

Key Players:

Market Gaps API2MCP Addresses:

  1. Local + Visual: No other solution combines local deployment with visual configuration
  2. Document Quality: First platform to systematically address OpenAPI documentation deficiencies
  3. Intelligent Mapping: Unique approach to GET method tool/resource dual exposure
  4. Curation Focus: Only platform prioritizing "tool design" over "code generation"

🀝 Contributing

We welcome contributions! See our Development Guide for:

  • Architecture overview and coding standards
  • Local development setup
  • Testing guidelines
  • Documentation standards

Quick Development Setup

git clone https://github.com/MCPMate/api2mcp.git
cd api2mcp

# Install dependencies
cargo build

# Run tests
cargo test

# Local development with hot reload
cargo watch -x run

πŸ“– Documentation

🎯 Use Cases

For Individual Developers

# Quick prototype: expose your API to Claude Desktop
api2mcp --openapi-url http://localhost:3000/openapi.json

For Product Teams

# config.yaml - Curated tools for specific workflows
source:
  openapi_url: "https://api.yourapp.com/openapi.json"
patches:
  operations:
    "POST /campaigns":
      summary: "Launch marketing campaign"
      description: "Creates and launches a new marketing campaign with specified targeting and budget"

For Enterprise Platforms

# Multi-service aggregation with governance
sources:
  - name: "user-service"
    openapi_url: "https://users.internal.com/openapi.json"
    namespace: "users"
  - name: "billing-service"
    openapi_url: "https://billing.internal.com/openapi.json"
    namespace: "billing"

governance:
  auth_required: true
  rate_limits:
    per_user: 1000
    per_tool: 100

πŸ”— Related Projects

πŸ“„ License

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

πŸ™ Acknowledgments


Ready to transform your APIs into AI-ready tools? Get started or join our community!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published