feat(mcp): operator-queue read tools — list + get (#1101)#1102
Merged
Conversation
Add the MCP read surface over the Operator Queue (OPS-001), closing Invariant #13 (MCP = third surface in sync) for the operator-queue feature. Read-only v1 — respond/cancel deferred. Pure TS proxy over the existing REST router; no backend, endpoint, or dependency changes. Tools: list_operator_queue (broad, or scoped via the agent_name filter) and get_operator_queue_item (single item by id), plus a pure, unit-tested filterQueueItemsForAgentScope helper. Access control: the backend resolves an agent-scoped MCP key to its OWNER and filters by the owner's accessible agents — NOT agent_permissions — so agent-to-agent gating lives in the MCP layer. Broad listings post-filter to {self} ∪ permitted; get gates via checkAgentAccess after fetch. Mirrors executions.ts / list_agents (agents.ts). Docs: architecture.md MCP table (+operator_queue.ts and the previously-missing voip.ts row, count 17→20) and the operating-room.md feature flow. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
respond/canceldeferred (the queue is the human-in-the-loop Operating Room; the agent-autonomous-write blast radius was deferred to a follow-up).Tools
list_operator_queueGET /api/operator-queueagent_namefilter. Filters:status,type,priority,since,limit,offset.get_operator_queue_itemGET /api/operator-queue/{id}Access control (the load-bearing part)
The backend resolves an agent-scoped MCP key to its owner and filters by the owner's accessible agents — it does not apply
agent_permissions(architecture §5). So agent-to-agent gating lives in the MCP layer, mirroringexecutions.ts(checkAgentAccess) andagents.ts(list_agentspost-filter):listbroad path → post-filter items to{self} ∪ permittedfor agent-scoped keys;system/userpass through.listscoped path (agent_namegiven) →checkAgentAccessup-front, deny-as-JSON.get→checkAgentAccess(item.agent_name)after fetch, before return.A pure, unit-tested
filterQueueItemsForAgentScopehelper pins the broad-path filter rule.Changes
src/mcp-server/src/tools/operator_queue.ts(new) —createOperatorQueueTools+ the pure helpersrc/mcp-server/src/operator_queue.test.ts(new) — 7node:testcases for the filtersrc/mcp-server/src/client.ts—listOperatorQueue/getOperatorQueueItemsrc/mcp-server/src/types.ts—OperatorQueueItem/OperatorQueueListResponsesrc/mcp-server/src/server.ts,tools/index.ts— registration + barrel export (auto-counted, auto-audited viawithAudit)docs/memory/architecture.md— MCP tools table:+operator_queue.ts,+voip.ts(was missing), count 17→20docs/memory/feature-flows/operating-room.md— MCP read-surface noteTest Plan
docker compose build mcp-server— stricttsccompiles cleannode --test dist/*.test.js— 16/16 pass (7 new + 9 existing)Fixes #1101
🤖 Generated with Claude Code