PluginBench
MCP Server
Active

dev.promplate/hmr MCP Server

dev.promplate/hmr

Variable-level fine-grained hot-module reloading and reactive programming for Python development.

What is the dev.promplate/hmr MCP server?

The HMR MCP server provides documentation and tools for hot-module reloading (HMR) and reactive programming in Python. HMR allows you to update parts of your Python application at runtime without full process restarts, keeping app state intact while intelligently rerunning only affected code. It uses runtime dependency tracking to achieve variable-level granularity, far more efficient than traditional reloaders that restart the entire process on any file change.

HMR brings the smooth development experience of frontend hot-reloading to Python backends. Instead of waiting for full process restarts when code changes (like with uvicorn --reload), HMR tracks dependencies at the variable level and only reruns affected modules. This is especially valuable for development workflows with expensive initialization (e.g., ML models, database connections) where every second counts. The ecosystem includes integrations for FastAPI, Flask, MCP servers, and more.

How to install dev.promplate/hmr

Copy-paste configuration for popular MCP clients.

transport: http
Config generated by PluginBench — verify against the source before use.
~/.cursor/mcp.json
{
  "mcpServers": {
    "hmr": {
      "url": "https://pyth-on-line.promplate.dev/hmr/mcp"
    }
  }
}

Use cases

  • Develop FastAPI services with instant code updates without restarting the server or losing application state
  • Iterate on ML model serving code without waiting for model re-initialization on every change
  • Build and test Flask applications with live reloading that preserves session and memory state
  • Develop MCP servers with live code updates without dropping client connections
  • Create reactive Python applications using fine-grained signal-based reactivity patterns

dev.promplate/hmr MCP server FAQ

What is HMR and how does it differ from uvicorn --reload?

HMR (Hot Module Reload) intelligently reruns only the affected code when files change, keeping your app state intact. Traditional reloaders like uvicorn --reload restart the entire process on any change, which is wasteful. HMR uses runtime dependency tracking to achieve variable-level granularity—if you change a variable nothing depends on, nothing happens.

Is HMR production-ready?

The HMR ecosystem is stable and production-ready for most use cases. It handles common edge cases and Python patterns like lazy imports, dynamic imports, decorators, and module-level __getattr__. However, circular dependencies in some edge cases may cause unexpected behavior, so use caution if you have extensive code in __init__.py.

How do I install and use HMR?

Install via pip with `pip install hmr`, then run `hmr path/to/your/entry-file.py`. Parameters work exactly like the python command. If you have `uv` installed, you can also try `uvx hmr path/to/your/entry-file.py` directly.

What integrations does HMR provide?

HMR includes ecosystem packages for uvicorn-hmr (ASGI apps like FastAPI), mcp-hmr (MCP servers), hmr-daemon (background module refreshing), and fastapi-reloader (browser auto-refresh middleware).

Is HMR the same as client-side hot reloading?

No. HMR is server-side hot reloading that reloads Python code upon changes. It should not be confused with client-side hot reloading that updates browser content when server code changes.

How does HMR track dependencies?

HMR uses runtime dependency tracking with a signal/observer pattern and custom Module class that tracks __getattr__ and __setattr__ calls. It monitors file system changes via watchfiles and file reads via sys.addaudithook, enabling variable-level granularity across any file type.

README (reference)

Source of truth, from the repository.

HMR for Python

PyPI - Version PyPI - Downloads Python Versions PyPI - Status GitHub Created At GitHub commit activity

HMR provides a pythonic, flexible, progressive-yet-intuitive reactive programming engine / framework, and on top of that, a fine-grained, on-demand hot-reload tool.

In Python, HMR stands for Hot Module Reload, though in JavaScript it commonly refers to Hot Module Replacement—essentially the same concept. It is a feature that allows part of your app to be updated at runtime without a full rerun, without needing to restart the entire process.

Unlike traditional Python reloaders (such as watchfiles CLI, uvicorn --reload, or Flask's debug mode), HMR is much more efficient and robust. These tools typically restart the entire process whenever a file changes, which is wasteful. HMR instead intelligently reruns only what's necessary, keeping your app state intact.

https://github.com/user-attachments/assets/f9ac6302-44dc-4a6d-86ae-f299fae7be80

Imagine you're developing an ML service using FastAPI with a model that requires 5 seconds to initialize. When using uvicorn --reload, any change—even updating a simple docstring—triggers a full process restart, forcing you to wait those 5 seconds every time. It's as frustrating as encountering a red light at every intersection.

HMR offers a smoother experience. Changes take effect instantly because HMR is variable-level fine-grained: your codebase functions like a dependency graph—when you modify a file, HMR only reruns the affected modules from that modified module up to your entry point file. If you update a variable that nothing depends on, nothing happens.

[!CAUTION]

What this package is not?

hmr should not be confused with client-side hot reloading that updates browser content when server code changes. This package implements server-side HMR, which only reloads python code upon changes.

Usage

The quickest way to experience HMR is through the CLI:

pip install hmr
hmr path/to/your/entry-file.py

Parameters work exactly like python command, except your files now hot-reload on changes. Try saving files to see instant updates without losing state.

If you have uv installed, you can try hmr directly with:

uvx hmr path/to/your/entry-file.py

Ecosystem

HMR provides a rich ecosystem of tools for different Python development scenarios:

PackageUse Case
hmrReactive programming library and HMR core implementation
uvicorn-hmrHMR-enabled Uvicorn server for ASGI apps (FastAPI, Starlette, etc.)
mcp-hmrHMR-enabled MCP / FastMCP servers
hmr-daemonBackground daemon that refreshes modules on changes
fastapi-reloaderBrowser auto-refresh middleware for automatic page reloading

[!TIP] The hmr ecosystem is essentially stable and production-ready for most use cases. It has been carefully designed to handle many common edge cases and Pythonic magic patterns, including lazy imports, dynamic imports, module-level __getattr__, decorators, and more. However, circular dependencies in some edge cases may still cause unexpected behavior. Use with caution if you have a lot of code in __init__.py.

https://github.com/user-attachments/assets/fb247649-193d-4eed-b778-05b02d47c3f6

Other demos

  • demo/ - Basic script with hot module reloading
  • fastapi/ - FastAPI server with hot reloading and browser refresh
  • flask/ - Flask app with hot module reloading
  • mcp/ - MCP server with live code updates without connection drops

Motivation

HMR is already a common feature in the frontend world. Web frameworks like Vite supports syncing changes to the browser without a full refresh. Test frameworks like Vitest supports on-demand updating test results without a full rerun.

So, why not bring this magic to Python?

How it works

HMR uses runtime dependency tracking instead of static analysis to achieve fine-grained reactivity:

  1. Signal & Observer Pattern: Signal is an alternative to the observer pattern. I implemented a simple signal system to notify changes whenever data is accessed or modified.
  2. Custom Module Class: I implemented a custom Module class which tracks every __getattr__ and __setattr__ call. When a variable is changed, it notifies the modules that use it. This notification is recursive but fine-grained.
  3. File System Tracking: watchfiles is used to detect file changes. If a change's path is a Python module that has been imported, it triggers reloading of affected code. Additionally, HMR monitors all file reads (via sys.addaudithook) so changes to non-Python files (YAML, JSON, etc.) also trigger appropriate reloads.

This runtime approach enables variable-level granularity and can track dependencies across any file type—far more precise than static analysis.

Contributing

This might just be one of the first variable-level fine-grained HMR frameworks in the Python ecosystem—and honestly, the real magic lies in the ecosystem we build around it.

Pair uvicorn + hmr, and you've got yourself a Vite-like development experience. Combine pytest + hmr for test-driven development that rivals Vitest. The possibilities with other libraries? Endless. Let's brainstorm together—who knows what fun (or mildly chaotic) things we might create!

[!TIP] A little backstory: the code for hmr lives in another repo because, truth be told, I wasn't planning on building an HMR framework. This started as an experiment in bringing reactive programming to Python. Along the way, I realized: why not make a module's globals reactive? And that's how HMR was born! While it began as a side project, I see tremendous potential in it for advancing Python's development experience.

For now, this repo is home to the main implementation and examples. If you think HMR has potential, or you just want to throw ideas around, I'd love to hear from you. We believe that the Python community deserves a more dynamic, responsive development experience, and we're excited to see where this can take us!

Further reading

About fine-grained reactivity, I recommend reading SolidJS’s excellent explanation.

<!-- Link References -->

Related MCP servers

Find MCP servers by intent and get exactly how to connect to them right now. No proxying.

Cite or capture a web page; installs the capture extension in Firefox and Chrome.

Translate a website into other languages from one script tag. Free trial, no signup.

0
View repository →

US police, fire, EMS and hospital locations near any address, from federal HIFLD data

0
Python
View repository →

Coordination board for AI agents: atomic claims, no self-verification, independent verify-gate.

QUQuantRisk logo

QuantRisk

Maintained

Portfolio risk analytics — VaR, Monte Carlo, optimization, options Greeks, stress testing.

2
TypeScript
MIT
View repository →