/** * MCP configuration loader. * * Uses the capability system to load MCP servers from multiple sources. */ import type { SourceMeta } from "../capability/types"; import type { Settings } from "../config/settings"; import type { MCPServerConfig } from "./types"; /** Options for loading MCP configs */ export interface LoadMCPConfigsOptions { /** Owning session settings for capability filtering. */ settings?: Settings; /** Whether to load project-level config (default: true) */ enableProjectConfig?: boolean; /** Whether to filter out Exa MCP servers (default: true) */ filterExa?: boolean; /** Whether to filter out browser MCP servers when builtin browser tool is enabled (default: false) */ filterBrowser?: boolean; /** Only include startup-eligible servers; exact-config sessions always enforce autoload !== false. */ autoloadOnly?: boolean; /** * Restrict discovery to GJC's own native config (`.gjc/` project and * `~/.gjc/agent/` user scopes). Conventional standalone sessions use this * mode: Claude Code/Codex project/global MCP files are explicit import * sources into `.gjc`, not implicit competing runtime authorities. */ nativeOnly?: boolean; /** Load only this explicit MCP config file. */ configPath?: string; /** * Agent directory that holds the user scope (`/mcp.json`). * Default: `getAgentDir()`. Sessions created with their own `agentDir` pass it * so discovery and `gjc mcp add --scope user` read and write the same file. */ agentDir?: string; } /** Result of loading MCP configs */ export interface LoadMCPConfigsResult { /** Loaded server configs */ configs: Record; /** Extracted Exa API keys (if any were filtered) */ exaApiKeys: string[]; /** Source metadata for each server */ sources: Record; /** Whether the explicit configuration was unavailable or contained invalid entries. */ configurationWarning: boolean; /** Provider warnings surfaced during discovery (parse/skip diagnostics). */ warnings: string[]; } /** * Load all MCP server configs from standard locations. * Uses the capability system for multi-source discovery. * * @param cwd Working directory (project root) * @param options Load options */ export declare function loadAllMCPConfigs(cwd: string, options?: LoadMCPConfigsOptions): Promise; /** * Check if a server config is an Exa MCP server. */ export declare function isExaMCPServer(name: string, config: MCPServerConfig): boolean; /** * Extract Exa API key from an MCP server config. */ export declare function extractExaApiKey(config: MCPServerConfig): string | undefined; /** Result of filtering Exa MCP servers */ export interface ExaFilterResult { /** Configs with Exa servers removed */ configs: Record; /** Extracted Exa API keys (if any) */ exaApiKeys: string[]; /** Source metadata for remaining servers */ sources: Record; } /** * Filter out Exa MCP servers and extract their API keys. * Since we have native Exa integration, we don't need the MCP server. */ export declare function filterExaMCPServers(configs: Record, sources: Record): ExaFilterResult; /** * Validate server config has required fields. */ export declare function validateServerConfig(name: string, config: MCPServerConfig): string[]; /** * Check if a server config is a browser automation MCP server. */ export declare function isBrowserMCPServer(name: string, config: MCPServerConfig): boolean; /** Result of filtering browser MCP servers */ export interface BrowserFilterResult { /** Configs with browser servers removed */ configs: Record; /** Source metadata for remaining servers */ sources: Record; } /** * Filter out browser automation MCP servers. * Since we have a native browser tool, we don't need these MCP servers. */ export declare function filterBrowserMCPServers(configs: Record, sources: Record): BrowserFilterResult;