Mount an MCP server on a hayate app: Streamable HTTP transport bridging the official python-sdk
Project description
hayate-mcp
Mount an MCP server into a hayate app — a Streamable HTTP transport that bridges the official MCP Python SDK to WHATWG Request/Response. The @hono/mcp architecture, in Python.
Status: alpha (0.2.x). The transport serves MCP Inspector, Claude Code, and the official SDK client (single-JSON POST responses plus the optional server-initiated GET SSE stream). The
hayate_mcp.workersDurable Object integration is experimental — implemented and unit-tested on CPython, but not yet green on workerd (see docs/research/workers-do.md). The internal design memo (Japanese) lives in DESIGN.md.
from mcp.server.lowlevel import Server # official SDK — define your tools here
from hayate import Hayate
from hayate_mcp import McpMount
server = Server("my-tools")
# … @server.list_tools() / @server.call_tool() …
app = Hayate()
McpMount(server, path="/mcp").register(app) # that's the whole integration
Serve it with any ASGI server (uvicorn server:app), then connect:
npx @modelcontextprotocol/inspector --cli http://127.0.0.1:8000/mcp --transport http --method tools/list
claude mcp add my-tools --transport http http://127.0.0.1:8000/mcp
What it implements
| Verb | Behavior |
|---|---|
| POST | JSON-RPC request → single JSON response (initialize mints an Mcp-Session-Id); notifications → 202 |
| GET | Server-initiated SSE stream (one per session; a second returns 409) |
| DELETE | Explicit session termination |
Plus spec-mandated Origin validation (DNS-rebinding defense) and an in-memory session store with idle eviction. Protocol handling — capabilities, tool dispatch, versioning — stays entirely in the official SDK: this package is transport only, so spec revisions ride SDK upgrades.
Why
- Python is MCP's largest ecosystem, yet mounting an MCP endpoint inside your own web app still goes through ASGI plumbing with known friction.
- Cloudflare's remote-MCP story (Agents SDK, McpAgent) is TypeScript-only — MCP on Python Workers is unclaimed territory. hayate's SSE and Durable Object support are already verified on workerd, and the SDK itself imports and runs there (docs/research/pyodide.md).
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hayate_mcp-0.2.0.tar.gz.
File metadata
- Download URL: hayate_mcp-0.2.0.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
268cdcc63b4cbe880bacfd14fe01e82088051aa16f96e9e4a1b8da156dbd745f
|
|
| MD5 |
a8b74efdaba0cd3f92ed60747ae2242a
|
|
| BLAKE2b-256 |
4d5d93a12e4d6ec23b01481cb6ceb511a196416e728203dba427c11a428634a1
|
Provenance
The following attestation bundles were made for hayate_mcp-0.2.0.tar.gz:
Publisher:
release.yml on hayatepy/hayate-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hayate_mcp-0.2.0.tar.gz -
Subject digest:
268cdcc63b4cbe880bacfd14fe01e82088051aa16f96e9e4a1b8da156dbd745f - Sigstore transparency entry: 2218909331
- Sigstore integration time:
-
Permalink:
hayatepy/hayate-mcp@31566c1e6402036c76ed2cf2314c791dc2a14f84 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/hayatepy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@31566c1e6402036c76ed2cf2314c791dc2a14f84 -
Trigger Event:
push
-
Statement type:
File details
Details for the file hayate_mcp-0.2.0-py3-none-any.whl.
File metadata
- Download URL: hayate_mcp-0.2.0-py3-none-any.whl
- Upload date:
- Size: 10.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
afe883ae71a3198d747092162662744b303fb05ae4997636a94fdfbbf40b6627
|
|
| MD5 |
0cc9f05de5ebb7c360f45d3f7e7bb947
|
|
| BLAKE2b-256 |
18e363d4f1860c0739fd58d28441dce8978d6120e3f6ce0cf7d5ea42d678f097
|
Provenance
The following attestation bundles were made for hayate_mcp-0.2.0-py3-none-any.whl:
Publisher:
release.yml on hayatepy/hayate-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hayate_mcp-0.2.0-py3-none-any.whl -
Subject digest:
afe883ae71a3198d747092162662744b303fb05ae4997636a94fdfbbf40b6627 - Sigstore transparency entry: 2218909623
- Sigstore integration time:
-
Permalink:
hayatepy/hayate-mcp@31566c1e6402036c76ed2cf2314c791dc2a14f84 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/hayatepy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@31566c1e6402036c76ed2cf2314c791dc2a14f84 -
Trigger Event:
push
-
Statement type: