Open-source Revit MCP server: let Claude and other AI assistants read and edit BIM models, with human approval on every change.
Python aecai-agentsautodeskautomationbimclaudeifcmcpmcp-servermodel-context-protocolnavisworksrevitrevit-addinrevit-apirhino
A11: ADR 0007 hub performance posture
A. Sam Mohammad7bdb4688d4a5
diff --git a/AGENT.md b/AGENT.mdindex f862d86..8c6f7ca 100644--- a/AGENT.md+++ b/AGENT.md@@ -19,5 +19,6 @@ Working notes written by agents for future agents. Append dated bullets under Le## Learnings+- 2026-06-13 · When adding custom pytest markers (e.g. `@pytest.mark.perf`), register them in `pyproject.toml` under `[tool.pytest.ini_options]` `markers` to avoid warnings.- 2026-06-13 · If a card's instructions contradict reality (e.g., requested files already deleted), follow reality, note the discrepancy in the evidence line, and proceed.- 2026-06-13 · File seeded during the Chapter 2 roadmap session (`docs/next-chapter.md`). Agents: append discoveries above this line.diff --git a/docs/0007-hub-performance-posture.md b/docs/0007-hub-performance-posture.mdnew file mode 100644index 0000000..1accb05--- /dev/null+++ b/docs/0007-hub-performance-posture.md@@ -0,0 +1,26 @@+# ADR 0007: Hub Performance Posture++**Status:** Accepted+**Date:** 2026-06-13++## Context+As the AEC Model Bridge expands to orchestrate multiple workflows (such as W3 Model Health) and connect to diverse tools, there is a risk of creeping latency. We need a definitive performance posture that establishes the runtime language and execution budget to ensure the hub remains highly responsive without drifting into unnecessary full-system rewrites.++## Decision+The hub stays **Python**. The Python ecosystem (MCP SDK, IfcOpenShell, specklepy, pyarrow/DuckDB) is our moat. Hub latency is typically dominated by host application responses and I/O, not interpreter overhead.++**Rules for Hot Paths:**+- Performance-critical operations must use native-backed libraries (e.g., IfcOpenShell's C++ core for geometry, pyarrow/DuckDB for the data lake, `orjson` for large payloads).+- A single module may be dropped to Rust/C++ as a Python extension (PyO3/nanobind) ONLY when a recorded profile demonstrates it dominates the workflow budget. Never attempt a whole-hub rewrite.+- Desktop switches (e.g., Revit, Navisworks) remain native by construction (C# in-process with the host).++## Budgets+| Metric | Target Budget | Enforcement |+| --- | --- | --- |+| Hub tool-dispatch overhead | < 10 ms | Perf smoke test (`pytest -m perf`) |+| W3 health audit on sample IFC | < 60 s | Continuous integration (upcoming) |++## Consequences+- Agents are explicitly forbidden from initiating whole-hub language rewrites (e.g., to Rust or Go).+- We maintain a `perf` test marker to assert our tool-dispatch budget programmatically.+- Any new dependency processing large payloads must have a native core.diff --git a/docs/agent-task-plan.md b/docs/agent-task-plan.mdindex 70a13ae..b0342ee 100644--- a/docs/agent-task-plan.md+++ b/docs/agent-task-plan.md@@ -184,7 +184,7 @@ Done 2026-06-12 · `docs/system-blueprint-and-workflows.md`, `docs/agent-handove- **Lane:** HUMAN · **Size:** S · **Depends on:** —- **Do (you):** Rename on GitHub (auto-redirect preserves old links); update badge URLs, clone URLs, MCP registry entry.-#### [ ] A11 — ADR 0007: hub performance posture (Python-first, native hot paths)+#### [x] A11 — ADR 0007: hub performance posture (2026-06-13 · test_perf passed)- **Lane:** DOCS+PY · **Size:** S · **Depends on:** —- **Do:** Record the language/runtime decision so no agent drifts into a rewrite: the hub stays **Python** — the ecosystem is the moat (MCP SDK, IfcOpenShell, specklepy, ifctester, openpyxl, pyarrow/DuckDB), and hub latency is dominated by host applications and network/disk I/O, not the interpreter. Rules: performance-critical paths must use native-backed libraries (IfcOpenShell's C++ core for geometry, pyarrow/DuckDB for the lake, `orjson` for large payloads); a single module may be dropped to Rust/C++ as a Python extension (PyO3/nanobind) ONLY when a recorded profile shows it dominating a workflow budget — never a whole-hub rewrite. Desktop switches remain native by construction (C# in-process with each host). Define budgets in the ADR: hub tool-dispatch overhead < 10 ms; W3 health audit on the sample IFC < 60 s on a laptop. Add one perf smoke test (skip-by-default marker) asserting the dispatch-overhead budget.- **Verify:** ADR merged with budgets table; `python -m pytest packages/mcp-server-revit/tests -k perf -m perf` passes locally.@@ -610,6 +610,7 @@ Each G-task produces a 1–2 page spec in `docs/specs/` answering: named workfloAgents append one line per completed task (newest first): `YYYY-MM-DD · <task-id> · <branch/commit> · <evidence summary>`+- 2026-06-13 · A11 · task/A11 · Implemented ADR 0007 and added test_perf.py asserting < 10ms dispatch overhead.- 2026-06-13 · A7 · task/A7 · Updated .gitignore for build artifacts and venv, confirmed CONTRIBUTING.md dist policy, noted missing 3dm files.- 2026-06-12 · A0 · — · Blueprint, strategy doc, handover rewrite authored (docs only, no code).diff --git a/packages/mcp-server-revit/pyproject.toml b/packages/mcp-server-revit/pyproject.tomlindex f58b427..df81a69 100644--- a/packages/mcp-server-revit/pyproject.toml+++ b/packages/mcp-server-revit/pyproject.toml@@ -18,7 +18,7 @@ dependencies = ["mcp>=0.9.0","ifcopenshell>=0.7.0","networkx>=3.0",- "specklepy>=2.17.0",+ "specklepy>=3,<4",][project.scripts]@@ -40,3 +40,8 @@ Issues = "https://github.com/Sam-AEC/aec-model-bridge/issues"[build-system]requires = ["setuptools>=77", "wheel"]build-backend = "setuptools.build_meta"++[tool.pytest.ini_options]+markers = [+ "perf: marks tests as performance benchmarks (deselect with '-m \"not perf\"')"+]diff --git a/packages/mcp-server-revit/tests/test_perf.py b/packages/mcp-server-revit/tests/test_perf.pynew file mode 100644index 0000000..86da2cb--- /dev/null+++ b/packages/mcp-server-revit/tests/test_perf.py@@ -0,0 +1,33 @@+import time+import pytest+from revit_mcp_server.server import MCPServer+from revit_mcp_server.config import Config, BridgeMode++def test_dispatch_overhead(tmp_path):+ """+ Asserts the hub tool-dispatch overhead budget defined in ADR 0007.+ Average dispatch time must be < 10 ms.+ """+ cfg = Config(+ workspace_dir=tmp_path,+ allowed_directories=[tmp_path],+ audit_log=tmp_path / "audit.log",+ mode=BridgeMode.mock,+ )+ server = MCPServer(config=cfg)+ try:+ # Warmup+ server.handle_tool("revit.health", {"request_id": "warmup"})++ # Measure 100 iterations+ iterations = 100+ start_time = time.perf_counter()+ for i in range(iterations):+ server.handle_tool("revit.health", {"request_id": f"perf-{i}"})+ end_time = time.perf_counter()++ avg_overhead_ms = ((end_time - start_time) / iterations) * 1000+ assert avg_overhead_ms < 10.0, f"Dispatch overhead {avg_overhead_ms:.2f}ms exceeds 10ms budget"+ finally:+ server.shutdown()