anthropics / anthropics/claude-agent-sdk-typescript
No way to disable cloud MCP server auto-discovery from claude.ai account
- Lenguaje dominante
- Shell
- Estrellas
- 1.8k
- Forks
- 226
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
## Bug Description
The SDK automatically discovers and connects MCP servers from the user's Anthropic cloud account (Figma, Canva, Bright Data, etc.) via OAuth. There is no SDK option or environment variable to disable this behavior.
When using the SDK programmatically (e.g. headless agent pipelines), these cloud servers are unwanted — they waste connection time, produce noisy errors in logs, and are not part of the application's configured server set.
## Observed Behavior
Every SDK session connects to cloud MCP servers that were never configured:
```
[MCP] Server connection status:
❌ claude.ai Figma: failed
❌ claude.ai Canva: needs-auth
✅ claude.ai Bright Data: connected
✅ claude.ai Image MCP: connected
✅ claude.ai Amazon Product Research and Real Review Image: connected
... (our configured servers)
```
The Figma and Canva servers fail/need-auth every single session. We only want the servers we explicitly configure via `mcpServers` in the SDK options.
## Root Cause
The cloud MCP eligibility check in `cli.js` has a dead env var guard:
```javascript
if (rY(void 0)) return S("[claudeai-mcp] Disabled via env var"), ..., {};
```
`rY(void 0)` always returns `false` because the env var name is compiled as `undefined` in the minified bundle. The guard never fires.
## Current Workaround
We patch the minified SDK in a `postinstall` script to force the guard to always fire:
```javascript
// Change: if(rY(void 0)) → if(!0/*noop*/)
code = code.replace(
'if(rY(void 0))return S("[claudeai-mcp]',
'if(!0/*noop*/)return S("[claudeai-mcp]'
);
```
This is fragile and breaks on SDK updates.
## Suggested Fix
Either:
1. **Expose an SDK option:** `disableCloudMcpDiscovery: true` in `Options`
2. **Expose a working env var:** e.g. `CLAUDE_DISABLE_CLOUD_MCP=1`
3. **Don't auto-discover cloud servers when `mcpServers` is explicitly provided** — if the user configured their own servers, respect that as the complete set
Option 3 would be the best default behavior for programmatic SDK usage.
## Environment
- SDK version: `@anthropic-ai/claude-agent-sdk` (latest)
- Runtime: Bun
- OS: macOS
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.