@@ -35,7 +35,7 @@ import {
3535 type ServerProviderDraft ,
3636} from "@t3tools/provider-core/server/snapshotProbe" ;
3737import { resolveClaudeSdkExecutablePath } from "./Drivers/ClaudeExecutable.ts" ;
38- import { makeClaudeEnvironment } from "./Drivers/ClaudeHome.ts" ;
38+ import { hasClaudeManagedMcpConfig , makeClaudeEnvironment } from "./Drivers/ClaudeHome.ts" ;
3939import { discoverClaudeSkills } from "./Drivers/ClaudeSkills.ts" ;
4040import type { ProviderWorkspaceSnapshot } from "@t3tools/provider-core/server/driver" ;
4141import { makeUnavailableUsageLimits } from "@t3tools/provider-core/server/usageLimits" ;
@@ -223,6 +223,8 @@ export function buildClaudeCapabilitiesProbeQueryOptions(input: {
223223 readonly abortController : AbortController ;
224224 readonly environment : NodeJS . ProcessEnv ;
225225 readonly cwd : string | undefined ;
226+ /** An administrator's `managed-mcp.json` is installed; see `hasClaudeManagedMcpConfig`. */
227+ readonly managedMcpConfig : boolean ;
226228} ) : ClaudeQueryOptions {
227229 return {
228230 persistSession : false ,
@@ -235,9 +237,10 @@ export function buildClaudeCapabilitiesProbeQueryOptions(input: {
235237 settings : { disableAllHooks : true } ,
236238 allowedTools : [ ] ,
237239 // Ignore MCP definitions from every filesystem setting source above. The
238- // SDK combines this empty explicit map with --strict-mcp-config.
240+ // SDK combines this empty explicit map with --strict-mcp-config, which
241+ // Claude refuses next to a managed-mcp.json that already excludes them.
239242 mcpServers : { } ,
240- strictMcpConfig : true ,
243+ ... ( input . managedMcpConfig ? { } : { strictMcpConfig : true } ) ,
241244 env : {
242245 ...input . environment ,
243246 // Connected claude.ai MCP servers are discovered outside filesystem
@@ -384,6 +387,7 @@ const probeClaudeCapabilities = (
384387 claudeSettings . binaryPath ,
385388 claudeEnvironment ,
386389 ) ;
390+ const managedMcpConfig = yield * hasClaudeManagedMcpConfig ( ) ;
387391 return yield * Effect . tryPromise ( async ( ) => {
388392 const q = claudeQuery ( {
389393 // Never yield — we only need initialization data, not a conversation.
@@ -397,6 +401,7 @@ const probeClaudeCapabilities = (
397401 abortController : abort ,
398402 environment : claudeEnvironment ,
399403 cwd,
404+ managedMcpConfig,
400405 } ) ,
401406 } ) ;
402407 const init = await q . initializationResult ( ) ;
0 commit comments