MCP OpenAPI Server
local-only server
The server can only run on the client’s local machine because it depends on local resources.
Integrations
Enables code generation for API clients using Axios, allowing users to create requests to endpoints defined in OpenAPI specifications.
Provides example usage of APIs with curl commands derived from OpenAPI specifications.
Supports generating React hooks for API endpoints, facilitating integration of OpenAPI-defined services into React applications.
@reapi/mcp-openapi
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.
Features
- 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
Powered by ReAPI
This open-source MCP server is sponsored by ReAPI, a next-generation API platform that simplifies API design and testing. While this server provides local OpenAPI integration for development, ReAPI offers two powerful modules:
🎨 API CMS
- Design APIs using an intuitive no-code editor
- Generate and publish OpenAPI specifications automatically
- Collaborate with team members in real-time
- Version control and change management
🧪 API Testing
- The most developer-friendly no-code API testing solution
- Create and manage test cases with an intuitive interface
- Powerful assertion and validation capabilities
- Serverless cloud test executor
- Perfect for both QA teams and developers
- CI/CD integration ready
Try ReAPI for free at reapi.com and experience the future of API development.
Cursor Configuration
To integrate the MCP OpenAPI server with Cursor IDE, you have two options for configuration locations:
Option 1: Project-specific Configuration (Recommended)
Create a .cursor/mcp.json
file in your project directory. This option is recommended as it allows you to maintain different sets of specs for different projects
Tip: Using a relative path like
./specs
makes the configuration portable and easier to share across team members.Note: We recommend using
@latest
tag as we frequently update the server with new features and improvements.Important: Project-specific configuration helps manage LLM context limits. When all specifications are placed in a single folder, the combined metadata could exceed the LLM's context window, leading to errors. Organizing specs by project keeps the context size manageable.
Option 2: Global Configuration
Create or edit ~/.cursor/mcp.json
in your home directory to make the server available across all projects:
Enable in Cursor Settings
After adding the configuration:
- Open Cursor IDE
- Go to Settings > Cursor Settings > MCP
- Enable the @reapi/mcp-openapi server
- Click the refresh icon next to the server to apply changes
Note: By default, Cursor requires confirmation for each MCP tool execution. If you want to allow automatic execution without confirmation, you can enable Yolo mode in Cursor settings.
The server is now ready to use. When you add new OpenAPI specifications to your directory, you can refresh the catalog by:
- Opening Cursor's chat panel
- Typing one of these prompts:Copy
OpenAPI Specification Requirements
- Place your OpenAPI 3.x specifications in the target directory:
- Supports both JSON and YAML formats
- Files should have
.json
,.yaml
, or.yml
extensions - Scanner will automatically discover and process all specification files
- Specification ID Configuration:
- By default, the filename (without extension) is used as the specification ID
- To specify a custom ID, add
x-spec-id
in the OpenAPI info object:
CopyImportant: Setting a custom
x-spec-id
is crucial when working with multiple specifications that have:- Similar or identical endpoint paths
- Same schema names
- Overlapping operation IDs
The spec ID helps distinguish between these similar resources and prevents naming conflicts. For example:
CopyNow you can reference these endpoints specifically as
user-service/users
andadmin-service/users
How It Works
- The server scans the specified directory for OpenAPI specification files
- It processes and dereferences the specifications for complete context
- Creates and maintains a catalog of all API operations and schemas
- Exposes this information through the MCP protocol
- IDE integrations can then use this information to:
- Provide API context to LLMs
- Enable intelligent code completion
- Assist in API integration
- Generate API-aware code snippets
Tools
refresh-api-catalog
- Refresh the API catalog
- Returns: Success message when catalog is refreshed
get-api-catalog
- Get the API catalog, the catalog contains metadata about all openapi specifications, their operations and schemas
- Returns: Complete API catalog with all specifications, operations, and schemas
search-api-operations
- Search for operations across specifications
- Inputs:
query
(string): Search queryspecId
(optional string): Specific API specification ID to search within
- Returns: Matching operations from the API catalog
search-api-schemas
- Search for schemas across specifications
- Inputs:
query
(string): Search queryspecId
(optional string): Specific API specification ID to search
- Returns: Matching schemas from the API catalog
load-api-operation-by-operationId
- Load an operation by operationId
- Inputs:
specId
(string): API specification IDoperationId
(string): Operation ID to load
- Returns: Complete operation details
load-api-operation-by-path-and-method
- Load an operation by path and method
- Inputs:
specId
(string): API specification IDpath
(string): API endpoint pathmethod
(string): HTTP method
- Returns: Complete operation details
load-api-schema-by-schemaName
- Load a schema by schemaName
- Inputs:
specId
(string): API specification IDschemaName
(string): Name of the schema to load
- Returns: Complete schema details
Roadmap
- Semantic Search
- Enable natural language queries for API operations and schemas
- Improve search accuracy with semantic understanding
- Remote Specs Sync
- Support syncing OpenAPI specifications from remote sources
- Code Templates
- Expose code templates through MCP protocol
- Provide reference patterns for LLM code generation
- Community Contributions
- Submit feature requests and bug reports
- Contribute to improve the server
Example Prompts in Cursor
Here are some example prompts you can use in Cursor IDE to interact with your APIs:
- Explore Available APIsCopy
- API Operation DetailsCopy
- Schema and Mock DataCopy
- Code GenerationCopy
- API Integration AssistanceCopy
- Documentation and UsageCopy
- Validation and TypesCopy
- API Search and DiscoveryCopy
These prompts demonstrate how to leverage the MCP server's capabilities for API development. Feel free to adapt them to your specific needs or combine them for more complex tasks.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
You must be authenticated.
A Model Context Protocol server that loads multiple OpenAPI specifications and exposes them to LLM-powered IDE integrations, enabling AI to understand and work with your APIs directly in development tools like Cursor.
- Features
- Powered by ReAPI
- Cursor Configuration
- How It Works
- Tools
- Roadmap
- Example Prompts in Cursor
- Contributing