aiwg
Version:
Deployment tool and support utility for AI context. Copies agents, skills, commands, rules, and behaviors into the paths each AI platform reads (Claude Code, Codex, Copilot, Cursor, Warp, OpenClaw, and 6 more) so one source of truth works across 10 platfo
92 lines • 3.36 kB
TypeScript
/**
* MCP Server Registry
*
* Single source of truth for MCP server definitions.
* Stores server configs in the user config directory (~/.aiwg/mcp-servers.json)
* and injects them into provider-native config formats.
*
* @implements #554
*/
export type McpServerType = 'stdio' | 'http' | 'sse';
export interface McpServerDefinition {
/** Server name (unique identifier) */
name: string;
/** Server URL (for http/sse types) */
url?: string;
/** Server type */
type: McpServerType;
/** Command to run (for stdio type) */
command?: string;
/** Command arguments (for stdio type) */
args?: string[];
/** Environment variables */
env?: Record<string, string>;
/** Headers (for http/sse types) */
headers?: Record<string, string>;
/** Providers this server has been injected into */
injectedProviders?: string[];
/** Optional description */
description?: string;
/** When this entry was added */
addedAt?: string;
/** When this entry was last updated */
updatedAt?: string;
}
export interface McpRegistryData {
apiVersion: string;
kind: string;
servers: Record<string, McpServerDefinition>;
}
export type InjectProvider = 'claude-code' | 'claude' | 'cursor' | 'factory' | 'codex' | 'openai' | 'opencode' | 'windsurf' | 'warp';
export declare class McpServerRegistry {
private readonly configDir;
private cache;
constructor(configDirOverride?: string);
/** Get the registry file path */
getPath(): string;
/** Load the registry from disk */
load(): Promise<McpRegistryData>;
/** Save the registry to disk */
save(): Promise<void>;
/** Add a new MCP server definition */
add(def: McpServerDefinition): Promise<void>;
/** Remove an MCP server definition */
remove(name: string): Promise<void>;
/** Update an existing MCP server definition */
update(name: string, updates: Partial<Omit<McpServerDefinition, 'name'>>): Promise<void>;
/** Get a specific server definition */
get(name: string): Promise<McpServerDefinition | undefined>;
/** List all server definitions */
list(): Promise<McpServerDefinition[]>;
/** Record that a server was injected into a provider */
recordInjection(name: string, provider: string): Promise<void>;
/** Get all providers that have had servers injected */
getInjectedProviders(): Promise<string[]>;
/** Clear the in-memory cache */
clearCache(): void;
}
export interface InjectResult {
provider: string;
configPath: string;
serversInjected: string[];
alreadyPresent: string[];
error?: string;
}
/**
* Get the config file path for a provider.
*/
export declare function getProviderConfigPath(provider: InjectProvider, projectDir?: string): string;
/**
* Inject MCP servers into a provider's native config format.
*
* Non-destructive: preserves existing provider-specific servers not managed by AIWG.
* Idempotent: updates in place without duplicating.
*/
export declare function injectServers(registry: McpServerRegistry, provider: InjectProvider, options?: {
servers?: string[];
projectDir?: string;
dryRun?: boolean;
}): Promise<InjectResult>;
/** All supported provider names for injection */
export declare const SUPPORTED_PROVIDERS: InjectProvider[];
//# sourceMappingURL=registry.d.ts.map