fix: Mock MCP Service
This commit is contained in:
parent
53aaf24162
commit
cd9d24f2ea
2 changed files with 33 additions and 13 deletions
|
|
@ -33,6 +33,12 @@ export interface MCPConnectionInfo {
|
|||
warnings: string[];
|
||||
}
|
||||
|
||||
export const EMPTY_MCP_STATE: MCPServiceState = {
|
||||
mcpService: null,
|
||||
connections: [],
|
||||
toolCount: 0,
|
||||
promptCount: 0,
|
||||
};
|
||||
export class MCPService
|
||||
extends BaseService<MCPServiceState>
|
||||
implements ServiceWithDependencies
|
||||
|
|
@ -46,10 +52,7 @@ export class MCPService
|
|||
}
|
||||
constructor() {
|
||||
super("MCPService", {
|
||||
mcpService: null,
|
||||
connections: [],
|
||||
toolCount: 0,
|
||||
promptCount: 0,
|
||||
...EMPTY_MCP_STATE,
|
||||
});
|
||||
|
||||
// Register shutdown handler
|
||||
|
|
|
|||
|
|
@ -1,21 +1,38 @@
|
|||
import { EMPTY_MCP_STATE, MCPService } from "../../../services/mcp.js";
|
||||
|
||||
// Mock MCP Service
|
||||
export class MockMCPService {
|
||||
connections = [];
|
||||
assistant = {} as any;
|
||||
export class MockMCPService extends MCPService {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
getTools() {
|
||||
return [];
|
||||
}
|
||||
getPrompts() {
|
||||
return [];
|
||||
}
|
||||
async restartAllServers() {}
|
||||
async runTool() {
|
||||
return { result: "Mock result" };
|
||||
return {};
|
||||
}
|
||||
async executeToolCall() {
|
||||
return { result: "Mock result" };
|
||||
getServerInfo() {
|
||||
return {
|
||||
config: {
|
||||
name: "example",
|
||||
},
|
||||
toolNames: [],
|
||||
promptNames: [],
|
||||
warnings: [],
|
||||
status: "connected" as const,
|
||||
};
|
||||
}
|
||||
async close() {}
|
||||
isInitialized() {
|
||||
return true;
|
||||
|
||||
async doInitialize() {
|
||||
return { ...EMPTY_MCP_STATE };
|
||||
}
|
||||
|
||||
async stopServer() {}
|
||||
async restartServer() {}
|
||||
|
||||
async cleanup() {}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue