Releases: promplate/hmr
mcp-hmr v0.0.3
What's Changes
- Support for multiple transport protocols:
--transport/-tflag allows choosing betweenstdio,http,sse,streamable-http - New CLI options for Streamable HTTP transport configuration:
--host,--port,--path - Programmatic API:
mcp_server(target)context manager enables using mcp-hmr without CLI, allowing custom middleware and server extensions
Features ✨
CLI Enhancements
The CLI now supports all transport protocols available in fastmcp run, making it a true drop-in replacement:
# Use streamable-http transport
mcp-hmr main:app -t streamable-http --port 8000
# Custom host and port
mcp-hmr main:app -t http --host 0.0.0.0 --port 3000Programmatic API
You can now integrate mcp-hmr directly in your code to add custom functionality:
from mcp_hmr import mcp_server
async with mcp_server("main.py:mcp") as mcp:
# Add middleware, configure settings, etc.
# mcp.add_middleware(...)
await mcp.run_async() # runs with hot-reloading enabled ✨This is useful when you want to extend your server with additional features like CORS middleware while maintaining HMR capabilities.
Important
For the programmatic API to work correctly with HMR, ensure that the target module has not been imported yet when calling mcp_server(target). Otherwise, hot-reloading won't take effect.
Tip
As a reminder, mcp-hmr provides Hot Module Reloading for MCP/FastMCP servers.
It acts as a drop-in replacement for mcp run or fastmcp run. Both FastMCP v2 and the official python SDK are supported.
Under the hood, we use FastMCP.mount to hot swap the underlying fastmcp.FastMCP / mcp.server.FastMCP instances, providing fine-grained on-demand hot-reloading DX for your local MCP Server development.
Full Changelog: mcp-hmr/v0.0.2...mcp-hmr/v0.0.3
mcp-hmr v0.0.2
API Changes
- 0438f6c now both
mcp-hmr path/to/file.py:app(new) andmcp-hmr module:apptarget is supported - fad2b48 now support
--log-level
Internal Changes
- 38f4318 safer task management via
TaskGroup
Full Changelog: mcp-hmr/v0.0.1...mcp-hmr/v0.0.2
Tip
As a reminder, mcp-hmr provides Hot Module Reloading for MCP/FastMCP servers.
It acts as a drop-in replacement for mcp run or fastmcp run. Both FastMCP v2 and the official python SDK are supported.
Under the hood, we uses FastMCP.mount to hot swap the underlying fastmcp.FastMCP / mcp.server.FastMCP instances, providing fine-grained on-demand hot-reloading DX for your local MCP Server development.
Demo
mcp-inspector-demo.mov
Hot Reload your MCP Server ✨
mcp-hmr
Provides Hot Module Reloading for MCP/FastMCP servers.
It acts as a drop-in replacement for mcp run or fastmcp run. Both FastMCP v2 and the official python SDK are supported.
Usage
If your server instance is named app in path/to/main.py, you can run:
mcp-hmr path.to.main:appWhich will be equivalent to the following code but with HMR enabled:
from path.to.main import app
app.run("stdio")Now, whenever you save changes to your source code, the server will automatically reload without dropping the connection to the client.
Details
This integration uses FastMCP.mount to hot swap the underlying fastmcp.FastMCP / mcp.server.fastmcp.FastMCP instances, providing fine-grained on-demand hot-reloading DX for your local MCP Server development.
Currently only
stdiotransport is supported. But since theuvicorn-hmrintegration already exists for a while, that won't be hard.
Full Changelog: see PR #39