Skip to content

feat: Add MCP server support to headless sequant run #161

Closed

Description

@admarble

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:

  1. mcpServers option in the query() call
  2. A .mcp.json file at project root

Currently, run.ts passes neither:

const queryInstance = query({
  prompt,
  options: {
    settingSources: ["project"],
    // No mcpServers configured!
  },
});

Impact:

  • /exec can't use Context7 for library docs in headless mode
  • /fullsolve can't use Sequential Thinking for complex reasoning
  • /test can'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() in system.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 mcpServers to SDK query() call in run.ts
  • Graceful degradation if config doesn't exist or is invalid
  • Add --no-mcp flag to disable MCPs for faster/cheaper runs
  • Add run.mcp setting in settings.json schema (default: true)
  • Update sequant doctor to show MCP availability for headless mode
  • Document MCP support in headless mode

Optional Enhancements

References

Activity

  1. added
    cli
    on Jan 21, 2026
  2. admarble commented on Jan 21, 2026

    @admarble
    ContributorAuthor

    📋 Implementation Plan (Phase 1: Spec)

    Acceptance Criteria Checklist

    AC Description Verification
    AC-1 Read MCP server config from Claude Desktop config path Unit Test
    AC-2 Pass mcpServers to SDK query() call in run.ts Integration Test
    AC-3 Graceful degradation if config doesn't exist or is invalid Unit Test
    AC-4 Add --no-mcp flag to disable MCPs for faster/cheaper runs Integration + Manual
    AC-5 Add run.mcp setting in settings.json schema (default: true) Unit Test
    AC-6 Update sequant doctor to show MCP availability for headless mode Manual Test
    AC-7 Document MCP support in headless mode Manual Review

    Implementation Phases

    Phase 1: Add MCP Config Reader

    • Create getMcpServersConfig() in src/lib/system.ts
    • Returns full mcpServers object (not just names) from Claude Desktop config
    • Graceful error handling → returns undefined on failure

    Phase 2: Update Settings Schema

    • Add mcp: boolean to RunSettings in src/lib/settings.ts
    • Default: true (MCPs enabled)

    Phase 3: Integrate with Run Command

    • Add --no-mcp CLI flag in src/commands/run.ts
    • Priority: CLI flag > settings > default (true)
    • Pass mcpServers to SDK query() when enabled

    Phase 4: Update Doctor Command

    • Add "MCP Servers (headless mode)" check in src/commands/doctor.ts
    • Shows availability status for sequant run

    Phase 5: Documentation

    • Document MCP support in README or dedicated docs file
    • Cover --no-mcp flag and run.mcp setting

    Existing Infrastructure

    • ✅ getClaudeConfigPath() exists in system.ts
    • ✅ getConfiguredMcpServers() returns server names (need full config)
    • ✅ checkOptionalMcpServers() validates configured servers
    • ✅ Doctor already has MCP checks (extend for headless)

    Recommended Workflow

    Phases: exec → qa
    Quality Loop: disabled
    Reasoning: Backend-only CLI feature with clear AC, existing infrastructure


    Generated by /spec - Ready for implementation

  3. added
    planned
    on Jan 21, 2026
  4. added 2 commits that reference this issue on Jan 21, 2026
  5. added a commit that references this issue on Jan 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cliplanned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions