You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Mark MCP chat posts with a fixed connected-app metadata key #336
post_chat_message posts in a heading chat as the document owner. Nothing in the stored row says a connected app wrote it. Past posts can never be marked, because no record ties a chat row to MCP.
After this change, every MCP chat post stores metadata.via = 'connected_app'. read_chat_thread reads the key back and tags those posts. So a connected app can tell its own posts from the owner's. The visible label in the pad is #344.
Acceptance criteria
A message posted with post_chat_message has metadata equal to {"via":"connected_app"} in public.messages.
The value is one fixed constant, CONNECTED_APP_VIA, in apps/hocuspocus.server/src/modules/mcp/types.ts. No client_id or app name is stored.
read_chat_thread shows via connected app in the head line of such a post.
From metadata, readThread selects only named paths, never the whole object.
Composer messages have no via key. The pad renders an MCP post as before.
After pin, unpin and a reply, metadata.via is still there.
apps/hocuspocus.server/API.md §MCP connector, docs/mcp/reference.md and the MCP entry under ## [Unreleased] in apps/hocuspocus.server/CHANGELOG.md each state the key in one line.
Blocked by
None — can start now.
Agent brief
Type: AFK.
postMessage in apps/hocuspocus.server/src/modules/mcp/infra/chatStore.ts adds metadata: { via: CONNECTED_APP_VIA }. The store owns the constant, so no tool can pass another value.
readThread adds the path via:metadata->>via. ChatMessage gets a viaConnectedApp flag. renderChatMessage adds the tag inside frameChatText.
No migration and no apps/webapp/src/types/supabase.ts change: messages.metadata is an existing jsonb column. No insert trigger rewrites NEW.metadata.
Rules:apps/hocuspocus.server/CLAUDE.md §MCP Connector. AGENTS.md §Test Policy: no new test.
Verify: typecheck, bun test src/modules/mcp, lint and format. On the local stack, post with post_chat_message and check the row in Supabase Studio. Pin, unpin and reply, then call read_chat_thread.
Activity