Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | /**
* MCP Config Types
*
* Shared types for AI client detection and MCP configuration.
*
* @packageDocumentation
*/
/**
* Supported AI client config formats
*/
export type AIClientFormat =
| "claude"
| "cursor"
| "windsurf"
| "continue"
| "vscode"
| "zed"
| "cline"
| "gemini"
| "aider"
| "roo-code"
| "qoder";
/**
* Configuration for a detected AI client
*/
export interface AIClientConfig {
/** Internal identifier */
name: string;
/** Display name for UI */
displayName: string;
/** Path to the config file */
configPath: string;
/** Whether the config file exists */
exists: boolean;
/** Whether SnapBack is already configured */
hasSnapback: boolean;
/** Config format type */
format: AIClientFormat;
}
/**
* Result of AI client detection
*/
export interface DetectionResult {
/** All known clients with their status */
clients: AIClientConfig[];
/** Clients that exist (installed) */
detected: AIClientConfig[];
/** Clients that exist but don't have SnapBack configured */
needsSetup: AIClientConfig[];
}
/**
* MCP server configuration for a single server
*/
export interface MCPServerConfig {
/** Command to run (e.g., "npx", "node") - for stdio transport */
command?: string;
/** Arguments to pass to the command - for stdio transport */
args?: string[];
/** Server URL - for HTTP transport (e.g., "https://snapback-mcp.fly.dev") */
url?: string;
/** Environment variables */
env?: Record<string, string>;
/**
* §10.2: Managed metadata for SnapBack-owned entries
* Only present on entries created/managed by SnapBack CLI
*/
snapbackManaged?: SnapbackManagedMetadata;
}
/**
* §10.2: Metadata for SnapBack-managed MCP config entries
* Used for safe repair operations
*/
export interface SnapbackManagedMetadata {
/** User ID (stable across sessions) */
userId: string;
/** Install ID (per machine install) */
installId: string;
/** Client name (claude|cursor|vscode|qoder|windsurf|other) */
client: AIClientFormat | "other";
/** Workspace ID */
workspaceId?: string;
/** CLI version that created/updated this config */
cliVersion: string;
/** Last update timestamp */
updatedAt: string;
/** Transport type */
transport: "stdio" | "stdio-shim" | "http";
}
/**
* Full MCP config structure (matches Claude/Cursor format)
*/
export interface MCPConfig {
mcpServers: Record<string, MCPServerConfig>;
}
/**
* VS Code MCP config structure (uses "servers" not "mcpServers")
*/
export interface VSCodeMCPConfig {
servers: Record<string, MCPServerConfig & { type: string }>;
}
/**
* Zed MCP config structure (uses "context_servers" not "mcpServers")
*/
export interface ZedMCPConfig {
context_servers: Record<string, MCPServerConfig>;
}
/**
* Windsurf-specific MCP server configuration with auto-approval
*/
export interface WindsurfMCPServerConfig extends MCPServerConfig {
/** Whether this server is disabled */
disabled?: boolean;
/** Array of tool names to always allow without prompting */
alwaysAllow?: string[];
}
/**
* Qoder-specific MCP server configuration with explicit transport type
*/
export interface QoderMCPServerConfig extends MCPServerConfig {
/** Transport type - required for Qoder */
type: "stdio" | "sse" | "streamable-http";
}
/**
* SnapBack-specific MCP configuration
*/
export interface SnapbackMCPConfig extends MCPServerConfig {
/** API key for Pro features */
apiKey?: string;
}
/**
* Options for generating SnapBack MCP config
*/
export interface SnapbackConfigOptions {
/**
* §10.1: Target client for namespaced server key (snapback-<client>)
* Required for proper collision prevention
*/
client?: AIClientFormat;
/** API key for Pro features (legacy - prefer workspaceId) */
apiKey?: string;
/**
* Workspace ID for tier resolution without API key in config
* Format: ws_[32 hex chars] (128 bits entropy)
* Preferred over apiKey for MCP authentication
* @see apps/vscode/mco_auth.md for design details
*/
workspaceId?: string;
/** Server URL for HTTP transport (e.g., "https://snapback-mcp.fly.dev") */
serverUrl?: string;
/**
* Use npx to run the npm-installed CLI (stdio transport)
* This is the recommended mode for users who installed via npm
* Command: npx @snapback/cli mcp --stdio --workspace <path>
*/
useNpx?: boolean;
/** Use installed binary instead of npx (stdio transport) */
useBinary?: boolean;
/** Custom command override (stdio transport) */
customCommand?: string;
/** Additional environment variables */
additionalEnv?: Record<string, string>;
/** Workspace root path (auto-inferred if not provided) */
workspaceRoot?: string;
/** Use local development mode (direct node execution - stdio transport) */
useLocalDev?: boolean;
/** Path to local CLI dist (for development - stdio transport) */
localCliPath?: string;
/**
* Use stdio shim for multi-client coordination (default: true)
* When enabled, routes MCP requests through daemon for multiple AI clients (Claude + Qoder + etc.)
* When disabled, uses direct stdio connection (legacy, not recommended for multi-client setups)
*/
useShim?: boolean;
}
/**
* Result of writing config to a client
*/
export interface WriteResult {
/** Whether the write succeeded */
success: boolean;
/** Error message if failed */
error?: string;
/** Path to backup file if created */
backup?: string;
}
/**
* Result of removing SnapBack config
*/
export interface RemoveResult {
/** Whether the removal succeeded */
success: boolean;
/** Error message if failed */
error?: string;
}
|