mcp2api
Converts any MCP server into simple HTTP endpoints, enabling AI agents that only support HTTP (like ChatGPT Custom GPT or web_fetch) to use MCP tools.
README
mcp2api
Любой MCP → обычный HTTP за 15 секунд. Один файл, ноль билда.
npx -y github/megamen32/mcp2api -- --command "npx @anthropic-ai/mcp-server-fetch" --port 8080
Зачем
MCP — крутой протокол. Но есть проблема: не все ИИ умеют подключать MCP напрямую.
Claude Desktop подключает. Cursor подключает. А что если ты хочешь:
- Дать ChatGPT Custom GPT доступ к MCP-тулам? ChatGPT не умеет в MCP.
- Подключить MCP к Telegram-боту? Там только HTTP.
- Использовать MCP-инструменты в Alice, GigaChat, DeepSeek? Нет MCP-клиента.
- Дать chat.z.ai вызывать MCP? Там есть
web_fetch, но нет MCP.
А curl умеют все. Любой ИИ с доступом в интернет может сделать GET-запрос.
mcp2api берёт любой MCP-сервер и превращает его инструменты в простые HTTP-ручки. Один вызов npx — и готово.
Как это решает проблему CustomGPT
У ChatGPT Custom GPT нет MCP. Но есть Actions — он умеет вызывать HTTP-эндпоинты.
- Запускаешь mcp2api с нужным MCP-сервером:
npx -y github/megamen32/mcp2api -- \ --command "npx @anthropic-ai/mcp-server-fetch" \ --port 8080 \ --api-key your-secret - В настройках CustomGPT добавляешь OpenAPI-схему:
http://your-server:8080/ - Готово — Custom GPT вызывает MCP-инструменты через обычные HTTP-запросы.
GET-only режим (для агентов с web_fetch)
Некоторые ИИ-агенты не умеют POST-запросы. Только web_fetch / web_search. Для них есть --get-only:
npx -y github/megamen32/mcp2api -- \
--command "npx @anthropic-ai/mcp-server-fetch" \
--port 8080 \
--get-only
В этом режиме вызов инструмента — это просто GET:
GET /tools/echo?message=hello
GET /tools/fetch?url=https://example.com
GET /tools/search?query=mcp+protocol&limit=5
Типы автоматически кастятся: "5" → 5, "true" → true.
Любой ИИ, который умеет делать web_fetch(url) — теперь может вызывать MCP-инструменты.
One-liner
# stdio (запускает MCP-сервер как процесс)
npx -y github/megamen32/mcp2api -- --command "npx @anthropic-ai/mcp-server-fetch" --port 8080
# SSE (подключается к уже запущенному MCP-серверу)
npx -y github/megamen32/mcp2api -- --transport sse --url http://localhost:3001/sse
# StreamableHTTP
npx -y github/megamen32/mcp2api -- --transport streamable-http --url http://localhost:3001/mcp
# GET-only (для агентов без POST, типа web_fetch)
npx -y github/megamen32/mcp2api -- --command "npx @anthropic-ai/mcp-server-fetch" --get-only --port 8080
Endpoints
| Method | Path | Описание |
|---|---|---|
| GET | / |
Инфо о сервере, список эндпоинтов |
| GET | /healthz |
Health check |
| GET | /schema |
MCP capabilities |
| GET | /tools |
Список инструментов со схемами |
| GET | /tools/:name |
Схема инструмента (без query params) |
| GET | /tools/:name?key=val |
Вызов инструмента через query params |
| POST | /tools/:name |
Вызов инструмента (body = аргументы) |
| POST | /call |
Вызов через {"name": "...", "arguments": {...}} |
| GET | /resources |
Список ресурсов |
| GET | /resources/read?uri=<uri> |
Чтение ресурса |
| GET | /prompts |
Список промптов |
| POST | /prompts/:name |
Получить промпт |
Примеры
# Список инструментов
curl http://localhost:4321/tools
# Схема конкретного инструмента
curl http://localhost:4321/tools/fetch
# Вызов через POST (полный режим)
curl -X POST http://localhost:4321/tools/fetch \
-H 'Content-Type: application/json' \
-d '{"url": "https://example.com"}'
# Вызов через GET (работает даже в web_fetch!)
curl 'http://localhost:4321/tools/fetch?url=https://example.com'
# Через /call
curl -X POST http://localhost:4321/call \
-H 'Content-Type: application/json' \
-d '{"name": "fetch", "arguments": {"url": "https://example.com"}}'
Флаги
| Флаг | Env Var | Default | Описание |
|---|---|---|---|
--transport |
MCP_TRANSPORT |
stdio |
stdio, sse, streamable-http |
--command |
MCP_COMMAND |
— | Команда для запуска (stdio) |
--args |
MCP_ARGS |
— | Доп. аргументы через запятую (stdio) |
--env |
MCP_ENV |
— | JSON с доп. env vars (stdio) |
--url |
MCP_URL |
— | URL сервера (sse/streamable-http) |
--port |
MCP_PORT |
4321 |
Порт |
--host |
MCP_HOST |
0.0.0.0 |
Хост |
--api-key |
MCP_API_KEY |
— | Bearer-токен для авторизации |
--get-only |
MCP_GET_ONLY |
false |
Только GET (для web_fetch агентов) |
Авторизация (опционально)
npx -y github/megamen32/mcp2api -- --api-key mysecret --port 8080
Передавай Authorization: Bearer mysecret или ?api_key=mysecret.
Лицензия
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.