[BUG] SDK doesn't read project level MCPs or Slash Commands for new queries
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 project level MCPs defined in my .mcp.json file and a few slash commands added under my projects .claude/commands directory. Upon launching the Claude Agent SDK from that directory, Claude doesn't seem to have access to either the MCP servers or slash commands defined in these project-level files.
This can be verified by calling the supportedCommands() and mcpServerStatus() callbacks after launching the SDK. They don't return project-level MCPs/commands.
Note: These methods DO however return user-level MCPs and Slash Commands under the same situation.
What Should Happen?
The Claude Agent SDK (just as the CLI) should read from the .mcp.json file and .claude/commands directory in my current working directory upon startup.
Error Messages/Logs
Steps to Reproduce
- Create a .mcp.json file in your current working directory.
- Create a command under
.claude/commandsin your current working directory. - Run the query() function with an AsyncIterable prompt in the Claude Agent SDK.
- Call the
mcpServerStatus()andsupportedCommandscallbacks - Verify that the results do not contain project level MCPs and slash commands
Claude Model
None
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.0.76
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Non-interactive/CI environment
Additional Information
A similar issue was opened earlier this month but the issue does not seem to have been resolved.
Previous Issue: https://github.com/anthropics/claude-code/issues/13107
10 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
👍
I can confirm I have the same issue. Hoping to see a fix soon.
+1
👍
+1
+1
+1
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.
This is a known gap — the Agent SDK doesn't automatically discover project-level configurations the way the CLI does.
Workaround 1 — Pass project-level MCP config explicitly:
When initializing the SDK, you can specify MCP servers directly:
Make sure to set
cwdto your project root. Some SDK versions use this to locate.mcp.jsonand.claude/.Workaround 2 — Copy project configs to user level:
As a temporary measure, you can symlink or merge project-level configs into user-level:
This is a blunt approach — all projects will see these configs. Use with caution if you have multiple projects.
Workaround 3 — Use the CLI in headless mode instead of the SDK:
If the SDK's project discovery is a blocker,
claude -p(headless/pipe mode) respects project-level configs:This gives you programmatic access with full project-level MCP and command support, at the cost of managing stdio instead of using the SDK's API.