feat: Let stdio MCP honor per-project cloud routing#590
Conversation
HTTP/SSE transports continue to force local routing since they serve as local API endpoints. Stdio no longer injects BASIC_MEMORY_FORCE_LOCAL or BASIC_MEMORY_EXPLICIT_ROUTING, allowing the natural resolution order (factory > explicit routing > per-project mode > default local) to apply. Externally-set env vars (e.g. BASIC_MEMORY_FORCE_CLOUD) are honored for stdio, preserving escape hatches for cloud deployments. - Conditional env-var logic by transport in mcp.py - Replace 1 test with 4 transport-specific routing tests - Update SPEC-PER-PROJECT-ROUTING.md and README.md - Incidental ruff formatting fixes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: phernandez <paul@basicmachines.co>
|
Claude finished @phernandez's task in 2m 20s —— View job PR Review: feat/hybrid-mcp-routing-stdio
SummaryThis PR makes a targeted, correct change: Code Quality & Standards
# Trigger: MCP server command invocation.
# Why: HTTP/SSE transports serve as local API endpoints and must never
# route through cloud. Stdio is a client-facing protocol that
# should honor per-project routing (local or cloud).
# Outcome: HTTP/SSE get explicit local override; stdio passes through
# whatever env vars are already set (honoring external overrides)
# and defaults to per-project routing resolution.Minor inconsistency: The routing check on line 56 uses Testing & Documentation
Documentation inconsistency in spec: This is now incorrect — stdio resolves based on per-project mode, not always to local. This line should be updated (e.g., "that resolves per project mode"). Fix this → Basic Memory Architecture
The "do nothing for stdio" approach is the right design: not injecting env vars is cleaner than injecting and then removing them. Security & Performance
Compatibility
VerdictThe core change is correct, minimal, and well-tested. Two non-blocking items to address:
Neither blocks merging, but the spec inaccuracy could cause confusion for future contributors. Recommend fixing before merge. |
Summary
bm mcp) no longer forces local routing, allowing per-project cloud routing to work (local projects stay local, cloud projects route to cloud)BASIC_MEMORY_FORCE_CLOUD=true) are honored for stdio, preserving escape hatchesTest plan
tests/cli/test_routing.py,tests/mcp/test_async_client_modes.py)just fast-checkpasses (2171 tests, lint, typecheck)🤖 Generated with Claude Code