builder.io 1.12.4 → 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.
@@ -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;
@@ -1,6 +1,6 @@
1
1
  import { type FusionConfig } from "$/ai-utils";
2
2
  import type { LaunchArgs } from "../launch";
3
- import type { DevToolsSys } from "types";
3
+ import type { DevToolsSys } from "../../types";
4
4
  export declare function getFusionConfig(sys: DevToolsSys, args: LaunchArgs): Promise<FusionConfig>;
5
5
  export declare function saveFusionConfig(sys: DevToolsSys, fusionConfig: FusionConfig): Promise<void>;
6
6
  export declare function trackConfigData(sys: DevToolsSys, fusionConfig: FusionConfig): void;
@@ -42,7 +42,9 @@ export interface DevServerOrchestrator {
42
42
  envVars: Record<string, string>;
43
43
  proxyMiddleware: ProxyMiddleware | undefined;
44
44
  pid: number | undefined;
45
- autoDetectedUrl: string | undefined;
45
+ autoDetectedUrl: boolean;
46
+ autoDetectDevServer: boolean;
47
+ autoDetectDevServerPatterns: string[] | undefined;
46
48
  abortSetupCommand: () => void;
47
49
  clearEnvVariables: () => void;
48
50
  setEnvVariable: (key: string, value: string | undefined) => boolean;
@@ -54,6 +56,7 @@ export interface DevServerOrchestrator {
54
56
  setDevCommand: (newCommand: string | undefined, forceRestart?: boolean, signal?: AbortSignal) => Promise<boolean>;
55
57
  setProxyServer: (newProxyServer: string) => Promise<boolean>;
56
58
  setPort: (newPort: number) => Promise<boolean>;
59
+ setAutoDetectSettings: (enabled: boolean, patterns?: string[]) => Promise<boolean>;
57
60
  addCheckpoint: () => void;
58
61
  getOpenPorts: () => Promise<number[]>;
59
62
  getCheckpoints: (n: number, mode: "all" | "out" | "err") => string;
@@ -80,6 +83,6 @@ export interface DevServerOrchestrator {
80
83
  close: () => Promise<void>;
81
84
  }
82
85
  export declare const importPty: (sys: DevToolsSys) => typeof import("@lydell/node-pty") | undefined;
83
- export declare function devServerOrchestrator(sys: DevToolsSys, fusionConfig: FusionConfig, initialSetupState: "installed" | "not-installed" | "install-failed" | "unset"): Promise<DevServerOrchestrator>;
86
+ export declare function devServerOrchestrator(sys: DevToolsSys, fusionConfig: FusionConfig, initialSetupState: "installed" | "not-installed" | "install-failed"): Promise<DevServerOrchestrator>;
84
87
  export declare const checkPortsListenedByPid: (pid: number) => number[];
85
88
  export declare function killProcess(sys: DevToolsSys, proc: ChildProcess | DevCommandProcess | undefined, abortSignal?: AbortSignal, timeout?: number): Promise<boolean>;
@@ -1,4 +1,4 @@
1
1
  import type { FusionMetrics } from "$/ai-utils";
2
- import type { Credentials } from "cli/credentials";
3
- import type { DevToolsSys } from "types";
2
+ import type { Credentials } from "../credentials";
3
+ import type { DevToolsSys } from "../../types";
4
4
  export declare function pushMetrics(sys: DevToolsSys, credentials: Credentials, body: FusionMetrics): Promise<void>;
@@ -1,5 +1,5 @@
1
1
  import type { FusionConfig } from "$/ai-utils";
2
- import type { DevToolsSys } from "types";
2
+ import type { DevToolsSys } from "../../types";
3
3
  export declare const getTempFolder: () => string;
4
4
  export declare const cleanupTempFolder: () => boolean;
5
5
  /**
@@ -1,3 +1,3 @@
1
- import type { DevToolsSys } from "types";
1
+ import type { DevToolsSys } from "../../types";
2
2
  import type { ProxyMiddleware } from "../../types/proxy-middleware";
3
3
  export declare const createProxy: (serverUrl: string, sys: DevToolsSys) => ProxyMiddleware;
@@ -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[]>;
@@ -1,4 +1,4 @@
1
- import type { DevToolsSys } from "types";
1
+ import type { DevToolsSys } from "../../types";
2
2
  import type { Credentials } from "../credentials";
3
3
  import type { GitConfigs } from "$/ai-utils";
4
4
  export interface RunCommandOptions {