MCP ExplorerExplorer

Openmcp

@getdatanauton 2 months ago
277 MIT
FreeCommunity
AI Systems
#mcp#mcp-client#mcp-server#model-context-protocol#openapi
Turn any openapi file into an mcp server, with just the tools you need.

Overview

What is Openmcp

OpenMCP is a tool designed to simplify the process of transforming any OpenAPI specification into an MCP (Model Context Protocol) server. It enables users to aggregate multiple MCP servers into a single server by utilizing only the necessary tools while supporting standard input/output (stdio) and server-sent events (sse) transports. Additionally, it is compatible with major chat clients.

Use cases

OpenMCP can be utilized for various scenarios, such as integrating public APIs into chat applications, enhancing chatbots with additional functionalities, and enabling users to fetch data (e.g., weather forecasts) seamlessly within their preferred chat clients. It allows for easy remixing of services to tailor a server to specific needs.

How to use

To get started with OpenMCP, users can run the installation command using npx to specify the OpenAPI specification URL or file path and the target chat client. After the installation, an openmcp.json configuration file is generated, detailing the server settings along with necessary authentication configurations. Users can run the server using the provided command to manually specify the path to the configuration file.

Key features

OpenMCP’s key features include the ability to mix various servers, support for OpenAPI specifications, automatic configuration generation, and command-line interface integration for ease of use. It also provides flexibility with tools and the capability to expose specific operations through the server setup.

Where to use

OpenMCP can be effectively used in development environments where interaction with APIs is required, particularly in chat-based platforms. It is suitable for developers looking to create powerful, interactive applications or assistants that need to access real-time data from external services while ensuring a streamlined user experience.

Content

OpenMCP

OpenMCP makes it easy to turn any OpenAPI specification into an MCP server, and to remix many MCP servers into a single
server with just the tools you need. It supports stdio and sse transports, and works with all of the major chat clients.

To get started, run this command:

npx -y openmcp install <url or file path to openapi specification> --client <chat client>

For example, to add the ability to query the weather from Cursor, you could run this:

# openmcp will prompt you for a security key since this api requires it - but for this weather api the value can be any string
npx -y openmcp install https://api.weather.gov/openapi.json --client cursor

And this is what that ends up looking like:

2025-05-15 14 20 46

Running the install command will create an openmcp.json file for you, and add the openmcp server to your the mcp
config of your target (cursor, claude, etc). Running install again will update any existing openmcp.json file, if
present.

openmcp.json format

The openmcp.json file describes the servers that should be started, auth configuration for each, and which tools you
want to expose for each server.

Bellow is a fully annotated example that mixes an openapi based server with a stdio server. Running openmcp with this
config would result in an mcp server with two tools - a tool to get the weather forecast, and a tool to make queries to
a local postgres database.

{
  // The configs object is a map of variable names to values. These variables can be referenced in the servers object below.
  // If a value is not set, openmcp will attempt to read from an environment variable of the same name.
  "configs": {
    "weather-gov-api": {
      "WEATHER_GOV_API_API_KEY": "foo",
    },

    "postgres": {
      // Or leave blank to read from the environment variable "POSTGRES_URL"
      "POSTGRES_URL": "postgresql://localhost/mydb",
    },
  },
  "servers": {
    // Example of an openapi server
    "weather-gov-api": {
      "type": "openapi",
      // The openapi specification can be a url or a local file path
      "openapi": "https://api.weather.gov/openapi.json",
      // The base url of the server
      "serverUrl": "https://api.weather.gov",
      // Optional headers to send with requests to the server. They can reference values from the configs object above.
      "headers": {
        "User-Agent": "{{WEATHER_GOV_API_API_KEY}}",
      },
      // Optional query parameters to send with requests to the server.
      "query": {},
      // The tools to expose for this server (by operationId). Leaving this empty will expose all tools.
      "tools": ["zone_forecast"],
    },

    // Example of a stdio server
    "postgres": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-postgres", "{{POSTGRES_URL}}"],
      // The tools allowlist also works with stdio servers. In this case we only expose the relatively safe "query" tool.
      "tools": ["query"],
    },
  },
}

Running the server

The install command will handle this for you, but if you’d like to run an openmcp server manually you can do so with
this command:

npx -y openmcp run --config <path to openmcp.json config>

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers