# HMR MCP server

> Hot-reloads changed Python modules at variable-level granularity so an AI client's MCP server keeps state and connections alive.

- Repository: https://github.com/promplate/hmr
- Page: https://hostedmcp.org/servers/promplate/hmr
- Official: yes
- Transport: remote
- Stars: 60
- Latest version: 1.0.2

## Install

### Claude Code

```sh
claude mcp add --transport http hmr https://pyth-on-line.promplate.dev/hmr/mcp
```

### Cursor (`~/.cursor/mcp.json`)

```json
{
  "mcpServers": {
    "hmr": {
      "url": "https://pyth-on-line.promplate.dev/hmr/mcp"
    }
  }
}
```

### VS Code (`.vscode/mcp.json`)

```json
{
  "servers": {
    "hmr": {
      "type": "http",
      "url": "https://pyth-on-line.promplate.dev/hmr/mcp"
    }
  }
}
```

### VS Code CLI

```sh
code --add-mcp '{"name":"hmr","type":"http","url":"https://pyth-on-line.promplate.dev/hmr/mcp"}'
```

### Codex

```sh
codex mcp add hmr --url https://pyth-on-line.promplate.dev/hmr/mcp
```

### Codex config.toml (`~/.codex/config.toml`)

```toml
[mcp_servers.hmr]
url = "https://pyth-on-line.promplate.dev/hmr/mcp"
```

### Gemini CLI

```sh
gemini mcp add -s user --transport http hmr https://pyth-on-line.promplate.dev/hmr/mcp
```

### Gemini settings.json (`~/.gemini/settings.json`)

```json
{
  "mcpServers": {
    "hmr": {
      "url": "https://pyth-on-line.promplate.dev/hmr/mcp",
      "type": "http"
    }
  }
}
```

## FAQ

### What is HMR for Python?

HMR is a reactive programming engine and hot-reload tool that reruns only the affected modules when files change, keeping application state intact instead of restarting the process.

### How do I run a script with hot reload?

Install the package with pip and run the hmr CLI with the path to your entry file; arguments work like the python command but files hot-reload on changes.

### Can I use HMR with MCP or FastMCP servers?

Yes, the ecosystem includes mcp-hmr, an HMR-enabled MCP / FastMCP server, so code updates apply without dropping connections.

### How does HMR detect which code to reload?

It uses runtime dependency tracking with a signal system, a custom Module class, and watchfiles-based file tracking, plus an audit hook to catch non-Python file reads.

### Does HMR reload browser content when server code changes?

No, this package implements server-side HMR that only reloads Python code on changes; browser refresh is a separate middleware.
