proratia-mcp

proratia-mcp

A generic MCP server that fetches OpenAPI/Swagger specs from any target API, with auto-discovery and Docker containerization.

Category
访问服务器

README

Proratia MCP Server (FastMCP + Docker)

A high-performance, containerized Model Context Protocol (MCP) server built with FastMCP (Python).

This server is a generic, bare-minimum MCP boilerplate for giving agents access to a locally running API's OpenAPI/Swagger spec, completely inside a Docker container. It is not tied to any specific backend—it auto-discovers whatever API is running locally, or repoint it via .env configuration, no code changes required.

No local runtimes (Python, Node, etc.) are required on the host machine—only Docker is required.


Features

  • OpenAPI Spec Fetcher (get_openapi_spec): Fetches the Swagger/OpenAPI JSON spec from a locally running API. Requires no configuration or arguments—auto-discovers the API by probing common hosts/ports/paths.

Directory Structure

proratia-mcp/
├── Dockerfile             # Container configuration with unbuffered I/O
├── docker-compose.yml     # Service compose definition for network (SSE) mode
├── .dockerignore          # Build-context exclusions
├── .env.example           # Template for local environment configuration
├── requirements.txt       # Python dependencies (fastmcp, httpx, python-dotenv)
├── server.py              # Main FastMCP server implementation
└── README.md              # This guide

1. Quick Start: Build the Docker Image

Build the docker image locally using the terminal. Open a terminal in the proratia-mcp directory and run:

docker build -t proratia-mcp:latest .

Configure the environment

Copy .env.example to .env:

cp .env.example .env
MCP_PORT=8000

MCP_PORT is the only setting needed to get started—it controls which port the server listens on (and publishes) in SSE mode via docker-compose.

No API configuration is required: get_openapi_spec takes no arguments and auto-discovers a locally running API by probing common hosts/ports/paths. If you want to skip the scan for a faster/more reliable lookup, .env.example has commented-out variables (API_BASE_URL, OPENAPI_PATH, API_HOST_HEADER, and the DISCOVERY_* candidate-list overrides) you can uncomment as needed.


2. How to Use the MCP

Add this to your MCP client's mcpServers configuration (see STDIO or SSE below for client-specific instructions and options):

{
  "mcpServers": {
    "proratia-mcp": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "--env-file",
        "/absolute/path/to/proratia-mcp/.env",
        "proratia-mcp:latest"
      ]
    }
  }
}

Once the server is connected to your client (STDIO or SSE—see the sections below), the only tool exposed is get_openapi_spec, which takes no arguments. Just ask your agent to fetch the API spec in plain language, e.g.:

"Get the OpenAPI spec for the API running locally."

Example manual invocation (e.g. via MCP Inspector):

{
  "tool": "get_openapi_spec",
  "arguments": {}
}

See Available Tools below for details on how discovery works and how to hint it via .env.


3. Integration with LLM Clients (STDIO Mode)

In STDIO mode, the LLM client (e.g., Claude Desktop, Cursor, Cline, Agy, Windsurf, or any other MCP-compatible agent) launches the Docker container as a subprocess and communicates with it using stdin and stdout.

A. Standard mcpServers JSON Configuration

Most MCP clients share the same mcpServers JSON schema, just in a client-specific config file. Add proratia-mcp there, making sure to pass the -i (interactive) flag so stdio streams stay open, and --env-file to load your .env configuration:

{
  "mcpServers": {
    "proratia-mcp": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "--env-file", "/absolute/path/to/proratia-mcp/.env",
        "proratia-mcp:latest"
      ]
    }
  }
}

Common config file locations:

  • Claude Desktop (macOS): ~/Library/Application Support/Claude/claude_desktop_config.json
  • Claude Desktop (Windows): %APPDATA%\Claude\claude_desktop_config.json
  • Cursor: .cursor/mcp.json (project-level) or global MCP settings
  • Other clients (Agy, Cline, Windsurf, etc.): check that client's MCP documentation for its config file location—the mcpServers block itself is portable across all of them.

After saving, restart your client (or reload its MCP connections) to pick up the new server.

B. GUI-Based Configuration

Some clients offer a settings UI instead of hand-editing JSON (e.g. Cursor):

  1. Go to Settings > Features > MCP (or the equivalent in your client).
  2. Click + Add New MCP Server.
  3. Fill out the fields:
    • Name: proratia-mcp
    • Type: command
    • Command: docker run -i --rm --env-file /absolute/path/to/proratia-mcp/.env proratia-mcp:latest
  4. Save and wait for the status indicator to turn green.

4. Running as a Network Service (SSE Mode)

If you prefer to run the server as a background service that clients connect to over HTTP (Server-Sent Events), you can use Docker Compose.

  1. Start the service:
    docker-compose up -d
    
  2. The server will spin up and listen on the port set by MCP_PORT in your .env file (defaults to 8000). You can configure your MCP clients to connect to http://localhost:${MCP_PORT}/sse.

To stop the service:

docker-compose down

5. Testing Changes with MCP Inspector

After modifying server.py, rebuild the image (docker build -t proratia-mcp:latest .) and use the official MCP Inspector to interactively call the tool and verify it behaves as expected before wiring it into an LLM client:

npx @modelcontextprotocol/inspector docker run -i --rm --env-file .env proratia-mcp:latest

This opens a local web UI where you can invoke get_openapi_spec (no arguments needed) and inspect the raw response.


Available Tools

1. get_openapi_spec

Fetches the Swagger/OpenAPI JSON spec from a locally running API. Takes no parameters.

  • If API_BASE_URL is set in .env, it's tried first as a fast-path hint (combined with OPENAPI_PATH and API_HOST_HEADER, if also set).
  • Otherwise, it auto-discovers the API by probing combinations of DISCOVERY_HOSTS, DISCOVERY_PORTS, DISCOVERY_PATHS, and DISCOVERY_HOST_HEADERS—all with sane defaults, overridable in .env—and returns the first response containing an openapi or swagger key.
  • API_HOST_HEADER / DISCOVERY_HOST_HEADERS override the HTTP Host header independently of the connection address. Needed when the target sits behind a reverse proxy (e.g. Caddy, Nginx) that routes by virtual host.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选