Logo de Openapi MCP

Openapi MCP

Communauté
ckanthony

Dockerized MCP Server to allow your AI agent to access any API with existing api docs

Éditeurckanthony
Dépôtopenapi-mcp
LangueGo
Forks
40
Étoiles
196
Outils disponibles
0
Type de transportstdio
Liens
  • Connectez des outils à vos workflows IA

    Openapi MCP propose des fonctionnalités MCP utilisables par les clients et agents IA compatibles.

  • 0 outils disponibles

    Parcourez les actions invocables ci-dessous, avec leurs noms et descriptions lorsque le serveur les fournit.

  • Configuration prête à copier

    Utilisez les exemples de configuration pour configurer ce serveur dans votre client MCP préféré.

  • Indicateurs de popularité open source

    196 étoiles et 40 forks sur le dépôt associé.

OpenAPI-MCP: Dockerized MCP Server to allow your AI agent to access any API with existing api docs

Go Reference CI codecov

Trust Score

openapi-mcp logo

Generate MCP tool definitions directly from a Swagger/OpenAPI specification file.

OpenAPI-MCP is a dockerized MCP server that reads a swagger.json or openapi.yaml file and generates a corresponding Model Context Protocol (MCP) toolset. This allows MCP-compatible clients like Cursor to interact with APIs described by standard OpenAPI specifications. Now you can enable your AI agent to access any API by simply providing its OpenAPI/Swagger specification - no additional coding required.

Table of Contents

Demo

Run the demo yourself: Running the Weatherbit Example (Step-by-Step)

demo

Why OpenAPI-MCP?

  • Standard Compliance: Leverage your existing OpenAPI/Swagger documentation.
  • Automatic Tool Generation: Create MCP tools without manual configuration for each endpoint.
  • Flexible API Key Handling: Securely manage API key authentication for the proxied API without exposing keys to the MCP client.
  • Local & Remote Specs: Works with local specification files or remote URLs.
  • Dockerized Tool: Easily deploy and run as a containerized service with Docker.

Features

  • OpenAPI v2 (Swagger) & v3 Support: Parses standard specification formats.
  • Schema Generation: Creates MCP tool schemas from OpenAPI operation parameters and request/response definitions.
  • Secure API Key Management:
    • Injects API keys into requests (header, query, path, cookie) based on command-line configuration.
      • Loads API keys directly from flags (--api-key), environment variables (--api-key-env), or .env files located alongside local specs.
      • Keeps API keys hidden from the end MCP client (e.g., the AI assistant).
  • Server URL Detection: Uses server URLs from the spec as the base for tool interactions (can be overridden).
  • Filtering: Options to include/exclude specific operations or tags (--include-tag, --exclude-tag, --include-op, --exclude-op).
  • Request Header Injection: Pass custom headers (e.g., for additional auth, tracing) via the REQUEST_HEADERS environment variable.

Installation

Docker

The recommended way to run this tool is via Docker.

Using the Pre-built Docker Hub Image (Recommended)

Alternatively, you can use the pre-built image available on Docker Hub.

  1. Pull the Image:
    bash
    docker pull ckanthony/openapi-mcp:latest
  2. Run the Container: Follow the docker run examples above, but replace openapi-mcp:latest with ckanthony/openapi-mcp:latest.

Building Locally (Optional)

  1. Build the Docker Image Locally:

    bash
    # Navigate to the repository root
    cd openapi-mcp
    # Build the Docker image (tag it as you like, e.g., openapi-mcp:latest)
    docker build -t openapi-mcp:latest .
  2. Run the Container: You need to provide the OpenAPI specification and any necessary API key configuration when running the container.

    • Example 1: Using a local spec file and .env file:

      • Create a directory (e.g., ./my-api) containing your openapi.json or swagger.yaml.
      • If the API requires a key, create a .env file in the same directory (e.g., ./my-api/.env) with API_KEY=your_actual_key (replace API_KEY if your --api-key-env flag is different).
      bash
      docker run -p 8080:8080 --rm \\
          -v $(pwd)/my-api:/app/spec \\
          --env-file $(pwd)/my-api/.env \\
          openapi-mcp:latest \\
          --spec /app/spec/openapi.json \\
          --api-key-env API_KEY \\
          --api-key-name X-API-Key \\
          --api-key-loc header

      (Adjust --spec, --api-key-env, --api-key-name, --api-key-loc, and -p as needed.)

    • Example 2: Using a remote spec URL and direct environment variable:

      bash
      docker run -p 8080:8080 --rm \\
          -e SOME_API_KEY="your_actual_key" \\
          openapi-mcp:latest \\
          --spec https://petstore.swagger.io/v2/swagger.json \\
          --api-key-env SOME_API_KEY \\
          --api-key-name api_key \\
          --api-key-loc header
    • Key Docker Run Options:

      • -p <host_port>:8080: Map a port on your host to the container's default port 8080.
      • --rm: Automatically remove the container when it exits.
      • -v <host_path>:<container_path>: Mount a local directory containing your spec into the container. Use absolute paths or $(pwd)/.... Common container path: /app/spec.
      • --env-file <path_to_host_env_file>: Load environment variables from a local file (for API keys, etc.). Path is on the host.
      • -e <VAR_NAME>="<value>": Pass a single environment variable directly.
      • openapi-mcp:latest: The name of the image you built locally.
      • --spec ...: Required. Path to the spec file inside the container (e.g., /app/spec/openapi.json) or a public URL.
      • --port 8080: (Optional) Change the internal port the server listens on (must match the container port in -p).
      • --api-key-env, --api-key-name, --api-key-loc: Required if the target API needs an API key.
      • (See --help for all command-line options by running docker run --rm openapi-mcp:latest --help)

Running the Weatherbit Example (Step-by-Step)

This repository includes an example using the Weatherbit API. Here's how to run it using the public Docker image:

  1. Find OpenAPI Specs (Optional Knowledge): Many public APIs have their OpenAPI/Swagger specifications available online. A great resource for discovering them is APIs.guru. The Weatherbit specification used in this example (weatherbitio-swagger.json) was sourced from there.

  2. Get a Weatherbit API Key:

    • Go to Weatherbit.io and sign up for an account (they offer a free tier).
    • Find your API key in your Weatherbit account dashboard.
  3. Clone this Repository: You need the example files from this repository.

    bash
    git clone https://github.com/ckanthony/openapi-mcp.git
    cd openapi-mcp
  4. Prepare Environment File:

    • Navigate to the example directory: cd example/weather
    • Copy the example environment file: cp .env.example .env
    • Edit the new .env file and replace YOUR_WEATHERBIT_API_KEY_HERE with the actual API key you obtained from Weatherbit.
  5. Run the Docker Container: From the openapi-mcp root directory (the one containing the example folder), run the following command:

    bash
    docker run -p 8080:8080 --rm \\
        -v $(pwd)/example/weather:/app/spec \\
        --env-file $(pwd)/example/weather/.env \\
        ckanthony/openapi-mcp:latest \\
        --spec /app/spec/weatherbitio-swagger.json \\
        --api-key-env API_KEY \\
        --api-key-name key \\
        --api-key-loc query
    • -v $(pwd)/example/weather:/app/spec: Mounts the local example/weather directory (containing the spec and .env file) to /app/spec inside the container.
    • --env-file $(pwd)/example/weather/.env: Tells Docker to load environment variables (specifically API_KEY) from your .env file.
    • ckanthony/openapi-mcp:latest: Uses the public Docker image.
    • --spec /app/spec/weatherbitio-swagger.json: Points to the spec file inside the container.
    • The --api-key-* flags configure how the tool should inject the API key (read from the API_KEY env var, named key, placed in the query string).
  6. Access the MCP Server: The MCP server should now be running and accessible at http://localhost:8080 for compatible clients.

Using Docker Compose (Example):

A docker-compose.yml file is provided in the example/ directory to demonstrate running the Weatherbit API example using the locally built image.

  1. Prepare Environment File: Copy example/weather/.env.example to example/weather/.env and add your actual Weatherbit API key:

    dotenv
    # example/weather/.env
    API_KEY=YOUR_ACTUAL_WEATHERBIT_KEY
  2. Run with Docker Compose: Navigate to the example directory and run:

    bash
    cd example
    # This builds the image locally based on ../Dockerfile
    # It does NOT use the public Docker Hub image
    docker-compose up --build
    • --build: Forces Docker Compose to build the image using the Dockerfile in the project root before starting the service.
    • Compose will read example/docker-compose.yml, build the image, mount ./weather, read ./weather/.env, and start the openapi-mcp container with the specified command-line arguments.
    • The MCP server will be available at http://localhost:8080.
  3. Stop the service: Press Ctrl+C in the terminal where Compose is running, or run docker-compose down from the example directory in another terminal.

Command-Line Options

The openapi-mcp command accepts the following flags:

FlagDescriptionTypeDefault
--specRequired. Path or URL to the OpenAPI specification file.string(none)
--portPort to run the MCP server on.int8080
--api-keyDirect API key value (use --api-key-env or .env file instead for security).string(none)
--api-key-envEnvironment variable name containing the API key. If spec is local, also checks .env file in the spec's directory.string(none)
--api-key-nameRequired if key used. Name of the API key parameter (header, query, path, or cookie name).string(none)
--api-key-locRequired if key used. Location of API key: header, query, path, or cookie.string(none)
--include-tagTag to include (can be repeated). If include flags are used, only included items are exposed.string slice(none)
--exclude-tagTag to exclude (can be repeated). Exclusions apply after inclusions.string slice(none)
--include-opOperation ID to include (can be repeated).string slice(none)
--exclude-opOperation ID to exclude (can be repeated).string slice(none)
--base-urlManually override the target API server base URL detected from the spec.string(none)
--nameDefault name for the generated MCP toolset (used if spec has no title).string"OpenAPI-MCP Tools"
--descDefault description for the generated MCP toolset (used if spec has no description).string"Tools generated from OpenAPI spec"

Note: You can get this list by running the tool with the --help flag (e.g., docker run --rm ckanthony/openapi-mcp:latest --help).

Environment Variables

  • REQUEST_HEADERS: Set this environment variable to a JSON string (e.g., '{"X-Custom": "Value"}') to add custom headers to all outgoing requests to the target API.

Utilisez le serveur MCP Openapi MCP avec plusieurs modèles IA

TypingMind connecte les outils MCP au niveau de l’espace de travail. Une fois Openapi MCP connecté, vous pouvez donc l’utiliser avec différents modèles IA dans TypingMind sans avoir à le configurer séparément pour chaque modèle. Cette intégration MCP s’exécute localement sur votre appareil via le connecteur MCP de TypingMind.

Guide de configuration du connecteur local

Choisissez cette méthode si le serveur MCP doit accéder à des fichiers locaux, à des applications ou à des ressources privées sur votre ordinateur.

1

Ouvrir les paramètres MCP

Dans TypingMind, accédez à « Paramètres », puis à « Paramètres avancés » et à « Model Context Protocol », et choisissez « Configurer connecteur ».

  1. Ouvrez TypingMind dans votre navigateur.
  2. Cliquez sur l’icône Paramètres.
  3. Accédez aux paramètres avancés.
  4. Ouvrez la section Model Context Protocol.
  5. Cliquez sur « Configurer connecteur » et choisissez « Cet appareil ».
Écran de configuration du connecteur MCP de TypingMind avec l’option « Cet appareil » sélectionnée
2

Exécuter la commande du connecteur

Choisissez « Cet appareil », copiez la commande depuis TypingMind et exécutez-la dans Terminal. Laissez le processus en cours d’exécution pendant que vous utilisez MCP.

  1. Copiez la commande de configuration affichée par TypingMind.
  2. Ouvrez Terminal sur macOS ou Windows Terminal sur Windows.
  3. Collez et exécutez la commande.
  4. Autorisez l’installation du paquet si Terminal vous demande de confirmer.
  5. Gardez la fenêtre de Terminal ouverte et le processus en cours d’exécution pendant que vous utilisez les outils MCP.
3

Ajoutez Openapi MCP en tant que serveur

Lorsque l’état du connecteur affiche « Prêt », cliquez sur « Éditer serveurs » et collez la configuration du serveur MCP.

  1. Attendez que l’état du connecteur affiche « Prêt ».
  2. Cliquez sur « Éditer serveurs ».
  3. Collez la configuration du serveur MCP Openapi MCP.
  4. Enregistrez la liste des serveurs.
  5. Actualisez pour vérifier que le connecteur est toujours prêt.
Paramètres MCP de TypingMind affichant un serveur actif et le bouton « Éditer serveurs »
{
  "mcpServers": {
    "ckanthony-openapi-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Utiliser la connexion avec différents modèles

Enregistrez la liste des serveurs, ouvrez « Plugins », activez les outils MCP de Openapi MCP, puis sélectionnez un modèle IA compatible dans TypingMind et utilisez les outils dans une discussion ou attribuez-les à un agent IA.

  1. Ouvrez la page Plugins dans TypingMind.
  2. Activez les outils MCP de Openapi MCP.
  3. Démarrez une discussion et choisissez le modèle IA que vous souhaitez utiliser.
  4. Utilisez les outils MCP dans le chat ou attribuez-les à un agent IA.
  5. Passez à un autre modèle IA selon vos besoins sans rétablir la connexion MCP.
Discussion TypingMind utilisant des outils MCP activés avec un modèle d’IA sélectionné
Pouvez-vous utiliser Openapi MCP pour m’aider dans cette tâche ?
Openapi MCP
Bien sûr. J’ai tout lu.
Voici ce que j’ai trouvé avec Openapi MCP.

Foire aux questions

À quoi sert le serveur MCP Openapi MCP ?

Openapi MCP est un serveur MCP qui permet aux applications IA compatibles d’accéder à des outils et à des informations contextuelles externes. Dans TypingMind, il vous suffit d’ajouter ce serveur MCP une seule fois pour rendre ses outils disponibles dans votre espace de travail IA.

Puis-je utiliser le serveur MCP Openapi MCP avec plusieurs modèles IA dans TypingMind ?

Oui. TypingMind connecte les outils MCP au niveau de l’espace de travail. Vous pouvez donc utiliser Openapi MCP avec différents modèles IA comme Claude, ChatGPT, Gemini ou d’autres modèles configurés dans TypingMind, sans avoir à configurer le serveur MCP séparément pour chaque modèle.

Pourquoi utiliser le connecteur MCP Openapi MCP avec TypingMind ?

TypingMind est l’une des meilleures interfaces de chat avec les LLM, car elle réunit plusieurs modèles IA, prompts, plugins, agents IA, clés API et outils MCP dans un seul espace de travail. Une fois Openapi MCP connecté, vous pouvez utiliser ses outils MCP avec vos modèles préférés tout en gardant vos discussions bien organisées dans TypingMind.

Comment connecter le serveur MCP Openapi MCP à TypingMind ?

Openapi MCP fonctionne via le connecteur MCP local de TypingMind. C’est l’option idéale lorsque le serveur MCP doit accéder à des fichiers locaux, des applications de bureau, des outils en ligne de commande ou des ressources privées sur votre ordinateur.

Quels outils le serveur MCP Openapi MCP propose-t-il dans TypingMind ?

Openapi MCP propose des fonctionnalités MCP que vous pouvez activer depuis la page Plugins de TypingMind et utiliser dans les discussions ou attribuer à des agents IA.

Dois-je partager mes clés API avec TypingMind pour utiliser le serveur MCP Openapi MCP ?

Non. TypingMind privilégie le fonctionnement local et vous permet de garder le contrôle de vos fournisseurs de modèles, clés API, prompts et paramètres MCP. Si Openapi MCP nécessite une authentification, ajoutez les en-têtes, les paramètres OAuth ou la configuration locale requis pour ce serveur MCP lors de la création de la connexion.

Serveurs MCP similaires

Tout voir

Créez votre propre espace IA dès maintenant

Abonnez-vous à notre newsletter pour être informé des nouvelles fonctionnalités et des prochains cadeaux à gagner 👇