Skip to content

feat(mcp): bridge memory.* tools through squad_state MCP server (currently unreachable from agents) #1244

Closed

Description

@tamirdresher

Summary

The governed memory tools (memory.classify, memory.write, memory.search, memory.promote, memory.delete, memory.audit) are registered in the SDK ToolRegistry but not exposed by the squad_state MCP server that squad init and squad upgrade install. As a result, agents running in Copilot CLI cannot discover or invoke them.

The whole governed memory subsystem — classification, audit log, forbidden-scan, loadGuidance — is reachable from the CLI (squad memory ...) and from direct SDK consumers, but invisible to autonomous agents during their work.

Evidence

SDK has the tools

packages/squad-sdk/src/tools/index.ts:1189-1194 registers 6 governed memory tools:

this.tools.set('memory.classify', memoryClassify);
this.tools.set('memory.write', memoryWrite);
this.tools.set('memory.search', memorySearch);
this.tools.set('memory.promote', memoryPromote);
this.tools.set('memory.delete', memoryDelete);
this.tools.set('memory.audit', memoryAudit);

MCP server does not advertise them

packages/squad-cli/src/cli/commands/state-mcp.ts:27-35:

const MCP_TOOL_ALIASES: Record<string, string> = {
  squad_decide:        'squad_decide',
  squad_state_read:    'squad_state_read',
  squad_state_write:   'squad_state_write',
  squad_state_append:  'squad_state_append',
  squad_state_delete:  'squad_state_delete',
  squad_state_list:    'squad_state_list',
  squad_state_health:  'squad_state_health',
};

The MCP server's ListTools handler returns only these 7 aliases. The agent's tools: ["*"] allowlist in .github/agents/squad.agent.md enables all of them — but there are no others to enable.

init/upgrade only register one Squad-internal MCP server

packages/squad-sdk/src/config/init.ts:627-637 and packages/squad-cli/src/cli/core/upgrade.ts:32-42 both register exactly one server: squad_state. There is no separate squad_memory MCP server.

Consequence — the gap

A fresh squad init produces an agent that:

  • ✅ can call squad_state_write, squad_decide, etc. (state mutation, decision drop-box)
  • ✅ can call platform tools (view, edit, grep, etc.)
  • ❌ cannot call memory.classify to dry-run a write
  • ❌ cannot call memory.write to persist a governed entry
  • ❌ cannot call memory.search to look up team policies
  • ❌ cannot call memory.audit to inspect the audit trail

Proposed fix

Add 6 entries to MCP_TOOL_ALIASES in state-mcp.ts:

// Governed memory tools — bridge SDK ToolRegistry entries through the MCP server
memory_classify:     'memory.classify',
memory_write:        'memory.write',
memory_search:       'memory.search',
memory_promote:      'memory.promote',
memory_delete:       'memory.delete',
memory_audit:        'memory.audit',

Key naming detail: alias keys use underscores (memory_classify) per MCP cross-client safety; values retain the dotted SDK names so ToolRegistry lookups are unchanged.

What does NOT change

  • No SDK changes — the ToolRegistry already has these tools registered
  • No init/upgrade config changes — the squad_state MCP server registration is unchanged
  • No new MCP server needed
  • No behavior changes for existing flows

Acceptance criteria

  • ListTools returns 13 tools (7 existing + 6 new memory bridges)
  • Calling memory_write via MCP routes correctly to the SDK ToolRegistry
  • No regression in existing squad_state_* or squad_decide tool calls
  • Tests cover the new alias entries
  • Changeset added (patch bump for @bradygaster/squad-cli)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions