@reapi/mcp-openapi logo

@reapi/mcp-openapi

by ReAPI

A Model Context Protocol (MCP) server that loads and serves multiple OpenAPI specifications to enable LLM-powered IDE integrations. This server acts as a bridge between your OpenAPI specifications and LLM-powered development tools like Cursor and other code editors.

View on GitHub

Last updated: N/A

What is @reapi/mcp-openapi?

The @reapi/mcp-openapi server is a Model Context Protocol (MCP) server designed to facilitate the integration of OpenAPI specifications with LLM-powered IDEs like Cursor. It loads and serves multiple OpenAPI specifications from a directory, enabling LLMs to understand and interact with your APIs directly within the IDE.

How to use @reapi/mcp-openapi?

To use the server, configure it either project-specifically or globally in Cursor IDE's MCP settings. Specify the command to run the server (e.g., npx @reapi/mcp-openapi@latest --dir ./specs) and the directory containing your OpenAPI specifications. Enable the server in Cursor settings and refresh the API catalog.

Key features of @reapi/mcp-openapi

  • Loads multiple OpenAPI specifications from a directory

  • Exposes API operations and schemas through MCP protocol

  • Enables LLMs to understand and work with your APIs directly in your IDE

  • Supports dereferenced schemas for complete API context

  • Maintains a catalog of all available APIs

Use cases of @reapi/mcp-openapi

  • Providing API context to LLMs in IDEs

  • Enabling intelligent code completion based on API specifications

  • Assisting in API integration within development workflows

  • Generating API-aware code snippets using LLMs

FAQ from @reapi/mcp-openapi

How do I configure the server in Cursor?

You can configure the server either project-specifically by creating a .cursor/mcp.json file in your project directory, or globally by editing ~/.cursor/mcp.json in your home directory.

Where should I place my OpenAPI specifications?

Place your OpenAPI 3.x specifications (JSON or YAML) in a directory, and configure the server to point to that directory using the --dir argument.

How do I refresh the API catalog?

Open Cursor's chat panel and type prompts like "Please refresh the API catalog" or "Reload the OpenAPI specifications".

What is x-spec-id and why is it important?

The x-spec-id is a custom identifier you can add to your OpenAPI info object to uniquely identify a specification, especially useful when working with multiple specifications that have similar endpoint paths or schema names.

What are some example prompts I can use in Cursor?

You can use prompts like "Show me all available APIs in the catalog with their operations", "Show me the details of the create pet API endpoint", or "Generate an Axios client for the create pet API".