feat(#132): port MCP (Model Context Protocol) infrastructure
Implement MCP Phase 1 infrastructure for agent tool integration with central hub, tool registry, and STDIO transport layers. Components: - McpHubService: Central registry for MCP server lifecycle - StdioTransport: STDIO process communication with JSON-RPC 2.0 - ToolRegistryService: Tool catalog management - McpController: REST API for MCP management Endpoints: - GET/POST /mcp/servers - List/register servers - POST /mcp/servers/:id/start|stop - Lifecycle control - DELETE /mcp/servers/:id - Unregister - GET /mcp/tools - List tools - POST /mcp/tools/:name/invoke - Invoke tool Features: - Full JSON-RPC 2.0 protocol support - Process lifecycle management - Buffered message parsing - Type-safe with no explicit any types - Proper cleanup on shutdown Tests: 85 passing with 90.9% coverage Fixes #132 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
1
apps/api/src/mcp/dto/index.ts
Normal file
1
apps/api/src/mcp/dto/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./register-server.dto";
|
||||
26
apps/api/src/mcp/dto/register-server.dto.ts
Normal file
26
apps/api/src/mcp/dto/register-server.dto.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { IsString, IsOptional, IsObject } from "class-validator";
|
||||
|
||||
/**
|
||||
* DTO for registering a new MCP server
|
||||
*/
|
||||
export class RegisterServerDto {
|
||||
@IsString()
|
||||
id!: string;
|
||||
|
||||
@IsString()
|
||||
name!: string;
|
||||
|
||||
@IsString()
|
||||
description!: string;
|
||||
|
||||
@IsString()
|
||||
command!: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString({ each: true })
|
||||
args?: string[];
|
||||
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
env?: Record<string, string>;
|
||||
}
|
||||
Reference in New Issue
Block a user