repro-mcp
An MCP server that logs AI-assisted scientific computing sessions, capturing prompts, responses, decisions, and environment snapshots to human-readable markdown files for reproducibility.
README
repro-mcp
[!NOTE] Should I use
repro-mcporrepro-git-hook?If you are looking for an infallible, automated audit trail that doesn't rely on the AI remembering to log its own decisions, we strongly recommend using the sister project: repro-git-hook.
When to use
repro-mcp:repro-mcprelies on "In-band" logging (the AI must actively call the MCP logging tools). While AI agents sometimes forget to do this when tackling complex coding problems,repro-mcphas one major advantage: it does not require Git. This makes it the perfect tool for auditing non-code workflows like document creation, legal drafting, or policy writing where a git repository isn't being used.When to use
repro-git-hook: If you are working in a Git-tracked coding environment,repro-git-hookprovides an infallible audit trail by operating "Out-of-band" — it passively hooks into yourgit commitlifecycle to run reproducibility linting, detect secrets, and extract native IDE transcripts automatically. To installrepro-git-hookinstantly: Add the following to your project's.git/hooks/pre-commit(requires uv):#!/bin/bash uvx --from git+https://github.com/ABindoff/repro-git-hook repro-hook pre-commit
An MCP server that brings reproducibility logging to AI-assisted scientific computing.
Git records what changed. repro-mcp records why — logging prompts, responses, methodological decisions, and environment snapshots to human-readable markdown files that live alongside your code.
Built for researchers working under privacy or funding constraints who run models locally and need an audit trail that holds up to peer review.
Why this exists
AI coding assistants are increasingly used in scientific workflows, but the interaction between a researcher and an AI — the prompts, the reasoning, the alternatives considered — disappears when the session ends. This matters because:
- A methods section can't cite a conversation
- A future collaborator can't reproduce your reasoning, only your code
- Environment drift silently breaks analyses months later
repro-mcp captures all of this locally. No cloud dependency. No data leaves the machine.
How it works
repro-mcp is a Model Context Protocol server. Any MCP-compatible AI client (Claude Code, Cline, Cursor, Continue) can connect to it. It exposes tools the AI can call to:
- Open a session and snapshot the environment
- Log each prompt/response exchange
- Record significant decisions and the alternatives that were rejected
- Check code against reproducibility rules before it runs
- Close the session with a git diff summary
All output goes to .repro/ in your project directory — plain markdown, git-friendly, human-readable.
Installation
Requires Python 3.11+. The recommended way is via uv:
# No install step — uvx runs it in an isolated environment
uvx repro-mcp
Or with pip:
pip install repro-mcp
Or from source:
git clone https://github.com/ABindoff/repro-mcp.git
cd repro-mcp
pip install -e .
Configuration
Claude Code
Add it manually to .mcp.json in your project root (recommended — checked into git alongside your code):
{
"mcpServers": {
"repro-mcp": {
"command": "uvx",
"args": ["repro-mcp"]
}
}
}
Or register globally via the Claude Code CLI:
claude mcp add repro-mcp --scope user -- uvx repro-mcp
Verify it's running with claude mcp list.
Auto-start via hooks (recommended)
Calling session_start manually triggers a permission prompt. The better approach is a UserPromptSubmit hook that auto-starts a session on your first message — no prompts, no manual steps.
Add this to ~/.claude/settings.json (global, applies to all projects):
{
"hooks": {
"UserPromptSubmit": [
{
"hooks": [
{
"type": "command",
"command": "repro start",
"timeout": 30
}
]
}
]
}
}
The repro command is installed alongside repro-mcp. It auto-detects the project name from your current directory and uses "Claude Code session" as the default goal. You can override either:
repro start my-project "Fit Cox model to patient cohort"
The hook is idempotent — if a session is already active it exits silently, so firing on every message is safe.
Ending a session
Close the active session from the terminal when you're done:
repro end success # or: abandoned, inconclusive
repro end success --notes "Switched to Efron method"
Or call session_end via the MCP tool if you've allowlisted repro-mcp tools (add "mcp__repro-mcp__*" to the permissions.allow array in ~/.claude/settings.local.json).
Allowlisting MCP tools (optional)
If you want to call repro-mcp tools directly (e.g. log_decision, log_exchange) without permission prompts, add this to ~/.claude/settings.local.json:
{
"permissions": {
"allow": ["mcp__repro-mcp__*"]
}
}
Cline (VS Code extension)
Open Cline settings → MCP Servers → add:
{
"repro-mcp": {
"command": "python",
"args": ["-m", "repro_mcp.server"],
"cwd": "${workspaceFolder}"
}
}
Cline SDK / CLI
Use the afterModel hook to log every turn automatically:
from cline import AgentPlugin
repro_plugin: AgentPlugin = {
"hooks": {
"afterModel": async ({ snapshot, assistantMessage }) => {
await mcpClient.callTool("log_exchange", {
"session_id": your_session_id,
"prompt": snapshot.lastUserMessage,
"response": assistantMessage.content,
})
}
}
}
Tools
| Tool | Description |
|---|---|
session_start |
Open a session, snapshot the environment, create the log file |
session_end |
Close the session, write git diff summary, update the index |
log_exchange |
Log a prompt/response pair with optional tags |
log_decision |
Log a methodological decision with rationale and alternatives |
snapshot_environment |
Capture a mid-session environment snapshot |
check_rules |
Check code against reproducibility rules before running |
Log format
Each session produces .repro/logs/YYYY-MM-DDTHHMMSS.md:
# Session: 2026-05-14T143022
**Project:** survival-analysis
**Goal:** Fit Cox model to patient cohort, compare AIC across covariates
**Branch:** feature/cox-model
**Git hash:** a3f9c12d8e41
### Environment snapshot `2026-05-14T14:30:22+00:00`
- **Python:** 3.11.4
- **Platform:** Linux 6.5.0 (x86_64)
- **Git:** `a3f9c12d8e41` (feature/cox-model)
**Packages:**
lifelines==0.29.0 numpy==1.26.4 pandas==2.2.1
---
## Exchange — 14:30:45
**Prompt:** How should I handle tied survival times in the Cox model?
**Response:** The three standard methods are Breslow, Efron, and Exact...
**Tags:** `model-fit`
---
## Decision — 14:47:12
**Decision:** Use Efron method for tie handling
**Rationale:** More accurate than Breslow when tie rate exceeds ~5%; our cohort has ~12% tied events
**Alternatives considered:** Breslow (rejected — bias at this tie rate); Exact (rejected — O(n!) complexity at n=14k)
---
## Session close — 15:45:00
**Outcome:** success
**Git diff summary:**
3 files changed, 142 insertions(+), 7 deletions(-)
An index of all sessions is maintained at .repro/index.md.
Rules
repro-mcp ships with five built-in rules. Configure them by copying repro_defaults/rules.yaml to .repro/rules.yaml in your project.
| Rule | Severity | What it checks |
|---|---|---|
random-seed |
error | Any RNG call must have a seed set in scope |
env-pinned |
warn | requirements.txt / environment.yml must pin versions |
no-hardcoded-paths |
error | No absolute paths outside of config files |
no-inplace-data-mutation |
warn | Raw data directories should not be written to |
gpu-nondeterminism |
info | CUDA ops detected without determinism flags |
To disable a rule:
# .repro/rules.yaml
rules:
gpu-nondeterminism:
enabled: false
Project layout
your-project/
└── .repro/
├── index.md # table of all sessions
├── rules.yaml # rule configuration (optional)
└── logs/
├── 2026-05-14T143022.md
└── 2026-05-14T160011.md
Add .repro/logs/ to .gitignore if you want to keep logs local, or commit them to give collaborators the full audit trail.
Roadmap
- [x] Publish to PyPI
- [ ] Cline upstream PR:
PostAssistantTurnhook for automaticlog_exchangecalls in the VS Code extension - [ ]
data-provenancerule: flag data loading that doesn't reference a hash or versioned source - [ ] Export session log as a structured methods-section draft
Contributing
Issues and PRs welcome. The Cline integration gap (automatic per-turn logging in the VS Code extension) is the most impactful open problem — see the Cline repo if you want to help.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。