OdinMCP
A distributed MCP server framework enabling scalable task execution across multiple nodes with streamable HTTP transport, integrated authentication, and real-time streaming via the Asgard infrastructure.
README
OdinMCP
<div align="center"> <h3><strong>O</strong>utrageously <strong>D</strong>istributed <strong>I</strong>nfrastructure <strong>N</strong>etwork for MCP servers.</h3>
[![PyPI][pypi-badge]][pypi-url] [![MIT licensed][mit-badge]][mit-url] [![Python Version][python-badge]][python-url]
</div>
Table of Contents
- Overview
- Problem Statement
- Architecture
- Installation
- Quickstart
- Migrating from mcp.FastMCP to OdinMCP
- Deployment
- Contributing
- License
Overview
OdinMCP extends the base MCP library by adding support for distributed workers, enabling scalable task execution across multiple nodes. This is accomplished while fully supporting the streamable-http transport as suggested in the MCP specification, allowing for efficient real-time streaming and interoperability.
Problem Statement
The goal of OdinMCP is to address challenges related to:
- Securing user authentication.
- Handling high-demand streaming.
- Distributing tasks across multiple nodes for scalability.
Architecture
OdinMCP is designed to operate as a distributed system, enabling secure, scalable, and efficient management of large language models (LLMs) and their connections to diverse data sources. The architecture brings together several critical capabilities: authentication, API gateway management, real-time streaming, and a unified inspector UI for testing and event streaming.

At the core of this distributed architecture is Asgard, which provides the infrastructure layer that integrates and orchestrates these capabilities. Asgard leverages several open source components to deliver a robust and modular platform:
- Authentication & Authorization: Managed via Keycloak and OIDC protocols, with Heimdall handling user authentication and authorization.
- API Gateway: Bifrost, powered by Kong Gateway, routes and secures incoming requests, integrating with Heimdall for token validation.
- Streaming & Server-Sent Events (SSE): Hermod, leveraging Pushpin and the GRIP protocol, manages real-time streaming and offloads connection management from core services.
- Inspector UI: Loki provides a web interface for browsing and streaming events via Inspector and SSE.
By combining these components under the Asgard infrastructure, OdinMCP achieves a standardized and extensible approach to running MCP-based systems in distributed environments.
For more details, see the Asgard documentation.
Installation
You can install OdinMCP using pip or poetry:
pip install odinmcp
or
poetry add odinmcp
Quickstart
Below is a minimal example of a server.py you can use to get started with OdinMCP. This file defines a few example tools and sets up both the web server and worker:
from odinmcp import OdinMCP
from mcp.server.fastmcp import Context
import time
from typing import Any
mcp = OdinMCP("Odin MCP Demo")
@mcp.tool()
def add(a: int, b: int) -> int:
return a + b
@mcp.tool()
async def send_client_request_for_roots(ctx: Context) -> list[Any]:
return await ctx.session.list_roots()
@mcp.tool()
async def very_long_running_task_will_cancel(ctx: Context) -> None:
print("very_long_running_task_will_cancel has started")
time.sleep(30)
print("very_long_running_task_will_cancel has finished")
web, worker = mcp.sse_app()
You can now run this file using the CLI commands below.
How to Deploy
-
Project Setup(only once)
odinmcp setup_asgardCopies the default Asgard project structure into your current directory. Add
--forceto overwrite existing files. -
Start Asgard Proxies and Services
cd ./asgard docker-compose upThis will run all the required proxies and services for Asgard using Docker Compose.
-
Start the Web Server ( in a new terminal )
odinmcp web server.py:web --host 0.0.0.0 --port 80Launches the Starlette ASGI web server. Replace
server.py:webwith your module and app variable (e.g.,myproject.main.py:web). -
Start the Worker Process ( in a new terminal )
odinmcp worker server.py:worker --loglevel=infoStarts the Celery worker for distributed task processing. Replace
server.py:workerwith your module and worker variable. You can run any number of workers for distributed task processing.
Note:
- The web server and worker process must be started separately for full functionality.
- You can use the standard Uvicorn and Celery CLIs if you prefer, but the OdinMCP CLI provides a unified interface.
Migrating from mcp.FastMCP to OdinMCP
OdinMCP is a drop-in replacement for FastMCP with improved scalability and streaming. To migrate:
- Uninstall mcp:
pip uninstall mcp - Install OdinMCP:
pip install odinmcp - Update Imports: Replace
from mcp.server.fastmcp import FastMCPwithfrom odinmcp import OdinWeb(orOdinMCPas appropriate) - Replace Class Names: Change
FastMCPtoOdinWeb(orOdinMCP) - App Creation: Use
app, worker = mcp.sse_app()instead ofapp = mcp.streamable_http_app()
Deployment
Deploying Asgard with Docker Compose
To start all Asgard infrastructure services (API gateway, authentication, streaming, etc.), use Docker Compose:
cd ./asgard
docker-compose up
This will launch all required proxies and services for distributed operation. Make sure you have run odinmcp setup_asgard first to generate the Asgard directory structure.
Web Server
- FastMCP:
uvicorn server:app --host 0.0.0.0 --port 80- or
mcp dev server.py
- OdinMCP:
odinmcp web server.py:web --host 0.0.0.0 --port 80- or use any ASGI server (e.g., Uvicorn) as above
Worker Process
- FastMCP:
- No explicit background worker; FastMCP does not support distributed background processing.
- OdinMCP:
odinmcp worker server.py:worker --loglevel=info- or
celery -A server worker --loglevel=info - The worker must be started separately for distributed task processing.
Note: For OdinMCP, both the web server and worker process must be started for full functionality.
Contributing
Contributions to OdinMCP are welcome! Please open issues, fork the repository, and submit pull requests to help improve functionality and performance.
License
This project is licensed under the MIT License. See the LICENSE file for details.
<!-- Badge definitions --> [pypi-badge]: https://img.shields.io/pypi/v/odinmcp.svg?style=flat-square [pypi-url]: https://pypi.org/project/odinmcp/ [mit-badge]: https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square [mit-url]: https://opensource.org/licenses/MIT [python-badge]: https://img.shields.io/pypi/pyversions/odinmcp.svg?style=flat-square [python-url]: https://www.python.org/downloads/
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。