Skip to content

[Bug]: MCP tools unavailable to agent after context compaction #344

@ramsyman

Description

@ramsyman

Bug description

After context compaction occurs in a long session, MCP tools (configured via
opencode.jsonc) are no longer called by the agent — even though all MCP
servers show as connected (green dot) in the MCP Servers panel.

The agent falls back to bash for operations that should use MCP tools.
If bash is restricted via permissions, it errors with "tool not available".

Steps to reproduce

  1. Start a session with multiple MCP servers configured in opencode.jsonc
  2. Run a long session until context compaction triggers
  3. Ask the agent to use an MCP tool (e.g. git operations via beacon-git)
  4. Agent uses bash instead, or errors

Expected behaviour

Agent continues to call configured MCP tools after compaction.

Actual behaviour

Agent loses MCP tool context after compaction. Only core tools (bash, read,
glob, grep, edit, write, webfetch) remain available.

Workaround

Restart CodeNomad session — tools are available again until next compaction.

Environment

  • CodeNomad version: latest
  • Model: anthropic/claude-sonnet-4-6
  • MCP servers: local node.js servers via mcp-wrapper script
  • OS: macOS (Apple Silicon)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions