feat: implement MCP provider registry and service

- Add provider registry to manage LLM providers (Claude, Codex, Cursor, Gemini).
- Create provider routes for MCP server operations (list, upsert, delete, run).
- Implement MCP service for handling server operations and validations.
- Introduce abstract provider class and MCP provider base for shared functionality.
- Add tests for MCP server operations across different providers and scopes.
- Define shared interfaces and types for MCP functionality.
- Implement utility functions for handling JSON config files and API responses.
This commit is contained in:
Haileyesus
2026-04-15 20:16:26 +03:00
parent 96463df8da
commit 016e8673f2
21 changed files with 1965 additions and 7 deletions

View File

@@ -0,0 +1,40 @@
import type {
LLMProvider,
McpScope,
McpTransport,
ProviderMcpServer,
UpsertProviderMcpServerInput,
} from '@/shared/types.js';
/**
* MCP runtime contract for one provider.
*/
export interface IProviderMcpRuntime {
listServers(options?: { workspacePath?: string }): Promise<Record<McpScope, ProviderMcpServer[]>>;
listServersForScope(scope: McpScope, options?: { workspacePath?: string }): Promise<ProviderMcpServer[]>;
upsertServer(input: UpsertProviderMcpServerInput): Promise<ProviderMcpServer>;
removeServer(
input: { name: string; scope?: McpScope; workspacePath?: string },
): Promise<{ removed: boolean; provider: LLMProvider; name: string; scope: McpScope }>;
runServer(
input: { name: string; scope?: McpScope; workspacePath?: string },
): Promise<{
provider: LLMProvider;
name: string;
scope: McpScope;
transport: McpTransport;
reachable: boolean;
statusCode?: number;
error?: string;
}>;
}
/**
* Provider contract that both SDK and CLI families implement.
*/
export interface IProvider {
readonly id: LLMProvider;
readonly mcp: IProviderMcpRuntime;
}