Repository navigation
feat(mcp): adopt FastMCP 4 beta and validate hosted MCP Apps #1181
Description
Activity
Claude finished @phernandez's task in 1m 14s —— View job
Triage complete
- Read issue and gather context
- Classify type/priority/component/complexity
- Check for duplicate issues
- Apply labels
- Post triage summary
Classification
- Type: Feature / enhancement — a phased dependency upgrade (FastMCP 3 → 4 beta) plus a hosted MCP Apps callback-contract fix. Not a bug report against current shipped behavior.
- Component: MCP server core (
src/basic_memory/mcp/) and, for Phase 2, the Cloud hosted-app callback wiring (out of this repo's direct scope, tracked via basic-memory-cloud#1493). - Complexity: Complex. The issue itself proposes a 3-phase breakdown (compatibility port → hosted Apps acceptance → independent feature adoption) specifically to keep regressions isolated — that structure is sound and I'd keep it as the basis for any implementation PRs.
- Priority: Medium. This is a proactive dependency/protocol upgrade with a clear plan rather than an active production outage in this repo. The related live-degradation report (#1175, ChatGPT connector reliability) is a separate, already-filed issue — not a duplicate of this one, but worth linking since Phase 2 here (stable app-only tool names vs. internal hashed addressing) may bear on that failure mode.
Duplicate check: No existing open or closed issue in this repo covers a FastMCP 4 port or the MCP Apps callback-visibility problem. Prior FastMCP-version issues (#468, #463, #164, #944) were all about older breaking changes/pins on FastMCP 2.x/3.x and are resolved/closed — none overlap with this FastMCP 4 beta adoption ask.
Labels applied:
enhancement,cloud(repo's actual label set doesn't includemcp-tool/priority/complexity labels, so those aspects are called out in this comment instead).Note on scope: Per triage instructions, no code changes, branch, or tests were performed — this is analysis and labeling only. The issue's own "Proposed delivery" section is a solid starting point for a follow-up implementation PR whenever the team is ready to scope Phase 1.
- addedcloudBasic Memory CloudBasic Memory CloudenhancementNew feature or requestNew feature or request
on Aug 3, 2026 Closing as complete: Phase 1 (core FastMCP 4 compatibility port) merged in #1198 — core pins
fastmcp==4.0.0b1; Phase 2 (hosted MCP Apps acceptance) is done on the cloud side per Paul. Phase 3 (interactive input, session-backed context, background tasks, client response caching) was explicitly parked as independent follow-ons and not required to close this issue — file separately if/when wanted.
Summary
Port Basic Memory Core to the current FastMCP 4 beta, validate the modern MCP protocol behavior, and use the port to fix the hosted MCP App callback contract exercised by basic-memory-cloud#1493.
Status
The first implementation should be a narrow compatibility upgrade. Interactive input, session-backed working context, background tasks, and client response caching are valuable follow-ons, but combining them with the dependency port would make regressions hard to isolate.
Why now
FastMCP 4 moves identity into modern request metadata, makes session state explicitly request/session scoped, adds interactive input and task-backed work, and supports client-side response caching for catalog methods.
At the same time, the hosted MCP App currently runs into host-side blocks when the Vue UI calls back to a private search tool. Inspection of the Cloud app and its tenant ASGI gateway indicates the routing shim is not the failing boundary: a strict MCP Apps host can reject the callback name before FastMCP dispatches it.
Related operational evidence: #1175.
Findings
Core compatibility surface
A local FastMCP 4 beta probe found these concrete port requirements:
mcp.server.fastmcp.exceptions.ToolErrorimport path with the FastMCP runtime class fromfastmcp.exceptions.clientInfo; support modern request metadata while preserving the legacy compatibility path during the port.Contextstate persists across independent tool calls. A probe returned1, 1under the modern lifecycle where the legacy assumption returned1, 2.FastMCPfrom the legacy MCP server module.search/fetchidentity behavior covered explicitly.With a temporary exception shim, all 21 Core tools registered. A focused beta run produced 14 passes and 10 failures: nine around ChatGPT search/fetch identity and one around the client-info shape. This supports a small compatibility PR before adopting new runtime features.
Hosted Cloud path
The current Cloud data path is:
The factory preserves the verified access token and workspace, and the gateway re-applies tenant, user, workspace, entitlement, and project context before dispatch. Nothing in that path explains a host refusing the search callback.
The likely blocker is the callback address:
fastmcp.server.providers.addressing.hashed_backend_name.tools/list; the existing Cloud test currently asserts that those callback tools are absent._meta.ui.visibility = ["app"]. The host hides them from the model but retains them as valid UI-callable tools.For the custom Vue app, use stable explicit callback tool names registered with app-only visibility and call those exact advertised names. Do not build the UI contract on FastMCP's private addressing helper. Prefab/function-reference apps may still use the framework's supported address wiring.
Cloud also has direct
on_initialize/message.params.clientInfoassumptions in trial and product telemetry middleware; those need a modern-protocol audit when Cloud consumes the upgraded Core SHA.Proposed delivery
Phase 1: Core compatibility port — complete in #1198
uv.lock.Contextstate assumptions.just fast-check,just test-smoke, and the appropriate SQLite/Postgres gates.Phase 2: hosted MCP Apps acceptance (Cloud follow-up) — pending
app.callServerTooluse those exact advertised names.Phase 3: adopt new features independently
Contextstate as cross-call storage.Acceptance criteria
search/fetch.Contextstate surviving an independent request.tools/listwith_meta.ui.visibility = ["app"]while remaining hidden from model-visible tools at the host boundary.Non-goals for the first Core PR
References