{"type":"mcp_server","name":"mcpo","description":"**Concise Description:**\n\nMCP-to-OpenAPI proxy. Securely exposes Model Context Protocol data via OpenAPI.","category":"Communication","language":"Python","stars":4283,"forks":295,"owner":"open-webui","github_url":"https://github.com/open-webui/mcpo","homepage":"https://docs.openwebui.com/openapi-servers/mcp","setup":"## Setup\n\n### Prerequisites\n\n*   Python 3.8+\n*   uv (optional, but highly recommended for performance and packaging)\n\n### Installation\n\nThere are several ways to install and run `mcpo`:\n\n**1. Using uv (Recommended):**\n\nuv provides lightning-fast startup and zero configuration.\n\n```bash\nuv pip install mcpo\n```\n\n**2. Using pip:**\n\nIf you prefer using `pip`:\n\n```bash\npip install mcpo\n```\n\n**3. Running via Docker (No Installation Required):**\n\nThis method avoids the need for local installations.\n\n```bash\ndocker run -p 8000:8000 ghcr.io/open-webui/mcpo:main --api-key \"top-secret\" -- your_mcp_server_command\n```\n\n### Configuration and Usage\n\nAfter installation, you can run `mcpo` with the following options:\n\n**Basic Usage:**\n\n```bash\nmcpo --port 8000 --api-key \"your-secret-api-key\" -- your_mcp_server_command\n```\n\n*   `--port`:  The port on which `mcpo` will listen for incoming HTTP requests (default: 8000).\n*   `--api-key`:  An API key for securing access to the `mcpo` server.  **Important:** Replace `\"your-secret-api-key\"` with a strong, unique key.\n*   `your_mcp_server_command`: The command to execute your MCP server.  This is the core functionality that `mcpo` exposes via HTTP.\n\n**Example with `mcp-server-time`:**\n\n```bash\nuvx mcpo --port 8000 --api-key \"top-secret\" -- uvx mcp-server-time --local-timezone=America/New_York\n```\n\n**SSE-Compatible MCP Server:**\n\nIf your MCP server uses Server-Sent Events (SSE):\n\n```bash\nmcpo --port 8000 --api-key \"top-secret\" --server-type \"sse\" -- http://127.0.0.1:8001/sse\n```\n\n*   `--server-type \"sse\"`: Specifies that the MCP server uses SSE.\n*   `http://127.0.0.1:8001/sse`: The URL of your SSE server.\n\n**SSE Headers:**\n\nTo include custom headers with the SSE connection:\n\n```bash\nmcpo --port 8000 --api-key \"top-secret\" --server-type \"sse\" --headers '{\"Authorization\": \"Bearer token\", \"X-Custom-Header\": \"value\"}' -- http://127.0.0.1:8001/sse\n```\n\n*   `--headers`:  A JSON string containing the headers to send with the SSE request.\n\n**Streamable HTTP-Compatible MCP Server:**\n\nIf your MCP server uses Streamable HTTP:\n\n```bash\nmcpo --port 8000 --api-key \"top-secret\" --server-type \"streamable_http\" -- http://127.0.0.1:8002/mcp\n```\n\n*   `--server-type \"streamable_http\"`: Specifies that the MCP server uses Streamable HTTP.\n*   `http://127.0.0.1:8002/mcp`: The URL of your Streamable HTTP server.\n\n**Using a Configuration File:**\n\nFor managing multiple MCP servers, you can use a configuration file in the Claude Desktop format.\n\n1.  **Create a `config.json` file (example):**\n\n    ```json\n    {\n      \"mcpServers\": {\n        \"memory\": {\n          \"command\": \"npx\",\n          \"args\": [\"-y\", \"@modelcontextprotocol/server-memory\"]\n        },\n        \"time\": {\n          \"command\": \"uvx\",\n          \"args\": [\"mcp-server-time\", \"--local-timezone=America/New_York\"]\n        },\n        \"mcp_sse\": {\n          \"type\": \"sse\",\n          \"url\": \"http://127.0.0.1:8001/sse\",\n          \"headers\": {\n            \"Authorization\": \"Bearer token\",\n            \"X-Custom-Header\": \"value\"\n          }\n        },\n        \"mcp_streamable_http\": {\n          \"type\": \"streamable_http\",\n          \"url\": \"http://127.0.0.1:8002/mcp\"\n        }\n      }\n    }\n    ```\n\n2.  **Run `mcpo` with the `--config` option:**\n\n    ```bash\n    mcpo --config /path/to/config.json --api-key \"top-secret\"\n    ```\n\n    *   `--config`: Specifies the path to your `config.json` file.\n\n**Accessing the OpenAPI Schema:**\n\nOnce `mcpo` is running, you can access the auto-generated OpenAPI schema and interactive documentation at `http://localhost:<port>/docs` (e.g., `http://localhost:8000/docs`). When using a config file, each tool will have its own endpoint and documentation (e.g., `http://localhost:8000/memory/docs`, `http://localhost:8000/time/docs`).\n\n### Environment Variables\n\nWhile not explicitly required, you can use environment variables for sensitive information like the API key.  For example:\n\n```bash\nexport MCPO_API_KEY=\"your-secret-api-key\"\nmcpo --port 8000 --api-key \"$MCPO_API_KEY\" -- your_mcp_server_command\n```\n\nThis prevents the API key from being directly visible in your command history.","tools":"## Available Tools\n\nmcpo provides the following features to expose MCP tools as OpenAPI-compatible HTTP servers:\n\n*   **OpenAPI Proxy:** Exposes any MCP server command as a RESTful API endpoint, instantly making it compatible with LLM agents and applications expecting OpenAPI servers.\n    *   Usage: `mcpo --port 8000 --api-key \"top-secret\" -- your_mcp_server_command`\n\n*   **Automatic OpenAPI Documentation:** Auto-generates interactive documentation for each exposed MCP tool, accessible via a `/docs` endpoint. No configuration is required.\n    *   Usage: Access the documentation at `http://localhost:8000/docs` after running mcpo.\n\n*   **Security and Stability:** Adds security, stability, and scalability to MCP tools using standard web technologies like HTTP and API keys.\n\n*   **SSE (Server-Sent Events) Support:** Allows proxying MCP servers that communicate via SSE.\n    *   Usage: `mcpo --port 8000 --api-key \"top-secret\" --server-type \"sse\" -- http://127.0.0.1:8001/sse`\n    *   Headers can be provided: `mcpo --port 8000 --api-key \"top-secret\" --server-type \"sse\" --headers '{\"Authorization\": \"Bearer token\", \"X-Custom-Header\": \"value\"}' -- http://127.0.0.1:8001/sse`\n\n*   **Streamable HTTP Support:** Allows proxying MCP servers that communicate via Streamable HTTP.\n    *   Usage: `mcpo --port 8000 --api-key \"top-secret\" --server-type \"streamable_http\" -- http://127.0.0.1:8002/mcp`\n\n*   **Configuration File Support:** Allows serving multiple MCP tools via a single configuration file (Claude Desktop format).\n    *   Usage: `mcpo --config /path/to/config.json`\n    *   Example config.json:\n        ```json\n        {\n          \"mcpServers\": {\n            \"memory\": {\n              \"command\": \"npx\",\n              \"args\": [\"-y\", \"@modelcontextprotocol/server-memory\"]\n            },\n            \"time\": {\n              \"command\": \"uvx\",\n              \"args\": [\"mcp-server-time\", \"--local-timezone=America/New_York\"]\n            },\n            \"mcp_sse\": {\n              \"type\": \"sse\", // Explicitly define type\n              \"url\": \"http://127.0.0.1:8001/sse\",\n              \"headers\": {\n                \"Authorization\": \"Bearer token\",\n                \"X-Custom-Header\": \"value\"\n              }\n            },\n            \"mcp_streamable_http\": {\n              \"type\": \"streamable_http\",\n              \"url\": \"http://127.0.0.1:8002/mcp\"\n            } // Streamable HTTP MCP Server\n          }\n        }\n        ```\n        Each tool is accessible under its own unique route, e.g.: `http://localhost:8000/memory`, `http://localhost:8000/time` with dedicated OpenAPI schema and proxy handler. Access full schema UI at: `http://localhost:8000/<tool>/docs` (e.g. `/memory/docs`, `/time/docs`)\n\n*   **Docker Support:** Can be run in a Docker container for easy deployment and portability.\n    *   Usage: `docker run -p 8000:8000 ghcr.io/open-webui/mcpo:main --api-key \"top-secret\" -- your_mcp_server_command`","faq":null,"created_at":"2025-03-30T10:03:03+00:00","updated_at":"2025-07-07T15:56:47+00:00","source_url":"https://model-context-protocol.com/servers/mcpo","related_articles":[]}