tmh-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@tmh-mcp Analyze the change impact of modifying OrderService"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
TMH
Deterministic Multi-Language Code Graph, Living Knowledge Base, Anti-Hallucination Evidence Engine & Zero-Dependency MCP Server.
TMH is a pure Python standard-library (zero third-party dependencies) engineering harness designed for understanding, evolving, and auditing real-world / legacy codebases—both directly from the CLI and as a built-in stdio MCP server for AI coding agents such as Cursor, Claude Code, and Codex.
Why TMH?
AI coding agents often struggle on large or legacy repositories: they grep blindly, miss cross-file call chains and database side effects, hallucinate file paths/line numbers, and lose team domain rules between sessions.
TMH solves this with four deterministic primitives:
Deterministic Polyglot Code Graph (
.tmh/cache/graph.db)Indexes call chains (
fn -> fn), HTTP routes, database tables / DDL / foreign keys / CRUD edges (fn -> tbl), business domains, business flows, and code-level statecharts in local SQLite.Supports Java, Go, Python, JavaScript/TypeScript (Express, NestJS, Next.js), C#/.NET, PHP/Laravel, Rust, Ruby/Rails, Kotlin, C++, Prisma & SQL.
Living Project Knowledge Base (
.tmh/knowledge/)Bootstraps structured module/domain/flow/entity Markdown pages grounded in source citations.
Automatically tracks code-fingerprint staleness when underlying source files change, and distinguishes
confirmedvs.inferredvs.staleknowledge.Ships with built-in domain KBs (
builtin:crypto-sm.md,builtin:db-dialects.md,builtin:dotnet.md,builtin:frontend.md,builtin:middleware.md,builtin:os-arch.md) for enterprise modernization.
Anti-Hallucination Verification & Tamper-Evident Evidence Chain
verify-evidencevalidatesfile:line[-end]citations against real source files (with automatic secret-file blocking).evidence.pyimplements an append-only SHA-256 hash chain and in-toto Statement v1 export/offline anchor verification.
Zero-Dependency Stdio MCP Server (
tmh-mcp)Plugs straight into Cursor, Claude Code, Codex, or any MCP client over stdio JSON-RPC 2.0 with zero
pipruntime dependencies.
Related MCP server: Faravex
Installation
Requires Python 3.10+ (no third-party packages required).
# Install directly from GitHub
pip install git+https://github.com/auntunt/tmh.git
# Or clone and install in editable mode
git clone https://github.com/auntunt/tmh.git
cd tmh
pip install -e .Verify installation:
tmh --version
tmh-mcp --versionQuickstart (CLI)
# 1. Scan a repository to build .tmh/cache/graph.db and bootstrap living KB pages
tmh --pretty scan --repo /path/to/your-repo
# 2. View architecture overview (domains, flows, tables, CRUD matrix, built-in KBs)
tmh --pretty overview --repo /path/to/your-repo
# 3. Analyze change impact for a file, function, table, or route
tmh --pretty impact --repo /path/to/your-repo --target OrderService
# 4. Trace business flow & verifiable source evidence for a question
tmh --pretty chain --repo /path/to/your-repo --query "order approval workflow"
# 5. Search code graph + living KB + built-in KBs (CN/EN keyword expansion)
tmh --pretty search --repo /path/to/your-repo --query "invoice"
# 6. Verify a source citation against the actual codebase
tmh --pretty verify-evidence --repo /path/to/your-repo --ref src/orders.py:10-25
# 7. Extract code-level statecharts
tmh --pretty statecharts --repo /path/to/your-repo
# 8. Check living KB coverage and staleness
tmh --pretty kb-status --repo /path/to/your-repoTamper-Evident Evidence Chain (in-toto Statement v1)
# Append records to a hash-chained JSONL log
tmh evidence-append --log .tmh/evidence/PR-42.jsonl --kind static_scan --by ci --data '{"issues":0}'
tmh evidence-append --log .tmh/evidence/PR-42.jsonl --kind human_signoff --by reviewer --data '{"approved":true}'
# Export an in-toto Statement v1 package
tmh evidence-export --log .tmh/evidence/PR-42.jsonl --name PR-42 --summary '{"approved":true}' --out PR-42.statement.json
# Offline verification (optionally anchored to a >=32-hex hash saved at sign-off)
tmh --pretty evidence-verify --statement PR-42.statement.json --anchor <hash-from-signoff>MCP Server Integration (Cursor / Claude Code / Codex)
TMH includes a built-in stdio MCP server (tmh-mcp or tmh mcp). Pass --repo (or set TMH_REPO) to bind a default workspace so tools do not need repoPath on every call.
Cursor (.cursor/mcp.json)
{
"mcpServers": {
"tmh": {
"command": "tmh-mcp",
"args": ["--repo", "/absolute/path/to/your-repo"]
}
}
}Claude Code
claude mcp add tmh -- tmh-mcp --repo /absolute/path/to/your-repoCodex (~/.codex/config.toml)
[mcp_servers.tmh]
command = "tmh-mcp"
args = ["--repo", "/absolute/path/to/your-repo"]Exposed MCP Tools
Tool | Purpose |
| Scan/index repository into |
| Architecture summary: domains, flows, DB tables/DDL/FKs, CRUD matrix, built-in KBs |
| Search code graph, |
| Read |
| Verify |
| Change impact analysis across call chains, domains, flows, and DB tables |
| Business-flow Q&A returning grounded flows and verifiable source citations |
| Extract deterministic code-level state machines |
| Living KB coverage, confirmation state, staleness, and open questions |
| Claim next unwritten or stale knowledge pages with grounded graph facts |
| Write/update a living knowledge page with citation & fingerprint anchoring |
| Mark a living knowledge page as human-confirmed |
Architecture
src/tmh/
├── cli.py # Unified `tmh` CLI
├── mcp_server.py # Zero-dependency stdio MCP JSON-RPC 2.0 server (`tmh-mcp`)
├── bridge.py # High-level JSON query/workflow engine
├── graph.py # SQLite deterministic code graph (.tmh/cache/graph.db)
├── polyglot_structure.py # Universal polyglot route/table/flow extractor
├── flow.py # Call chain & business flow tracer
├── golang.py / python_index.py / codeindex.py / mapper.py / scanner.py
├── kb.py / kbqa.py / project_knowledge.py / domains.py / context.py / query.py
├── evidence.py # Append-only SHA-256 hash chain & in-toto Statement v1
└── kb/ # Bundled built-in domain KBs (*.md)Development & Testing
PYTHONPATH=src python3 -m unittest discover -s tests -p "test_*.py" -vLicense
MIT © 2026 auntunt
Available Tools
12 toolstmh_chainA
Business-flow evidence Q&A: trace a business question or requirement to related domains, flows, data tables, and verifiable source citations.
Inputs: query (required), flows, repoPath.
tmh_impactB
Deterministic change impact analysis: given a file path, symbol, table, or HTTP route, return affected call chains, business domains, flows, and tables.
Inputs: target (required), depth, repoPath.
tmh_kb_commitB
Write or update a living knowledge page (.tmh/knowledge/) with automatic source-citation validation and code-fingerprint anchoring.
Inputs: title (required), pageId (required), content (required), summary (required), +2 more.
tmh_kb_confirmA
Mark a living knowledge page as human/reviewer confirmed so downstream agents know its business rules have been verified.
Inputs: pageId (required), by, repoPath.
tmh_kb_nextA
Fetch the next batch of unwritten or stale living knowledge pages with grounded code-graph facts so an agent can author or refresh them.
Inputs: who, limit, query, repoPath.
tmh_kb_statusA
Inspect living knowledge base status: page coverage, confirmed vs. inferred pages, code-fingerprint staleness, and open questions.
Inputs: repoPath.
tmh_overviewB
Get architecture overview of the code graph: business domains, flows, database tables/DDL/FK relations, CRUD matrix, and built-in domain KBs.
Inputs: repoPath.
tmh_readA
Read a built-in domain KB (e.g. builtin:crypto-sm.md), a living knowledge page (.tmh/knowledge/...), or a repository source file by line range (secret files are automatically blocked).
Inputs: path (required), end, start, repoPath.
tmh_scanB
Scan and index a repository into TMH's deterministic SQLite code graph (.tmh/cache/graph.db) and bootstrap living knowledge pages (multi-language call chains, HTTP routes, DB tables/DDL, domains, flows, and statecharts).
Inputs: repoPath.
tmh_searchA
Search across the code graph (domains, flows, tables, symbols), living project knowledge pages (.tmh/knowledge/), and built-in domain KBs (supports bilingual Chinese-English keyword expansion).
Inputs: query (required), limit, repoPath.
tmh_statechartsC
Extract code-level state machines and state transitions detected in the repository.
Inputs: repoPath.
tmh_verify_evidenceB
Anti-hallucination source citation verifier: check a file:line or file:start-end reference against the repository and return exact lines.
Inputs: ref (required), repoPath.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 12 tools
Most tools target clearly distinct operations (scan, overview, search, read, verify, statecharts, and a four-step KB workflow). The main overlap is between tmh_impact (deterministic change impact for a file/symbol/table/route) and tmh_chain (business-question tracing), since both return affected domains, flows, and citations, and between tmh_search and tmh_read where one finds and the other retrieves. Descriptions do enough to steer selection, but an agent could occasionally pick the wrong one of the pair.
All names share a consistent tmh_ prefix and snake_case convention, with the KB tools forming a clean tmh_kb_* subgroup. Within the prefix, styles shift between verbs (scan, search, read, verify_evidence, commit, confirm) and noun-like labels (overview, impact, chain, statecharts, status, next). Still highly predictable and readable, just not a single uniform verb_noun pattern.
Twelve tools sit comfortably in the well-scoped 3-15 range and each maps to a real stage of the workflow: indexing, exploration, evidence verification, impact analysis, and the KB authoring lifecycle. No obviously redundant or filler tools are present.
The surface covers the full path from scan to knowledge maintenance (status, next, commit, confirm) plus verification and impact tracing, so agents have no major dead ends. Minor gaps remain, such as no explicit delete/retire or invalidate operation for knowledge pages and no raw graph/dependency query separate from impact analysis. These are workaroundable rather than blocking.
Maintenance
Related MCP Connectors
Codebase intelligence for AI coding agents: graph, git history, docs, decisions, code health.
Code intelligence platform for AI agents. 20 tools for architecture, security & impact analysis.
Deterministic context layer for your codebase: change impact, blast radius, answers with receipts.
Codebase intelligence for AI agents — dead code, blast radius, ownership.
Related MCP Servers
- FlicenseNot gradedqualityBmaintenanceEnables AI coding agents to interrogate a local repository deterministically for symbols, dependencies, call paths, routes, tests, and Git impact, returning verified structured evidence with exact line citations instead of requiring the whole codebase to be read.45 PyPI5-
- AlicenseNot gradedqualityCmaintenanceEnables AI coding agents and developers to search code by meaning and exact text, map symbols, dependencies, blast radius and context, inspect git-change impacts, and trace live Python or JavaScript execution from a local air-gapped SQLite index.Apache 2.0
- AlicenseNot gradedqualityBmaintenanceEnables AI coding agents to query a local code graph over stdio, so they can see what a Git change may affect, find related tests, routes and nodes, and cite evidence paths — read-only and fully on-machine.MIT
- AlicenseNot gradedqualityBmaintenanceEnables coding agents to store and recall durable, confidence-graded project facts, trace a file's blast radius across the code graph before editing, pack a token-budgeted context brief, and run a verification gate that can only record passes it actually observed. Runs locally over stdio with no model calls or network access.2MIT