claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] MCP resources not available for subagents

Open qusma opened this issue 1 year ago • 6 comments

Environment

  • Platform (select one):
    • [x] Anthropic API (Claude Code)
  • Claude CLI version: 1.0.22 (Claude Code)
  • Operating System: Ubuntu 24.04.2 LTS (WSL)
  • Terminal: xterm

Bug Description

Subagents spawned by Claude Code do not have access to the same MCP resources, although MCP tools seem to work fine.

My .claude.json has the following:

  "mcpServers": {
    "tmdb": {
      "command": "/Code/mcp-server-tmdb/dist/index.js",
      "env": {
        "TMDB_API_KEY": "..."
      }
    }
  },

When I ask Claude to spawn a subagent to look up a resource, this happens:

Task(Task: Get Armageddon movie info
  Prompt: I want to get some info on the movie Armageddon. Search TMDB with your tool to find the film id, then
   use the tmdb resource tmdb:///movie/ to get the info.)
 ⎿  tmdb:search_movies (MCP)(query: "Armageddon")
  ⎿  Found 20 movies:
  ⎿  readMcpResource(Read resource "tmdb:///movie/95" from server "tmdb")
  ⎿  Error: Server "tmdb" not found. Available servers:
  ⎿  listMcpResources(List all MCP resources)
  ⎿  ⎿  (No resources found)

But when Claude Code accesses it directly, it works:

readMcpResource(Read resource "tmdb:///movie/95" from server "tmdb")
  ⎿ {
      "contents": [
        {
          "uri": "tmdb:///movie/95",
          "mimeType": "application/json",
          "text": "{\n  \"title\": \"Armageddon\",\n  \"releaseDate\": \"1998-07-01\",\n  \"rating\": 6.838,\n
    \"overview\": [...] }\n  ]\n}"
        }
      ]
    }

Steps to Reproduce

  • Configure MCP server with resources
  • Ask Claude Code to spawn subagent that uses a resource. It will fail.

Expected Behavior

MCP resources should be available to subagents in the same way as they are to the top-level Claude Code.

Actual Behavior

Subagent could not access resources.

qusma avatar Jun 16 '25 19:06 qusma

I just stumbled upon the same problem.

This is preventing me from implementing a main-agent token preserving work-flow.

Explanation: I just pass the issue number to the Task() which then is required to pull the full issue definition itself (can be a bit large) and start working on it, but in a Task() resources are apparently blocked, so it can't continue. Flow stops.

It would be nice if we would have a "subagent_type" which could actually access resources, if you don't want to change the behaviour of the standard agent.

Also I didn't find any rationale why this limitation is in place, as resources are supposed to be concurrently executable and coordination free, I don't see why this should be the case. Could you shed some light on that matter?

ChristophRauch avatar Jul 25 '25 14:07 ChristophRauch

As a workaround I added a _resource_lookup tool, which looks up my own MCP server's resources by exposing it via a tool call. This works, but only for resources of my own making, not from other MCP servers.

ChristophRauch avatar Jul 25 '25 14:07 ChristophRauch

Also encountering this issue

zach-lm avatar Jul 29 '25 01:07 zach-lm

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] avatar Dec 03 '25 10:12 github-actions[bot]

This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.

github-actions[bot] avatar Jan 05 '26 10:01 github-actions[bot]

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

github-actions[bot] avatar Jan 12 '26 14:01 github-actions[bot]