builder.io 1.12.5 → 1.12.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/index.cjs +689 -683
- package/cli/index.cjs.map +4 -4
- package/core/index.cjs +1 -1
- package/core/index.mjs +1 -1
- package/node/index.cjs +1 -1
- package/node/index.mjs +1 -1
- package/package.json +1 -1
- package/server/index.cjs +259 -256
- package/server/index.mjs +259 -256
- package/types/cli/code-tools.d.ts +2 -0
- package/types/cli/mcp-local.d.ts +71 -0
- package/types/tsconfig.tsbuildinfo +1 -1
|
@@ -3,6 +3,7 @@ import type { DevToolsSys } from "../core";
|
|
|
3
3
|
import { type DevServerOrchestrator } from "./launch/dev-server-orchestrator";
|
|
4
4
|
import type { CodeGenEventEmitter } from "./codegen";
|
|
5
5
|
import type { Credentials } from "./credentials";
|
|
6
|
+
import type { LocalMCPClientManager } from "./mcp-local";
|
|
6
7
|
export interface LLMToolCalls {
|
|
7
8
|
name: CodeGenTools;
|
|
8
9
|
input: Record<string, any>;
|
|
@@ -32,6 +33,7 @@ export interface ToolContext extends Partial<FusionContext> {
|
|
|
32
33
|
signal: AbortSignal;
|
|
33
34
|
workingDirectory: string;
|
|
34
35
|
allowedCommands: RegExp[];
|
|
36
|
+
localMCPManager: LocalMCPClientManager | undefined;
|
|
35
37
|
getAllFiles: (options: {
|
|
36
38
|
getDotFiles?: boolean;
|
|
37
39
|
pattern?: string;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local MCP (Model Context Protocol) Client Manager for stdio transport
|
|
3
|
+
*
|
|
4
|
+
* This module manages local MCP servers that run as child processes using stdio transport.
|
|
5
|
+
* Local MCP servers are defined in mcp.json configuration file in the working directory.
|
|
6
|
+
*
|
|
7
|
+
* Tool naming follows the same convention as remote MCPs:
|
|
8
|
+
* - Tools are prefixed with server name: `mcp__servername__toolname`
|
|
9
|
+
* - This prevents conflicts with built-in tools and other MCP tools
|
|
10
|
+
*/
|
|
11
|
+
import type { MCPClientStatus } from "$/ai-utils";
|
|
12
|
+
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
13
|
+
import type { DevToolsSys } from "../core";
|
|
14
|
+
import { type ChildProcess } from "child_process";
|
|
15
|
+
export interface MCPServerStdioDefinition {
|
|
16
|
+
name: string;
|
|
17
|
+
command: string;
|
|
18
|
+
args?: string[];
|
|
19
|
+
env?: Record<string, string>;
|
|
20
|
+
}
|
|
21
|
+
export interface MCPConfig {
|
|
22
|
+
mcpServers: Record<string, Omit<MCPServerStdioDefinition, "name">>;
|
|
23
|
+
}
|
|
24
|
+
export interface LocalMCPClient {
|
|
25
|
+
client: Client | undefined;
|
|
26
|
+
process: ChildProcess | undefined;
|
|
27
|
+
status: MCPClientStatus;
|
|
28
|
+
serverName: string;
|
|
29
|
+
command: string;
|
|
30
|
+
resources?: {
|
|
31
|
+
uri: string;
|
|
32
|
+
name?: string;
|
|
33
|
+
description?: string;
|
|
34
|
+
mimeType?: string;
|
|
35
|
+
}[];
|
|
36
|
+
}
|
|
37
|
+
export interface LocalMCPClientManager {
|
|
38
|
+
clients: LocalMCPClient[];
|
|
39
|
+
listTools: () => {
|
|
40
|
+
name: string;
|
|
41
|
+
description?: string;
|
|
42
|
+
inputSchema?: any;
|
|
43
|
+
serverName: string;
|
|
44
|
+
}[];
|
|
45
|
+
callTool: (name: string, args?: any, signal?: AbortSignal) => Promise<{
|
|
46
|
+
content: Array<{
|
|
47
|
+
type: string;
|
|
48
|
+
text?: string;
|
|
49
|
+
data?: any;
|
|
50
|
+
}>;
|
|
51
|
+
isError?: boolean;
|
|
52
|
+
}>;
|
|
53
|
+
getResources: (serverName?: string) => Array<{
|
|
54
|
+
uri: string;
|
|
55
|
+
name?: string;
|
|
56
|
+
description?: string;
|
|
57
|
+
mimeType?: string;
|
|
58
|
+
serverName: string;
|
|
59
|
+
text?: string;
|
|
60
|
+
}>;
|
|
61
|
+
getStatus: () => Record<string, MCPClientStatus>;
|
|
62
|
+
cleanup: () => Promise<void>;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Create a local MCP client manager from server definitions
|
|
66
|
+
*/
|
|
67
|
+
export declare function createLocalMCPClientManager(servers: MCPServerStdioDefinition[], sys: DevToolsSys, workingDirectory: string, signal?: AbortSignal): Promise<LocalMCPClientManager>;
|
|
68
|
+
/**
|
|
69
|
+
* Discover and load MCP configuration from working directory
|
|
70
|
+
*/
|
|
71
|
+
export declare function loadMCPConfig(sys: DevToolsSys, workingDirectory: string): Promise<MCPServerStdioDefinition[]>;
|