MCP Link Documentation

repository·main·Indexed 20 days ago

https://github.com/automation-ai-labs/mcp-link

A tool that automatically converts OpenAPI V3 APIs into Model Context Protocol (MCP) servers, enabling RESTful APIs to be compatible with AI Agent calling standards without modifying the original implementation. It features a Go-based server with support for OpenAPI specification URLs, base URL mapping, authentication header configuration, and path filter expressions to include or exclude specific endpoints.

Tokens
812
Snippets
6
Records
7
Agent score
20%

What's inside MCP Link

  1. Integrate MCP Link into an AI Agent

    main

    To use a converted API in an AI Agent, add the MCP server configuration to your agent's configuration file. The url must point to the SSE endpoint with the appropriate conversion parameters appended as query strings.

    {
      "mcpServers": {
        "@service-name": {
          "url": "http://localhost:8080/sse?s=[OpenAPI-Spec-URL]&u=[API-Base-URL]&h=[Auth-Header]:[Value-Prefix]"
        }
      }
    }
  2. Configure MCP Link via URL parameters

    main

    MCP Link uses query parameters to define how an OpenAPI API is converted into an MCP server. When accessing the SSE endpoint, use the following parameters:

    • s=: The URL of the OpenAPI specification file.
    • u=: The Base URL of the target API.
    • h=: The authentication header format, provided as header-name:value-prefix (e.g., Authorization:Bearer ).
    • f=: Path filter expressions to include or exclude specific API endpoints.
  3. Use path filters to include or exclude endpoints

    main

    The f= parameter allows you to control which API endpoints are exposed to the MCP server using path filter expressions.

    Syntax Rules:

    • +/path/**: Include all endpoints under /path/.
    • -/path/**: Exclude all endpoints under /path/.
    • +/users/*:GET: Include only GET endpoints for /users/{id}.
    • Wildcards: * matches any single path segment; ** matches zero or more segments.
    • Separation: Multiple filters are separated by semicolons (e.g., +/**:GET;-/internal/**).
    +/path/**
    -/path/**
    +/users/*:GET
    +/**:GET;-/internal/**
  4. Run the mcp-link server via CLI

    main

    The mcp-link CLI provides a serve command to start the MCP Link server, which converts OpenAPI endpoints into MCP-compatible endpoints. By default, it listens on localhost:8080.

    # Start the server with default settings (localhost:8080)
    mcp-link serve
    
    # Start the server on a specific host and port
    mcp-link serve --host 0.0.0.0 --port 9000
    
    # Using aliases
    mcp-link serve -H 0.0.0.0 -p 9000