mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-02 20:43:36 +00:00
feat: add MCP server support for AI agents
Add Model Context Protocol (MCP) server integration to extend AI agent capabilities with external tools. This allows users to configure MCP servers (stdio, SSE, HTTP) in global settings and have agents use them. Note: MCP servers are currently configured globally. Per-project MCP server configuration is planned for a future update. Features: - New MCP Servers settings section with full CRUD operations - Import/Export JSON configs (Claude Code format compatible) - Configurable permission settings: - Auto-approve MCP tools (bypass permission prompts) - Unrestricted tools (allow all tools when MCP enabled) - Refresh button to reload from settings file Implementation: - Added MCPServerConfig and MCPToolInfo types - Added store actions for MCP server management - Updated claude-provider to use configurable MCP permissions - Updated sdk-options factory functions for MCP support - Added settings helpers for loading MCP configs
This commit is contained in:
@@ -13,6 +13,10 @@ export type {
|
||||
InstallationStatus,
|
||||
ValidationResult,
|
||||
ModelDefinition,
|
||||
McpServerConfig,
|
||||
McpStdioServerConfig,
|
||||
McpSSEServerConfig,
|
||||
McpHttpServerConfig,
|
||||
} from './provider.js';
|
||||
|
||||
// Feature types
|
||||
@@ -54,6 +58,8 @@ export type {
|
||||
ModelProvider,
|
||||
KeyboardShortcuts,
|
||||
AIProfile,
|
||||
MCPToolInfo,
|
||||
MCPServerConfig,
|
||||
ProjectRef,
|
||||
TrashedProjectRef,
|
||||
ChatSessionRef,
|
||||
|
||||
@@ -28,6 +28,38 @@ export interface SystemPromptPreset {
|
||||
append?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* MCP server configuration types for SDK options
|
||||
* Matches the Claude Agent SDK's McpServerConfig types
|
||||
*/
|
||||
export type McpServerConfig = McpStdioServerConfig | McpSSEServerConfig | McpHttpServerConfig;
|
||||
|
||||
/**
|
||||
* Stdio-based MCP server (subprocess)
|
||||
* Note: `type` is optional and defaults to 'stdio' to match SDK behavior
|
||||
* and allow simpler configs like { command: "node", args: ["server.js"] }
|
||||
*/
|
||||
export interface McpStdioServerConfig {
|
||||
type?: 'stdio';
|
||||
command: string;
|
||||
args?: string[];
|
||||
env?: Record<string, string>;
|
||||
}
|
||||
|
||||
/** SSE-based MCP server */
|
||||
export interface McpSSEServerConfig {
|
||||
type: 'sse';
|
||||
url: string;
|
||||
headers?: Record<string, string>;
|
||||
}
|
||||
|
||||
/** HTTP-based MCP server */
|
||||
export interface McpHttpServerConfig {
|
||||
type: 'http';
|
||||
url: string;
|
||||
headers?: Record<string, string>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options for executing a query via a provider
|
||||
*/
|
||||
@@ -38,7 +70,9 @@ export interface ExecuteOptions {
|
||||
systemPrompt?: string | SystemPromptPreset;
|
||||
maxTurns?: number;
|
||||
allowedTools?: string[];
|
||||
mcpServers?: Record<string, unknown>;
|
||||
mcpServers?: Record<string, McpServerConfig>;
|
||||
mcpAutoApproveTools?: boolean; // Auto-approve MCP tool calls without permission prompts
|
||||
mcpUnrestrictedTools?: boolean; // Allow unrestricted tools when MCP servers are enabled
|
||||
abortController?: AbortController;
|
||||
conversationHistory?: ConversationMessage[]; // Previous messages for context
|
||||
sdkSessionId?: string; // Claude SDK session ID for resuming conversations
|
||||
|
||||
@@ -163,6 +163,53 @@ export interface AIProfile {
|
||||
icon?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* MCPToolInfo - Information about a tool provided by an MCP server
|
||||
*
|
||||
* Contains the tool's name, description, and whether it's enabled for use.
|
||||
*/
|
||||
export interface MCPToolInfo {
|
||||
/** Tool name as exposed by the MCP server */
|
||||
name: string;
|
||||
/** Description of what the tool does */
|
||||
description?: string;
|
||||
/** Whether this tool is enabled for use (defaults to true) */
|
||||
enabled: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* MCPServerConfig - Configuration for an MCP (Model Context Protocol) server
|
||||
*
|
||||
* MCP servers provide additional tools and capabilities to AI agents.
|
||||
* Supports stdio (subprocess), SSE, and HTTP transport types.
|
||||
*/
|
||||
export interface MCPServerConfig {
|
||||
/** Unique identifier for the server config */
|
||||
id: string;
|
||||
/** Display name for the server */
|
||||
name: string;
|
||||
/** User-friendly description of what this server provides */
|
||||
description?: string;
|
||||
/** Transport type: stdio (default), sse, or http */
|
||||
type?: 'stdio' | 'sse' | 'http';
|
||||
/** For stdio: command to execute (e.g., 'node', 'python', 'npx') */
|
||||
command?: string;
|
||||
/** For stdio: arguments to pass to the command */
|
||||
args?: string[];
|
||||
/** For stdio: environment variables to set */
|
||||
env?: Record<string, string>;
|
||||
/** For sse/http: URL endpoint */
|
||||
url?: string;
|
||||
/** For sse/http: headers to include in requests */
|
||||
headers?: Record<string, string>;
|
||||
/** Whether this server is enabled */
|
||||
enabled?: boolean;
|
||||
/** Tools discovered from this server with their enabled states */
|
||||
tools?: MCPToolInfo[];
|
||||
/** Timestamp when tools were last fetched */
|
||||
toolsLastFetched?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* ProjectRef - Minimal reference to a project stored in global settings
|
||||
*
|
||||
@@ -303,6 +350,14 @@ export interface GlobalSettings {
|
||||
autoLoadClaudeMd?: boolean;
|
||||
/** Enable sandbox mode for bash commands (default: true, disable if issues occur) */
|
||||
enableSandboxMode?: boolean;
|
||||
|
||||
// MCP Server Configuration
|
||||
/** List of configured MCP servers for agent use */
|
||||
mcpServers: MCPServerConfig[];
|
||||
/** Auto-approve MCP tool calls without permission prompts (uses bypassPermissions mode) */
|
||||
mcpAutoApproveTools?: boolean;
|
||||
/** Allow unrestricted tools when MCP servers are enabled (don't filter allowedTools) */
|
||||
mcpUnrestrictedTools?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -462,6 +517,9 @@ export const DEFAULT_GLOBAL_SETTINGS: GlobalSettings = {
|
||||
lastSelectedSessionByProject: {},
|
||||
autoLoadClaudeMd: false,
|
||||
enableSandboxMode: true,
|
||||
mcpServers: [],
|
||||
mcpAutoApproveTools: true,
|
||||
mcpUnrestrictedTools: true,
|
||||
};
|
||||
|
||||
/** Default credentials (empty strings - user must provide API keys) */
|
||||
|
||||
Reference in New Issue
Block a user