GO

getdatanaut/openmcp

Developer tools

Эта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал

303 stars 17 forks Качество 67 Тренд 18MIT

getdatanaut/openmcp — это кандидат на сервер MCP, импортированный из https://github.com/getdatanaut/openmcp.

Обзор

getdatanaut/openmcp — это кандидат на сервер MCP, импортированный из https://github.com/getdatanaut/openmcp.

Обзор (машинный перевод)

OpenMCP позволяет легко превратить любую спецификацию OpenAPI в MCP-сервер и ремиксировать множество MCP-серверов в один Сервер с нужными инструментами. Поддерживает STDIO и SSE транспорты, а также работает со всеми основными чат-клиентами.

Чтобы начать, выполните эту команду:

Например, чтобы добавить возможность запроса погоды из Cursor, можно запустить следующее:

И вот как это в итоге выглядит:

Запуск команды установки создаёт для вас файл openmcp.json и добавит openmcp сервер к вашему mcp конфигурации вашей цели (курсор, клод и т.д.). Повторная установка обновит любой существующий файл openmcp.json, если Присутствует.

openmcp.json формат

Файл openmcp.json описывает серверы, которые следует запускать, конфигурацию аутентификации для каждого и какие инструменты нужно использовать Хочу экспонировать для каждого сервера.

Bellow — это полностью аннотированный пример, который смешивает сервер на основе openAPI и сервер stdio. Запуск openmcp с этим Конфигурация приведёт к созданию MCP-сервера с двумя инструментами — инструментом для получения прогноза погоды и инструментом для создания запросов Локальная база данных Postgres.

Запуск сервера

Эта страница переведена автоматически. Технические детали смотрите в оригинале.

README

Показан фрагмент оригинального README. Открыть оригинал.

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  --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:

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}}"],
Открыть полный README на GitHub

Установка

npx -y @modelcontextprotocol/server-postgres {{POSTGRES_URL}}
Новичок в MCP? Начните с руководства на mcpskill.org →