Repository navigation
Closed
Description
Summary
sequant run (headless mode via Claude Agent SDK) currently has no access to MCP servers, even when they're configured in Claude Desktop. This means skills that benefit from MCPs (Context7, Sequential Thinking, Chrome DevTools) fall back to non-MCP behavior in automated runs.
Problem
The SDK requires explicit MCP configuration via either:
mcpServersoption in thequery()call- A
.mcp.jsonfile at project root
Currently, run.ts passes neither:
const queryInstance = query({
prompt,
options: {
settingSources: ["project"],
// No mcpServers configured!
},
});Impact:
/execcan't use Context7 for library docs in headless mode/fullsolvecan't use Sequential Thinking for complex reasoning/testcan't use Chrome DevTools for browser automation
Proposed Solution
Read MCP servers from Claude Desktop config at runtime and pass to the SDK.
Rationale:
- Single source of truth - if it works in Claude Code, it works in
sequant run - Zero additional configuration for users
- Infrastructure already exists:
getClaudeConfigPath()insystem.ts
Implementation
// In run.ts or new lib/mcp.ts
function getMcpServersFromConfig(): Record<string, McpServerConfig> | undefined {
const configPath = getClaudeConfigPath();
try {
const config = JSON.parse(fs.readFileSync(configPath, "utf8"));
return config.mcpServers;
} catch {
return undefined; // Graceful degradation
}
}
// In executePhase():
const queryInstance = query({
prompt,
options: {
mcpServers: getMcpServersFromConfig(),
// ... rest of options
},
});Acceptance Criteria
- Read MCP server config from Claude Desktop config path
- Pass
mcpServersto SDKquery()call inrun.ts - Graceful degradation if config doesn't exist or is invalid
- Add
--no-mcpflag to disable MCPs for faster/cheaper runs - Add
run.mcpsetting insettings.jsonschema (default:true) - Update
sequant doctorto show MCP availability for headless mode - Document MCP support in headless mode
Optional Enhancements
- Allow
.mcp.jsonoverride at project level (SDK auto-loads this) - Add
--mcp-profileflag to select subset of MCPs (ties into closed feat: MCP efficiency profiles and token-aware recommendations #72 if ever revisited) - Log which MCPs are active at start of run
References
- SDK MCP docs: https://platform.claude.com/docs/en/agent-sdk/mcp
- Existing MCP detection:
src/lib/system.ts(getClaudeConfigPath,checkOptionalMcpServers) - Related (closed): feat: MCP efficiency profiles and token-aware recommendations #72 (MCP efficiency profiles - closed as won't fix, but
--no-mcpcaptures the "minimal" use case)
Activity
admarble commentedon Jan 21, 2026
📋 Implementation Plan (Phase 1: Spec)
Acceptance Criteria Checklist
mcpServersto SDKquery()call inrun.ts--no-mcpflag to disable MCPs for faster/cheaper runsrun.mcpsetting insettings.jsonschema (default:true)sequant doctorto show MCP availability for headless modeImplementation Phases
Phase 1: Add MCP Config Reader
getMcpServersConfig()insrc/lib/system.tsmcpServersobject (not just names) from Claude Desktop configundefinedon failurePhase 2: Update Settings Schema
mcp: booleantoRunSettingsinsrc/lib/settings.tstrue(MCPs enabled)Phase 3: Integrate with Run Command
--no-mcpCLI flag insrc/commands/run.tsmcpServersto SDKquery()when enabledPhase 4: Update Doctor Command
src/commands/doctor.tssequant runPhase 5: Documentation
--no-mcpflag andrun.mcpsettingExisting Infrastructure
getClaudeConfigPath()exists insystem.tsgetConfiguredMcpServers()returns server names (need full config)checkOptionalMcpServers()validates configured serversRecommended Workflow
Phases: exec → qa
Quality Loop: disabled
Reasoning: Backend-only CLI feature with clear AC, existing infrastructure
Generated by
/spec- Ready for implementationfeat(#161): add MCP server support to headless sequant run
docs: add CHANGELOG entry for #161 MCP server support
fix(#161): register --no-mcp flag in CLI