@mcp-use/agent 2.0.0-beta.9 → 2.0.0
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/README.md +145 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/adapters/base.d.ts +31 -28
- package/dist/adapters/base.d.ts.map +1 -1
- package/dist/adapters/index.d.ts +1 -1
- package/dist/adapters/index.d.ts.map +1 -1
- package/dist/adapters/langchain_adapter.d.ts +10 -0
- package/dist/adapters/langchain_adapter.d.ts.map +1 -1
- package/dist/adapters/native_adapter.d.ts +27 -2
- package/dist/adapters/native_adapter.d.ts.map +1 -1
- package/dist/agents/agent_options.d.ts +47 -4
- package/dist/agents/agent_options.d.ts.map +1 -1
- package/dist/agents/display.d.ts.map +1 -1
- package/dist/agents/mcp_agent.d.ts +85 -14
- package/dist/agents/mcp_agent.d.ts.map +1 -1
- package/dist/agents/mcp_agent_langchain.d.ts +103 -38
- package/dist/agents/mcp_agent_langchain.d.ts.map +1 -1
- package/dist/agents/normalize_run_options.d.ts +3 -1
- package/dist/agents/normalize_run_options.d.ts.map +1 -1
- package/dist/agents/prompts/index.d.ts +7 -0
- package/dist/agents/prompts/index.d.ts.map +1 -1
- package/dist/agents/remote.d.ts +39 -14
- package/dist/agents/remote.d.ts.map +1 -1
- package/dist/agents/run_options.d.ts +22 -0
- package/dist/agents/run_options.d.ts.map +1 -1
- package/dist/agents/types.d.ts +45 -23
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/agents/utils/ai_sdk.d.ts +14 -5
- package/dist/agents/utils/ai_sdk.d.ts.map +1 -1
- package/dist/agents/utils/index.d.ts +1 -1
- package/dist/agents/utils/index.d.ts.map +1 -1
- package/dist/agents/utils/llm_provider.d.ts +31 -23
- package/dist/agents/utils/llm_provider.d.ts.map +1 -1
- package/dist/index.d.ts +10 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +197 -36
- package/dist/index.js.map +1 -1
- package/dist/langchain.d.ts +9 -2
- package/dist/langchain.d.ts.map +1 -1
- package/dist/langchain.js +375 -42787
- package/dist/langchain.js.map +1 -1
- package/dist/llm/chat.d.ts +8 -1
- package/dist/llm/chat.d.ts.map +1 -1
- package/dist/llm/messageFormat.d.ts +38 -5
- package/dist/llm/messageFormat.d.ts.map +1 -1
- package/dist/llm/native_runner.d.ts.map +1 -1
- package/dist/llm/provider_config.d.ts +25 -1
- package/dist/llm/provider_config.d.ts.map +1 -1
- package/dist/llm/providers/anthropic.d.ts.map +1 -1
- package/dist/llm/providers/ollama/utils.d.ts +22 -0
- package/dist/llm/providers/ollama/utils.d.ts.map +1 -1
- package/dist/llm/providers/openai-chat-completions.d.ts +8 -1
- package/dist/llm/providers/openai-chat-completions.d.ts.map +1 -1
- package/dist/llm/providers/openai-responses.d.ts +2 -1
- package/dist/llm/providers/openai-responses.d.ts.map +1 -1
- package/dist/llm/types.d.ts +85 -18
- package/dist/llm/types.d.ts.map +1 -1
- package/dist/managers/server_manager.d.ts +30 -0
- package/dist/managers/server_manager.d.ts.map +1 -1
- package/dist/managers/tools/acquire_active_mcp_server.d.ts +5 -0
- package/dist/managers/tools/acquire_active_mcp_server.d.ts.map +1 -1
- package/dist/managers/tools/add_server_from_config.d.ts +12 -0
- package/dist/managers/tools/add_server_from_config.d.ts.map +1 -1
- package/dist/managers/tools/base.d.ts +7 -0
- package/dist/managers/tools/base.d.ts.map +1 -1
- package/dist/managers/tools/connect_mcp_server.d.ts +9 -0
- package/dist/managers/tools/connect_mcp_server.d.ts.map +1 -1
- package/dist/managers/tools/list_mcp_servers.d.ts +5 -0
- package/dist/managers/tools/list_mcp_servers.d.ts.map +1 -1
- package/dist/managers/tools/release_mcp_server_connection.d.ts +5 -0
- package/dist/managers/tools/release_mcp_server_connection.d.ts.map +1 -1
- package/dist/managers/types.d.ts +9 -0
- package/dist/managers/types.d.ts.map +1 -1
- package/dist/observability/index.d.ts +1 -1
- package/dist/observability/index.d.ts.map +1 -1
- package/dist/observability/langfuse.d.ts.map +1 -1
- package/dist/observability/manager.d.ts +20 -8
- package/dist/observability/manager.d.ts.map +1 -1
- package/package.json +13 -17
- package/dist/browser-agent.d.ts +0 -9
- package/dist/browser-agent.d.ts.map +0 -1
- package/dist/browser-agent.js +0 -3236
- package/dist/browser-agent.js.map +0 -1
package/dist/adapters/base.d.ts
CHANGED
|
@@ -16,6 +16,9 @@ export declare abstract class BaseAdapter<T> {
|
|
|
16
16
|
* generated for it.
|
|
17
17
|
*/
|
|
18
18
|
private readonly connectorToolMap;
|
|
19
|
+
/**
|
|
20
|
+
* @param disallowedTools - MCP tool names to omit during conversion.
|
|
21
|
+
*/
|
|
19
22
|
constructor(disallowedTools?: string[]);
|
|
20
23
|
/**
|
|
21
24
|
* Create tools from an MCPClient instance.
|
|
@@ -23,89 +26,89 @@ export declare abstract class BaseAdapter<T> {
|
|
|
23
26
|
* This is the recommended way to create tools from an MCPClient, as it handles
|
|
24
27
|
* session creation and connector extraction automatically.
|
|
25
28
|
*
|
|
26
|
-
* @param client
|
|
27
|
-
* @param disallowedTools Optional list of tool names to exclude.
|
|
28
|
-
* @returns
|
|
29
|
+
* @param client - The MCPClient to extract tools from.
|
|
30
|
+
* @param disallowedTools - Optional list of tool names to exclude.
|
|
31
|
+
* @returns A promise that resolves with a list of converted tools.
|
|
29
32
|
*/
|
|
30
33
|
static createTools<TTool, TAdapter extends BaseAdapter<TTool>>(this: new (disallowedTools?: string[]) => TAdapter, client: MCPClient, disallowedTools?: string[]): Promise<TTool[]>;
|
|
31
34
|
/**
|
|
32
35
|
* Dynamically load tools for a specific connector.
|
|
33
36
|
*
|
|
34
|
-
* @param connector The connector to load tools for.
|
|
35
|
-
* @returns
|
|
37
|
+
* @param connector - The connector to load tools for.
|
|
38
|
+
* @returns The list of tools that were loaded in the target framework's format.
|
|
36
39
|
*/
|
|
37
40
|
loadToolsForConnector(connector: BaseConnector): Promise<T[]>;
|
|
38
41
|
/**
|
|
39
42
|
* Convert an MCP tool to the target framework's tool format.
|
|
40
43
|
*
|
|
41
|
-
* @param mcpTool
|
|
42
|
-
* @param connector The connector that provides this tool.
|
|
43
|
-
* @returns
|
|
44
|
+
* @param mcpTool - The MCP tool definition to convert.
|
|
45
|
+
* @param connector - The connector that provides this tool.
|
|
46
|
+
* @returns The converted tool, or null / undefined if no tool should be produced.
|
|
44
47
|
*/
|
|
45
48
|
protected abstract convertTool(mcpTool: Record<string, any>, connector: BaseConnector): T | null | undefined;
|
|
46
49
|
/**
|
|
47
50
|
* Convert an MCP resource to the target framework's tool format.
|
|
48
51
|
*
|
|
49
|
-
* @param mcpResource The MCP resource definition to convert.
|
|
50
|
-
* @param connector
|
|
51
|
-
* @returns
|
|
52
|
+
* @param mcpResource - The MCP resource definition to convert.
|
|
53
|
+
* @param connector - The connector that provides this resource.
|
|
54
|
+
* @returns The converted resource as a tool, or null / undefined if no tool should be produced.
|
|
52
55
|
*/
|
|
53
56
|
protected abstract convertResource?(mcpResource: Record<string, any>, connector: BaseConnector): T | null | undefined;
|
|
54
57
|
/**
|
|
55
58
|
* Convert an MCP prompt to the target framework's tool format.
|
|
56
59
|
*
|
|
57
|
-
* @param mcpPrompt The MCP prompt definition to convert.
|
|
58
|
-
* @param connector The connector that provides this prompt.
|
|
59
|
-
* @returns
|
|
60
|
+
* @param mcpPrompt - The MCP prompt definition to convert.
|
|
61
|
+
* @param connector - The connector that provides this prompt.
|
|
62
|
+
* @returns The converted prompt as a tool, or null / undefined if no tool should be produced.
|
|
60
63
|
*/
|
|
61
64
|
protected abstract convertPrompt?(mcpPrompt: Record<string, any>, connector: BaseConnector): T | null | undefined;
|
|
62
65
|
/**
|
|
63
66
|
* Create tools from MCP tools in all provided connectors.
|
|
64
67
|
*
|
|
65
|
-
* @param connectors List of MCP connectors to create tools from.
|
|
66
|
-
* @returns
|
|
68
|
+
* @param connectors - List of MCP connectors to create tools from.
|
|
69
|
+
* @returns A promise that resolves with all converted tools.
|
|
67
70
|
*/
|
|
68
71
|
createToolsFromConnectors(connectors: BaseConnector[]): Promise<T[]>;
|
|
69
72
|
/**
|
|
70
73
|
* Dynamically load resources for a specific connector.
|
|
71
74
|
*
|
|
72
|
-
* @param connector The connector to load resources for.
|
|
73
|
-
* @returns
|
|
75
|
+
* @param connector - The connector to load resources for.
|
|
76
|
+
* @returns The list of resources that were loaded in the target framework's format.
|
|
74
77
|
*/
|
|
75
78
|
loadResourcesForConnector(connector: BaseConnector): Promise<T[]>;
|
|
76
79
|
/**
|
|
77
80
|
* Dynamically load prompts for a specific connector.
|
|
78
81
|
*
|
|
79
|
-
* @param connector The connector to load prompts for.
|
|
80
|
-
* @returns
|
|
82
|
+
* @param connector - The connector to load prompts for.
|
|
83
|
+
* @returns The list of prompts that were loaded in the target framework's format.
|
|
81
84
|
*/
|
|
82
85
|
loadPromptsForConnector(connector: BaseConnector): Promise<T[]>;
|
|
83
86
|
/**
|
|
84
87
|
* Create resources from MCP resources in all provided connectors.
|
|
85
88
|
*
|
|
86
|
-
* @param connectors List of MCP connectors to create resources from.
|
|
87
|
-
* @returns
|
|
89
|
+
* @param connectors - List of MCP connectors to create resources from.
|
|
90
|
+
* @returns A promise that resolves with all converted resources.
|
|
88
91
|
*/
|
|
89
92
|
createResourcesFromConnectors(connectors: BaseConnector[]): Promise<T[]>;
|
|
90
93
|
/**
|
|
91
94
|
* Create prompts from MCP prompts in all provided connectors.
|
|
92
95
|
*
|
|
93
|
-
* @param connectors List of MCP connectors to create prompts from.
|
|
94
|
-
* @returns
|
|
96
|
+
* @param connectors - List of MCP connectors to create prompts from.
|
|
97
|
+
* @returns A promise that resolves with all converted prompts.
|
|
95
98
|
*/
|
|
96
99
|
createPromptsFromConnectors(connectors: BaseConnector[]): Promise<T[]>;
|
|
97
100
|
/**
|
|
98
101
|
* Check if a connector is initialized and has tools.
|
|
99
102
|
*
|
|
100
|
-
* @param connector The connector to check.
|
|
101
|
-
* @returns
|
|
103
|
+
* @param connector - The connector to check.
|
|
104
|
+
* @returns True if the connector is initialized and has tools, false otherwise.
|
|
102
105
|
*/
|
|
103
106
|
private checkConnectorInitialized;
|
|
104
107
|
/**
|
|
105
108
|
* Ensure a connector is initialized.
|
|
106
109
|
*
|
|
107
|
-
* @param connector The connector to initialize.
|
|
108
|
-
* @returns
|
|
110
|
+
* @param connector - The connector to initialize.
|
|
111
|
+
* @returns True if initialization succeeded, false otherwise.
|
|
109
112
|
*/
|
|
110
113
|
private ensureConnectorInitialized;
|
|
111
114
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/adapters/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGrD;;;;;GAKG;AACH,8BAAsB,WAAW,CAAC,CAAC;IACjC;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,MAAM,EAAE,CAAC;IAE7C;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAsC;IAEvE,YAAY,eAAe,CAAC,EAAE,MAAM,EAAE,EAErC;IAED;;;;;;;;;OASG;IACH,OAAa,WAAW,CAAC,KAAK,EAAE,QAAQ,SAAS,WAAW,CAAC,KAAK,CAAC,EACjE,IAAI,EAAE,KAAK,eAAe,CAAC,EAAE,MAAM,EAAE,KAAK,QAAQ,EAClD,MAAM,EAAE,SAAS,EACjB,eAAe,CAAC,EAAE,MAAM,EAAE,GACzB,OAAO,CAAC,KAAK,EAAE,CAAC,CAuBlB;IAED;;;;;OAKG;IACG,qBAAqB,CAAC,SAAS,EAAE,aAAa,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAmClE;IAED;;;;;;OAMG;IACH,SAAS,CAAC,QAAQ,CAAC,WAAW,CAC5B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC5B,SAAS,EAAE,aAAa,GACvB,CAAC,GAAG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G,OAAO,CAAC,CAAC,EAAE,CAAC,CAkCtE;IAED;;;;;OAKG;IACG,uBAAuB,CAAC,SAAS,EAAE,aAAa,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAkCpE;IAED;;;;;OAKG;IACU,6BAA6B,CACxC,UAAU,EAAE,aAAa,EAAE,GAC1B,OAAO,CAAC,CAAC,EAAE,CAAC,CAUd;IAED;;;;;OAKG;IACU,2BAA2B,CACtC,UAAU,EAAE,aAAa,EAAE,GAC1B,OAAO,CAAC,CAAC,EAAE,CAAC,CASd;IAED;;;;;OAKG;IACH,OAAO,CAAC,yBAAyB;IAIjC;;;;;OAKG;YACW,0BAA0B;CAezC"}
|
package/dist/adapters/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EACL,aAAa,EACb,KAAK,gBAAgB,EACrB,KAAK,eAAe,GACrB,MAAM,qBAAqB,CAAC"}
|
|
@@ -2,10 +2,20 @@ import type { StructuredToolInterface } from "@langchain/core/tools";
|
|
|
2
2
|
import type { Tool as MCPTool, Resource, Prompt } from "@modelcontextprotocol/client";
|
|
3
3
|
import type { BaseConnector } from "@mcp-use/client";
|
|
4
4
|
import { BaseAdapter } from "./base.js";
|
|
5
|
+
/** Converts MCP tools, resources, and prompts into LangChain structured tools. */
|
|
5
6
|
export declare class LangChainAdapter extends BaseAdapter<StructuredToolInterface> {
|
|
6
7
|
private usedToolNames;
|
|
8
|
+
/**
|
|
9
|
+
* @param disallowedTools - MCP tool names to omit during conversion.
|
|
10
|
+
*/
|
|
7
11
|
constructor(disallowedTools?: string[]);
|
|
8
12
|
private reserveName;
|
|
13
|
+
/**
|
|
14
|
+
* Converts MCP tools from all connectors and resets name deduplication.
|
|
15
|
+
*
|
|
16
|
+
* @param connectors - Connected MCP connectors.
|
|
17
|
+
* @returns LangChain structured tools.
|
|
18
|
+
*/
|
|
9
19
|
createToolsFromConnectors(connectors: BaseConnector[]): Promise<StructuredToolInterface[]>;
|
|
10
20
|
/**
|
|
11
21
|
* Convert a single MCP tool specification into a LangChainJS structured tool.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"langchain_adapter.d.ts","sourceRoot":"","sources":["../../src/adapters/langchain_adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,KAAK,EAEV,IAAI,IAAI,OAAO,EACf,QAAQ,EACR,MAAM,EACP,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAKrD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAmBxC,qBAAa,gBAAiB,SAAQ,WAAW,CAAC,uBAAuB,CAAC;IACxE,OAAO,CAAC,aAAa,CAA0B;IAE/C,YAAY,eAAe,GAAE,MAAM,EAAO,EAEzC;IAED,OAAO,CAAC,WAAW;
|
|
1
|
+
{"version":3,"file":"langchain_adapter.d.ts","sourceRoot":"","sources":["../../src/adapters/langchain_adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,KAAK,EAEV,IAAI,IAAI,OAAO,EACf,QAAQ,EACR,MAAM,EACP,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAKrD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAmBxC,kFAAkF;AAClF,qBAAa,gBAAiB,SAAQ,WAAW,CAAC,uBAAuB,CAAC;IACxE,OAAO,CAAC,aAAa,CAA0B;IAE/C;;OAEG;IACH,YAAY,eAAe,GAAE,MAAM,EAAO,EAEzC;IAED,OAAO,CAAC,WAAW;IA0BnB;;;;;OAKG;IACmB,yBAAyB,CAC7C,UAAU,EAAE,aAAa,EAAE,GAC1B,OAAO,CAAC,uBAAuB,EAAE,CAAC,CAIpC;IAED;;OAEG;IACH,SAAS,CAAC,WAAW,CACnB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,aAAa,GACvB,uBAAuB,GAAG,IAAI,CAkChC;IAED;;;OAGG;IACH,SAAS,CAAC,eAAe,CACvB,WAAW,EAAE,QAAQ,EACrB,SAAS,EAAE,aAAa,GACvB,uBAAuB,GAAG,IAAI,CAyChC;IAED;;;;OAIG;IACH,SAAS,CAAC,aAAa,CACrB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,aAAa,GACvB,uBAAuB,GAAG,IAAI,CA4DhC;CACF"}
|
|
@@ -2,21 +2,46 @@ import type { Prompt, Resource, Tool as MCPTool } from "@modelcontextprotocol/cl
|
|
|
2
2
|
import type { BaseConnector } from "@mcp-use/client";
|
|
3
3
|
import type { ProviderTool } from "../llm/types.js";
|
|
4
4
|
import { BaseAdapter } from "./base.js";
|
|
5
|
+
/** Native tool definition paired with its internal dispatch route. */
|
|
5
6
|
export interface NativeToolEntry extends ProviderTool {
|
|
6
7
|
/** Internal dispatch key (may differ from MCP name after dedup). */
|
|
7
8
|
dispatchKey: string;
|
|
8
9
|
}
|
|
10
|
+
/** Invokes a native adapter tool by its exposed name. */
|
|
9
11
|
export type NativeCallToolFn = (name: string, args: Record<string, unknown>) => Promise<unknown>;
|
|
10
12
|
/**
|
|
11
|
-
* Converts MCP tools
|
|
12
|
-
*
|
|
13
|
+
* Converts MCP tools, resources, and prompts into provider-neutral tools.
|
|
14
|
+
*
|
|
15
|
+
* The adapter also creates a dispatcher that routes model tool calls back to
|
|
16
|
+
* the connector that supplied each tool.
|
|
13
17
|
*/
|
|
14
18
|
export declare class NativeAdapter extends BaseAdapter<NativeToolEntry> {
|
|
15
19
|
private usedToolNames;
|
|
16
20
|
private handlers;
|
|
21
|
+
/**
|
|
22
|
+
* @param disallowedTools - MCP tool names to omit during conversion.
|
|
23
|
+
*/
|
|
17
24
|
constructor(disallowedTools?: string[]);
|
|
25
|
+
/**
|
|
26
|
+
* Converts MCP tools from all connectors and resets the dispatch table.
|
|
27
|
+
*
|
|
28
|
+
* @param connectors - Connected MCP connectors.
|
|
29
|
+
* @returns Provider-neutral tool entries.
|
|
30
|
+
*/
|
|
18
31
|
createToolsFromConnectors(connectors: BaseConnector[]): Promise<NativeToolEntry[]>;
|
|
32
|
+
/**
|
|
33
|
+
* Creates a dispatcher for the entries loaded by this adapter.
|
|
34
|
+
*
|
|
35
|
+
* @returns A function that invokes tools, reads resources, or gets prompts.
|
|
36
|
+
* @throws Error if the requested exposed tool name is unknown.
|
|
37
|
+
*/
|
|
19
38
|
createCallTool(): NativeCallToolFn;
|
|
39
|
+
/**
|
|
40
|
+
* Removes internal dispatch metadata from native tool entries.
|
|
41
|
+
*
|
|
42
|
+
* @param entries - Entries created by this adapter.
|
|
43
|
+
* @returns Provider-neutral definitions safe to send to an LLM provider.
|
|
44
|
+
*/
|
|
20
45
|
toProviderTools(entries: NativeToolEntry[]): ProviderTool[];
|
|
21
46
|
private reserveName;
|
|
22
47
|
private register;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native_adapter.d.ts","sourceRoot":"","sources":["../../src/adapters/native_adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,QAAQ,EACR,IAAI,IAAI,OAAO,EAChB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;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AE,eAAe,EAAE,GAAG,YAAY,EAAE,CAM1D;IAED,OAAO,CAAC,WAAW;IAwBnB,OAAO,CAAC,QAAQ;IAQhB,SAAS,CAAC,WAAW,CACnB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,aAAa,GACvB,eAAe,GAAG,IAAI,CAkBxB;IAED,SAAS,CAAC,eAAe,CACvB,WAAW,EAAE,QAAQ,EACrB,SAAS,EAAE,aAAa,GACvB,eAAe,GAAG,IAAI,CAkBxB;IAED,SAAS,CAAC,aAAa,CACrB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,aAAa,GACvB,eAAe,GAAG,IAAI,CA4BxB;CACF"}
|
|
@@ -3,36 +3,79 @@ import type { BaseConnector } from "@mcp-use/client";
|
|
|
3
3
|
import type { ProviderConfig } from "../llm/types.js";
|
|
4
4
|
import type { NativeLLMConfig } from "../llm/provider_config.js";
|
|
5
5
|
import type { MCPServerConfig } from "./types.js";
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* A live MCP connection that the agent can use without creating an
|
|
8
|
+
* an MCP client.
|
|
9
|
+
*
|
|
10
|
+
* This structural interface accepts connection objects returned by browser
|
|
11
|
+
* MCP hooks as well as custom connection implementations.
|
|
12
|
+
*/
|
|
7
13
|
export interface McpConnectionLike {
|
|
14
|
+
/** Tools already discovered on the connection. */
|
|
8
15
|
tools?: Array<{
|
|
16
|
+
/** Tool name sent to the MCP server. */
|
|
9
17
|
name: string;
|
|
18
|
+
/** Human-readable tool description supplied to the model. */
|
|
10
19
|
description?: string;
|
|
20
|
+
/** JSON Schema describing the tool arguments. */
|
|
11
21
|
inputSchema?: Record<string, unknown>;
|
|
12
22
|
}>;
|
|
23
|
+
/**
|
|
24
|
+
* Invokes a tool on the connection.
|
|
25
|
+
*
|
|
26
|
+
* @param name - MCP tool name.
|
|
27
|
+
* @param args - Tool arguments.
|
|
28
|
+
* @param options - Optional cancellation signal.
|
|
29
|
+
* @returns The raw MCP tool result.
|
|
30
|
+
*/
|
|
13
31
|
callTool: (name: string, args: Record<string, unknown>, options?: {
|
|
14
32
|
signal?: AbortSignal;
|
|
15
33
|
}) => Promise<unknown>;
|
|
16
34
|
}
|
|
17
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* MCP servers available to an agent.
|
|
37
|
+
*
|
|
38
|
+
* Pass a named configuration map when the agent should create its own client,
|
|
39
|
+
* or pass live connections in browser environments.
|
|
40
|
+
*/
|
|
18
41
|
export type McpServersInput = Record<string, MCPServerConfig> | McpConnectionLike[];
|
|
42
|
+
/** Configures a local or remote {@link MCPAgent}. */
|
|
19
43
|
export interface MCPAgentOptions {
|
|
20
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Model identifier such as `"openai/gpt-4o"`, or a complete
|
|
46
|
+
* provider configuration.
|
|
47
|
+
*/
|
|
21
48
|
llm: string | ProviderConfig;
|
|
49
|
+
/** Credentials and sampling overrides for a string model identifier. */
|
|
22
50
|
llmConfig?: NativeLLMConfig;
|
|
51
|
+
/** Existing MCP client. The agent does not create another client. */
|
|
23
52
|
client?: MCPClient;
|
|
53
|
+
/** Existing MCP connectors to initialize and expose as tools. */
|
|
24
54
|
connectors?: BaseConnector[];
|
|
25
|
-
/**
|
|
55
|
+
/** Named server configurations or live browser connections. */
|
|
26
56
|
mcpServers?: McpServersInput;
|
|
57
|
+
/** Maximum model/tool-loop steps per run. Defaults to `10`. */
|
|
27
58
|
maxSteps?: number;
|
|
59
|
+
/** Initializes the agent on the first run. Defaults to `false`. */
|
|
28
60
|
autoInitialize?: boolean;
|
|
61
|
+
/** Retains user and assistant messages between runs. Defaults to `true`. */
|
|
29
62
|
memoryEnabled?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* System instruction for local runs. Pass `null` to use the default
|
|
65
|
+
* instruction.
|
|
66
|
+
*/
|
|
30
67
|
systemPrompt?: string | null;
|
|
68
|
+
/** MCP tool names that must not be exposed to the model. */
|
|
31
69
|
disallowedTools?: string[];
|
|
70
|
+
/** Exposes MCP resources as callable tools. Defaults to `true`. */
|
|
32
71
|
exposeResourcesAsTools?: boolean;
|
|
72
|
+
/** Exposes MCP prompts as callable tools. Defaults to `true`. */
|
|
33
73
|
exposePromptsAsTools?: boolean;
|
|
74
|
+
/** Remote agent identifier. When set, execution uses the remote API. */
|
|
34
75
|
agentId?: string;
|
|
76
|
+
/** Remote API key. Defaults to `MCP_USE_API_KEY`. */
|
|
35
77
|
apiKey?: string;
|
|
78
|
+
/** Remote API origin. Defaults to `https://cloud.manufact.com`. */
|
|
36
79
|
baseUrl?: string;
|
|
37
80
|
}
|
|
38
81
|
//# sourceMappingURL=agent_options.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent_options.d.ts","sourceRoot":"","sources":["../../src/agents/agent_options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD
|
|
1
|
+
{"version":3,"file":"agent_options.d.ts","sourceRoot":"","sources":["../../src/agents/agent_options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,kDAAkD;IAClD,KAAK,CAAC,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AC;IAC/B,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"display.d.ts","sourceRoot":"","sources":["../../src/agents/display.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"display.d.ts","sourceRoot":"","sources":["../../src/agents/display.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAumBtE;;GAEG;AACH,wBAAuB,kBAAkB,CACvC,qBAAqB,EAAE,cAAc,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC,GAC7D,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAoCpC"}
|
|
@@ -6,18 +6,25 @@ import type { RunOptions } from "./run_options.js";
|
|
|
6
6
|
export type { ProviderName, ProviderConfig, ProviderMessage, LlmStreamEvent, TokenUsage, };
|
|
7
7
|
export type { MCPAgentOptions, McpConnectionLike, McpServersInput, } from "./agent_options.js";
|
|
8
8
|
export type { RunOptions } from "./run_options.js";
|
|
9
|
+
/** Tool invocation details in an {@link AgentStep}. */
|
|
10
|
+
export interface AgentAction {
|
|
11
|
+
/** Tool name exposed to the model. */
|
|
12
|
+
tool: string;
|
|
13
|
+
/** Arguments generated by the model. */
|
|
14
|
+
toolInput: Record<string, unknown>;
|
|
15
|
+
/** Model log associated with the action. */
|
|
16
|
+
log: string;
|
|
17
|
+
}
|
|
18
|
+
/** A completed MCP tool invocation yielded by {@link MCPAgent.stream}. */
|
|
9
19
|
export interface AgentStep {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
log: string;
|
|
14
|
-
};
|
|
20
|
+
/** Tool invocation requested by the model. */
|
|
21
|
+
action: AgentAction;
|
|
22
|
+
/** Serialized result returned by the tool. */
|
|
15
23
|
observation: string;
|
|
16
24
|
}
|
|
17
|
-
/**
|
|
18
|
-
* Cross-platform MCP agent: Inspector → MCPAgent → loop → fetch + @mcp-use/client.
|
|
19
|
-
*/
|
|
25
|
+
/** Runs provider-neutral LLM tool loops against one or more MCP servers. */
|
|
20
26
|
export declare class MCPAgent {
|
|
27
|
+
/** @returns The installed `@mcp-use/agent` package version. */
|
|
21
28
|
static getPackageVersion(): string;
|
|
22
29
|
private driver?;
|
|
23
30
|
private client?;
|
|
@@ -43,45 +50,109 @@ export declare class MCPAgent {
|
|
|
43
50
|
private conversationMessages;
|
|
44
51
|
private memoryEnabled;
|
|
45
52
|
private boundConnections?;
|
|
53
|
+
/**
|
|
54
|
+
* Creates an MCP agent.
|
|
55
|
+
*
|
|
56
|
+
* Call {@link initialize} before the first local run unless
|
|
57
|
+
* `autoInitialize` is enabled. Setting `agentId` creates a remote agent.
|
|
58
|
+
*
|
|
59
|
+
* @param options - Model, MCP connection, and execution settings.
|
|
60
|
+
* @throws Error if local execution has no MCP servers, client, or connectors.
|
|
61
|
+
*/
|
|
46
62
|
constructor(options: MCPAgentOptions);
|
|
47
63
|
private resolveMcpServers;
|
|
48
64
|
private hasLiveConnections;
|
|
65
|
+
/**
|
|
66
|
+
* Resolves the model configuration, connects MCP servers, and loads tools.
|
|
67
|
+
*
|
|
68
|
+
* Calling this method more than once has no effect until {@link close}.
|
|
69
|
+
*
|
|
70
|
+
* @throws Error if the model configuration is incomplete or no driver can
|
|
71
|
+
* be created.
|
|
72
|
+
*/
|
|
49
73
|
initialize(): Promise<void>;
|
|
50
74
|
private loadTools;
|
|
51
75
|
private bindConnections;
|
|
52
76
|
private buildMessages;
|
|
77
|
+
/**
|
|
78
|
+
* @returns A shallow copy of stored provider-neutral conversation history.
|
|
79
|
+
*/
|
|
53
80
|
getConversationHistory(): ProviderMessage[];
|
|
81
|
+
/** Removes all stored user and assistant messages. */
|
|
54
82
|
clearConversationHistory(): void;
|
|
83
|
+
/**
|
|
84
|
+
* Replaces the system instruction used by subsequent runs.
|
|
85
|
+
*
|
|
86
|
+
* @param message - New system instruction.
|
|
87
|
+
*/
|
|
55
88
|
setSystemMessage(message: string): void;
|
|
56
89
|
private ensureReady;
|
|
57
90
|
private nativeRunParams;
|
|
91
|
+
/**
|
|
92
|
+
* Runs the agent and resolves with the final assistant text.
|
|
93
|
+
*
|
|
94
|
+
* @param options - Input and per-run execution settings.
|
|
95
|
+
* @returns Final assistant text.
|
|
96
|
+
*/
|
|
58
97
|
run(options: RunOptions): Promise<string>;
|
|
59
98
|
run<T>(options: RunOptions<T>): Promise<T>;
|
|
60
|
-
/** @deprecated Use run({ prompt, maxSteps, ... }) */
|
|
99
|
+
/** @deprecated Use `run({ prompt, maxSteps, ... })`. */
|
|
61
100
|
run(query: string, maxSteps?: number, manageConnector?: boolean, externalHistory?: unknown, outputSchema?: undefined, signal?: AbortSignal): Promise<string>;
|
|
62
|
-
/** @deprecated Use run({ prompt, schema, maxSteps, ... }) */
|
|
101
|
+
/** @deprecated Use `run({ prompt, schema, maxSteps, ... })`. */
|
|
63
102
|
run<T>(query: string, maxSteps?: number, manageConnector?: boolean, externalHistory?: unknown, outputSchema?: ZodSchema<T>, signal?: AbortSignal): Promise<T>;
|
|
103
|
+
/**
|
|
104
|
+
* Runs the agent, yielding each completed tool step.
|
|
105
|
+
*
|
|
106
|
+
* The generator's return value is the final assistant text.
|
|
107
|
+
*
|
|
108
|
+
* @param options - Input and per-run execution settings.
|
|
109
|
+
* @returns An async generator of completed tool steps.
|
|
110
|
+
*/
|
|
64
111
|
stream(options: RunOptions): AsyncGenerator<AgentStep, string, void>;
|
|
65
112
|
stream<T>(options: RunOptions<T>): AsyncGenerator<AgentStep, T, void>;
|
|
66
|
-
/** @deprecated Use stream({ prompt, maxSteps, ... }) */
|
|
113
|
+
/** @deprecated Use `stream({ prompt, maxSteps, ... })`. */
|
|
67
114
|
stream<T = string>(query: string, maxSteps?: number, manageConnector?: boolean, externalHistory?: unknown, outputSchema?: ZodSchema<T>, signal?: AbortSignal): AsyncGenerator<AgentStep, string | T, void>;
|
|
115
|
+
/**
|
|
116
|
+
* Runs the agent and yields provider-neutral token, tool, usage, and
|
|
117
|
+
* lifecycle events.
|
|
118
|
+
*
|
|
119
|
+
* @param options - Input and per-run execution settings.
|
|
120
|
+
* @returns An async generator of low-level stream events.
|
|
121
|
+
* @throws Error for remote agents, which do not support event streaming.
|
|
122
|
+
*/
|
|
68
123
|
streamEvents(options: RunOptions): AsyncGenerator<LlmStreamEvent, void, unknown>;
|
|
69
124
|
streamEvents<T>(options: RunOptions<T>): AsyncGenerator<LlmStreamEvent, void, unknown>;
|
|
70
|
-
/** @deprecated Use streamEvents({ prompt, maxSteps, ... }) */
|
|
125
|
+
/** @deprecated Use `streamEvents({ prompt, maxSteps, ... })`. */
|
|
71
126
|
streamEvents<T = string>(query: string, maxSteps?: number, manageConnector?: boolean, externalHistory?: unknown, outputSchema?: ZodSchema<T>, signal?: AbortSignal): AsyncGenerator<LlmStreamEvent, void, unknown>;
|
|
72
|
-
/**
|
|
127
|
+
/**
|
|
128
|
+
* Runs a single model completion without MCP tools.
|
|
129
|
+
*
|
|
130
|
+
* @param options - Provider-neutral messages and optional cancellation
|
|
131
|
+
* signal.
|
|
132
|
+
* @returns Final assistant text.
|
|
133
|
+
*/
|
|
73
134
|
chat(options: {
|
|
74
135
|
messages: ProviderMessage[];
|
|
75
136
|
signal?: AbortSignal;
|
|
76
137
|
}): Promise<string>;
|
|
138
|
+
/**
|
|
139
|
+
* Closes MCP sessions created by this agent and resets initialization state.
|
|
140
|
+
*
|
|
141
|
+
* Existing clients supplied by the caller remain open.
|
|
142
|
+
*/
|
|
77
143
|
close(): Promise<void>;
|
|
78
144
|
}
|
|
79
|
-
/**
|
|
145
|
+
/** Serializable model configuration used by inspector and configuration UIs. */
|
|
80
146
|
export interface LLMConfig {
|
|
147
|
+
/** Provider implementation. */
|
|
81
148
|
provider: ProviderName;
|
|
149
|
+
/** Provider-specific model identifier. */
|
|
82
150
|
model: string;
|
|
151
|
+
/** Provider API key. */
|
|
83
152
|
apiKey: string;
|
|
153
|
+
/** Sampling temperature. */
|
|
84
154
|
temperature?: number;
|
|
155
|
+
/** Provider API base URL override. */
|
|
85
156
|
baseUrl?: string;
|
|
86
157
|
}
|
|
87
158
|
export { providerConfigFromOptions, parseLLMStringToProviderConfig };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp_agent.d.ts","sourceRoot":"","sources":["../../src/agents/mcp_agent.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAQrC,OAAO,EACL,8BAA8B,EAC9B,yBAAyB,EAE1B,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"mcp_agent.d.ts","sourceRoot":"","sources":["../../src/agents/mcp_agent.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAQrC,OAAO,EACL,8BAA8B,EAC9B,yBAAyB,EAE1B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,eAAe,EACf,YAAY,EACZ,UAAU,EACX,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EACV,eAAe,EAGhB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAInD,YAAY,EACV,YAAY,EACZ,cAAc,EACd,eAAe,EACf,cAAc,EACd,UAAU,GACX,CAAC;AACF,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,uDAAuD;AACvD,MAAM,WAAW,WAAW;IAC1B,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,SAAS,EAAE,MAAM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