[BUG] SDK doesn't read from .mcp.json until the CLI is ran in the current working directory

Status Fixed / completed
Maintainer reply ✓ Yes — ashwin-ant
Activity 7 comments · opened Dec 5, 2025 · closed Dec 16, 2025
💡 Likely answer: A maintainer (ashwin-ant, collaborator) responded on this thread — see the highlighted reply below.

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

I have a .mcp.json file in my current working directory. Upon launching the Claude Agent SDK from that directory, Claude doesn't seem to have access to any of the MCP servers defined in my .mcp.json file.

This can be verified by calling both the mcpServerStatus() callback and examining the mcp_servers field in SDKSystemMessages received while running query. Both will not have any of the servers configured in my .mcp.json file.

Both of the above methods _will_ start to return valid data after I:

  1. Launch claude from the CLI in my current working directory
  2. Restart the SDK

NOTE: This problem does not occur for local or user scoped MCPs. Those work just fine in the Claude Agent SDK. Only project scoped MCPs have this problem.

What Should Happen?

The Claude Agent SDK (just as the CLI) should read from the .mcp.json file in my current working directory upon startup _without_ relying on the CLI starting up in that directory.

Error Messages/Logs

Steps to Reproduce

  1. Create a .mcp.json file in your current working directory.
  2. Run the query() function with an AsyncIterable prompt in the Claude Agent SDK.
  3. Either call the mcpServerStatus() callback, or send a message and examine the mcp_servers field on all messages received of type SDKSystemMessage.
  4. Launch the Claude Code CLI from the current working directory, then run /mcp (you'll see the server(s) defined in your .mcp.json appear here)
  5. Close the existing AsyncIterable, and launch a new query() function using the Claude Agent SDK.
  6. Either call mcpServerStatus() or send a message and examine the mcp_servers field on a message of type SDKSystemMessage. It will be populated correctly now with the value from your .mcp.json file.

Claude Model

None

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.0.54

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Non-interactive/CI environment

Additional Information

_No response_

View original on GitHub ↗

7 Comments

ashwin-ant collaborator · 8 months ago

Are you saying it doesn't load the first time but it loads the second time? It shouldn't load at all unless you've specified project as a settingSources option: https://platform.claude.com/docs/en/agent-sdk/typescript

omidmogasemi · 8 months ago

@ashwin-ant Yes, but it _only_ loads the second time if I launch claude from the CLI and run /mcp (and then restart my SDK process).

And apologies, I forgot to clarify, but we do have project set in settingSources. We are passing in:

const DEFAULT_SETTING_SOURCES: Options["settingSources"] = [
    "user",
    "project",
    "local",
];
frahman5 · 8 months ago

Just wanted to say I really hope this bug gets fixed soon. We use conductor to run claude and its an amazing product. Only issue is that our .mcp.json doesn't get read properly so i have to open claude separately to do any workflows that require mcps.

Solving this issue would be a big game changer for my team's work processes!

benlrichards · 8 months ago

Any updates on this? This is greatly hindering our team's workflow with conductor as well.

brandoncollins7 · 8 months ago

hmmm just hit this too trying out conductor, can't use it like this

ollie-anthropic collaborator · 8 months ago

Hey, this should be fixed in the latest release coming out today - please upgrade and let me know if you continue to have issues

github-actions[bot] · 8 months ago

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.