MCP tools inaccessible in --agent mode even with explicit --mcp-config flag

Open 💬 3 comments Opened Jun 3, 2026 by BHawleyWall

Environment

  • Claude Code: 2.1.150
  • OS: macOS
  • Model: Opus (default)

Problem

MCP tools from project-scoped .mcp.json files are inaccessible when running Claude Code with the --agent flag, and passing --mcp-config explicitly does NOT resolve the issue.

Reproduction

Setup: Create a test agent and a minimal HTTP MCP server.

# Create agent
mkdir -p ~/.claude/agents
cat > ~/.claude/agents/test-mcp.md <<'AGENT'
---
name: test-mcp
description: Test MCP access
tools: mcp__my-http-mcp__*
---
List all your available tools, including MCP tools. Then describe what you see.
AGENT

# Create test project with .mcp.json
mkdir -p /tmp/mcp-test
cd /tmp/mcp-test
cat > .mcp.json <<'CONFIG'
{
  "mcpServers": {
    "my-http-mcp": {
      "type": "http",
      "url": "https://example.com/mcp"
    }
  }
}
CONFIG

Test 1: Normal session (works)

cd /tmp/mcp-test
claude -p "List all your available tools"

Result: MCP tools are present in the available tools list ✓

Test 2: Agent mode without explicit config (broken)

cd /tmp/mcp-test
claude --agent test-mcp -p "List all your available tools"

Result: MCP tools are NOT listed; error "No such tool available" on any mcp__* call ✗

Test 3: Agent mode with explicit --mcp-config (broken)

cd /tmp/mcp-test
claude --agent test-mcp --mcp-config ./.mcp.json -p "List all your available tools"

Result: MCP tools are still NOT listed; passing the file explicitly does not help ✗

Expected behavior

MCP tools should be available in --agent mode, either:

  1. Automatically from project-scoped .mcp.json, or
  2. When explicitly passed via --mcp-config, or
  3. Both

The /mcp command confirms the server connects session-wide (✓ Connected), but the tools never appear in the agent's tool surface.

Actual behavior

MCP tools are completely unavailable in --agent mode regardless of configuration method. The server connects but tools are not exposed.

Impact

Blocks orchestrator/conductor patterns where:

  • A main agent (launched with --agent) coordinates MCP operations
  • Tools are configured in project-scoped .mcp.json for team sharing
  • The workaround (user-scope ~/.claude.json) prevents team-shared configurations

This is a regression from the documented behavior: Connect Claude Code to tools via MCP and CLI reference do not indicate that --agent mode excludes MCP tools.

Related

  • #31287: "MCP tools completely inaccessible from --agent main thread" (closed as not planned)
  • #13898: Custom subagents cannot access project-scoped MCP servers

Workaround

Temporarily move MCP server configuration to user scope:

claude mcp add --scope user --transport http my-http-mcp https://example.com/mcp

This makes tools available in --agent mode, but prevents team-shared project-scoped configuration via .mcp.json.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗