Skip to main content

OdinMCP

Outrageously Distributed Infrastructure Network for MCP servers.

PyPI MIT licensed Python Version

Watch the Demo

You can watch the demo video for this project above or on YouTube.

Table of Contents

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.

OdinMCP Architecture Diagram

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

  1. Project Setup(only once)

    odinmcp setup_asgard
    

    Copies the default Asgard project structure into your current directory. Add --force to overwrite existing files.

  2. Start Asgard Proxies and Services

    cd ./asgard
    docker-compose up
    

    This will run all the required proxies and services for Asgard using Docker Compose.

  3. Start the Web Server ( in a new terminal )

    odinmcp web server.py:web --host 0.0.0.0 --port 80
    

    Launches the Starlette ASGI web server. Replace server.py:web with your module and app variable (e.g., myproject.main.py:web).

  4. Start the Worker Process ( in a new terminal )

    odinmcp worker server.py:worker --loglevel=info
    

    Starts the Celery worker for distributed task processing. Replace server.py:worker with 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 FastMCP with from odinmcp import OdinWeb (or OdinMCP as appropriate)
  • Replace Class Names: Change FastMCP to OdinWeb (or OdinMCP)
  • App Creation: Use app, worker = mcp.sse_app() instead of app = 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.

Metadata

Release files for odinmcp 0.0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for odinmcp 0.0.9
File Size Uploaded Provenance
odinmcp-0.0.9.tar.gz 42.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for odinmcp 0.0.9
File Interpreter ABI Platform
odinmcp-0.0.9-py3-none-any.whl Python 3 none any Details

Total release size: 94.5 kB

Release files / odinmcp-0.0.9.tar.gz

Download URL odinmcp-0.0.9.tar.gz
Size 42.5 kB
Tags Source
SHA-256 checksum
How to use checksums
407b58a757af0869765bc70f0dfe4cf503eed8ea98f4d5e7457489a562df0200
BLAKE2b-256 checksum
How to use checksums
fdb0a5aa4b1c428248c88140478e3641a7fde261f8b81448937e536611c9eaeb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.11.12 Linux/6.11.0-1014-azure

Release files / odinmcp-0.0.9-py3-none-any.whl

Download URL odinmcp-0.0.9-py3-none-any.whl
Size 51.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
80f67b8b50346403c115363311821a7a870d06240015feb24f1a7b9c9819c534
BLAKE2b-256 checksum
How to use checksums
da0a955262a3d003e035137ed13f4cfab12c4380ca3f8ce9fee5ae0c6bfe13cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.11.12 Linux/6.11.0-1014-azure

Security for odinmcp 0.0.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page