mcp-use 0.0.1 → 0.0.2
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/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/src/adapters/base.d.ts +68 -0
- package/dist/src/adapters/base.d.ts.map +1 -0
- package/dist/src/adapters/index.d.ts +3 -0
- package/dist/src/adapters/index.d.ts.map +1 -0
- package/dist/src/adapters/langchain_adapter.d.ts +12 -0
- package/dist/src/adapters/langchain_adapter.d.ts.map +1 -0
- package/dist/src/agents/base.d.ts +27 -0
- package/dist/src/agents/base.d.ts.map +1 -0
- package/dist/src/agents/index.d.ts +4 -0
- package/dist/src/agents/index.d.ts.map +1 -0
- package/dist/src/agents/mcp_agent.d.ts +59 -0
- package/dist/src/agents/mcp_agent.d.ts.map +1 -0
- package/dist/src/agents/prompts/system_prompt_builder.d.ts +6 -0
- package/dist/src/agents/prompts/system_prompt_builder.d.ts.map +1 -0
- package/dist/src/agents/prompts/templates.d.ts +3 -0
- package/dist/src/agents/prompts/templates.d.ts.map +1 -0
- package/dist/src/agents/server_manager.d.ts +22 -0
- package/dist/src/agents/server_manager.d.ts.map +1 -0
- package/dist/src/client.d.ts +20 -0
- package/dist/src/client.d.ts.map +1 -0
- package/dist/src/config.d.ts +4 -0
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/connectors/base.d.ts +79 -0
- package/dist/src/connectors/base.d.ts.map +1 -0
- package/dist/src/connectors/http.d.ts +23 -0
- package/dist/src/connectors/http.d.ts.map +1 -0
- package/dist/src/connectors/index.d.ts +5 -0
- package/dist/src/connectors/index.d.ts.map +1 -0
- package/dist/src/connectors/stdio.d.ts +25 -0
- package/dist/src/connectors/stdio.d.ts.map +1 -0
- package/dist/src/connectors/websocket.d.ts +35 -0
- package/dist/src/connectors/websocket.d.ts.map +1 -0
- package/dist/src/logging.d.ts +9 -0
- package/dist/src/logging.d.ts.map +1 -0
- package/dist/src/session.d.ts +19 -0
- package/dist/src/session.d.ts.map +1 -0
- package/dist/src/task_managers/base.d.ts +56 -0
- package/dist/src/task_managers/base.d.ts.map +1 -0
- package/dist/src/task_managers/index.d.ts +5 -0
- package/dist/src/task_managers/index.d.ts.map +1 -0
- package/dist/src/task_managers/sse.d.ts +24 -0
- package/dist/src/task_managers/sse.d.ts.map +1 -0
- package/dist/src/task_managers/stdio.d.ts +28 -0
- package/dist/src/task_managers/stdio.d.ts.map +1 -0
- package/dist/src/task_managers/websocket.d.ts +18 -0
- package/dist/src/task_managers/websocket.d.ts.map +1 -0
- package/package.json +2 -2
package/dist/index.d.ts
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
import { MCPAgent } from './src/agents/mcp_agent.js';
|
2
|
+
import { MCPClient } from './src/client.js';
|
3
|
+
import { loadConfigFile } from './src/config.js';
|
4
|
+
import { BaseConnector } from './src/connectors/base.js';
|
5
|
+
import { HttpConnector } from './src/connectors/http.js';
|
6
|
+
import { StdioConnector } from './src/connectors/stdio.js';
|
7
|
+
import { WebSocketConnector } from './src/connectors/websocket.js';
|
8
|
+
import { Logger, logger } from './src/logging.js';
|
9
|
+
import { MCPSession } from './src/session.js';
|
10
|
+
export { BaseConnector, HttpConnector, loadConfigFile, Logger, logger, MCPAgent, MCPClient, MCPSession, StdioConnector, WebSocketConnector };
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAElE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAA"}
|
@@ -0,0 +1,68 @@
|
|
1
|
+
import type { MCPClient } from '../client.js';
|
2
|
+
import type { BaseConnector } from '../connectors/base.js';
|
3
|
+
/**
|
4
|
+
* Abstract base class for converting MCP tools to other framework formats.
|
5
|
+
*
|
6
|
+
* This class defines the common interface that all adapter implementations
|
7
|
+
* should follow to ensure consistency across different frameworks.
|
8
|
+
*/
|
9
|
+
export declare abstract class BaseAdapter<T> {
|
10
|
+
/**
|
11
|
+
* List of tool names that should not be available.
|
12
|
+
*/
|
13
|
+
protected readonly disallowedTools: string[];
|
14
|
+
/**
|
15
|
+
* Internal cache that maps a connector instance to the list of tools
|
16
|
+
* generated for it.
|
17
|
+
*/
|
18
|
+
private readonly connectorToolMap;
|
19
|
+
constructor(disallowedTools?: string[]);
|
20
|
+
/**
|
21
|
+
* Create tools from an MCPClient instance.
|
22
|
+
*
|
23
|
+
* This is the recommended way to create tools from an MCPClient, as it handles
|
24
|
+
* session creation and connector extraction automatically.
|
25
|
+
*
|
26
|
+
* @param client The MCPClient to extract tools from.
|
27
|
+
* @param disallowedTools Optional list of tool names to exclude.
|
28
|
+
* @returns A promise that resolves with a list of converted tools.
|
29
|
+
*/
|
30
|
+
static createTools<TTool, TAdapter extends BaseAdapter<TTool>>(this: new (disallowedTools?: string[]) => TAdapter, client: MCPClient, disallowedTools?: string[]): Promise<TTool[]>;
|
31
|
+
/**
|
32
|
+
* Dynamically load tools for a specific connector.
|
33
|
+
*
|
34
|
+
* @param connector The connector to load tools for.
|
35
|
+
* @returns The list of tools that were loaded in the target framework's format.
|
36
|
+
*/
|
37
|
+
loadToolsForConnector(connector: BaseConnector): Promise<T[]>;
|
38
|
+
/**
|
39
|
+
* Convert an MCP tool to the target framework's tool format.
|
40
|
+
*
|
41
|
+
* @param mcpTool The MCP tool definition to convert.
|
42
|
+
* @param connector The connector that provides this tool.
|
43
|
+
* @returns The converted tool, or null / undefined if no tool should be produced.
|
44
|
+
*/
|
45
|
+
protected abstract convertTool(mcpTool: Record<string, any>, connector: BaseConnector): T | null | undefined;
|
46
|
+
/**
|
47
|
+
* Create tools from MCP tools in all provided connectors.
|
48
|
+
*
|
49
|
+
* @param connectors List of MCP connectors to create tools from.
|
50
|
+
* @returns A promise that resolves with all converted tools.
|
51
|
+
*/
|
52
|
+
createToolsFromConnectors(connectors: BaseConnector[]): Promise<T[]>;
|
53
|
+
/**
|
54
|
+
* Check if a connector is initialized and has tools.
|
55
|
+
*
|
56
|
+
* @param connector The connector to check.
|
57
|
+
* @returns True if the connector is initialized and has tools, false otherwise.
|
58
|
+
*/
|
59
|
+
private checkConnectorInitialized;
|
60
|
+
/**
|
61
|
+
* Ensure a connector is initialized.
|
62
|
+
*
|
63
|
+
* @param connector The connector to initialize.
|
64
|
+
* @returns True if initialization succeeded, false otherwise.
|
65
|
+
*/
|
66
|
+
private ensureConnectorInitialized;
|
67
|
+
}
|
68
|
+
//# sourceMappingURL=base.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/adapters/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAG1D;;;;;GAKG;AACH,8BAAsB,WAAW,CAAC,CAAC;IACjC;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,MAAM,EAAE,CAAA;IAE5C;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAqC;gBAE1D,eAAe,CAAC,EAAE,MAAM,EAAE;IAItC;;;;;;;;;OASG;WACU,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;IAsBnB;;;;;OAKG;IACG,qBAAqB,CAAC,SAAS,EAAE,aAAa,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;IAqCnE;;;;;;OAMG;IACH,SAAS,CAAC,QAAQ,CAAC,WAAW,CAC5B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC5B,SAAS,EAAE,aAAa,GACvB,CAAC,GAAG,IAAI,GAAG,SAAS;IAEvB;;;;;OAKG;IACU,yBAAyB,CAAC,UAAU,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;IAWjF;;;;;OAKG;IACH,OAAO,CAAC,yBAAyB;IAIjC;;;;;OAKG;YACW,0BAA0B;CAczC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import type { Tool as McpTool } from '@modelcontextprotocol/sdk/types.js';
|
2
|
+
import type { BaseConnector } from '../connectors/base.js';
|
3
|
+
import { DynamicStructuredTool } from '@langchain/core/tools';
|
4
|
+
import { BaseAdapter } from './base.js';
|
5
|
+
export declare class LangChainAdapter extends BaseAdapter<DynamicStructuredTool> {
|
6
|
+
constructor(disallowedTools?: string[]);
|
7
|
+
/**
|
8
|
+
* Convert a single MCP tool specification into a LangChainJS structured tool.
|
9
|
+
*/
|
10
|
+
protected convertTool(mcpTool: McpTool, connector: BaseConnector): DynamicStructuredTool | null;
|
11
|
+
}
|
12
|
+
//# sourceMappingURL=langchain_adapter.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"langchain_adapter.d.ts","sourceRoot":"","sources":["../../../src/adapters/langchain_adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAIV,IAAI,IAAI,OAAO,EAEhB,MAAM,oCAAoC,CAAA;AAE3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAG1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAG7D,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAuEvC,qBAAa,gBAAiB,SAAQ,WAAW,CAAC,qBAAqB,CAAC;gBAC1D,eAAe,GAAE,MAAM,EAAO;IAI1C;;OAEG;IACH,SAAS,CAAC,WAAW,CACnB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,aAAa,GACvB,qBAAqB,GAAG,IAAI;CA8BhC"}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import type { MCPSession } from '../session.js';
|
2
|
+
export declare abstract class BaseAgent {
|
3
|
+
protected session: MCPSession;
|
4
|
+
/**
|
5
|
+
* @param session MCP session used for tool invocation
|
6
|
+
*/
|
7
|
+
constructor(session: MCPSession);
|
8
|
+
/**
|
9
|
+
* Initialize the agent, including initializing the MCP session
|
10
|
+
*/
|
11
|
+
abstract initialize(): Promise<void>;
|
12
|
+
/**
|
13
|
+
* Run the agent on a query with a maximum number of steps
|
14
|
+
* @param query The user query
|
15
|
+
* @param maxSteps Maximum steps allowed (default: 10)
|
16
|
+
* @returns Final result of agent execution
|
17
|
+
*/
|
18
|
+
abstract run(query: string, maxSteps?: number): Promise<Record<string, any>>;
|
19
|
+
/**
|
20
|
+
* Perform a single step given the query and previous steps
|
21
|
+
* @param query The user query or intermediate input
|
22
|
+
* @param previousSteps History of steps so far
|
23
|
+
* @returns Result of this step
|
24
|
+
*/
|
25
|
+
abstract step(query: string, previousSteps?: Array<Record<string, any>>): Promise<Record<string, any>>;
|
26
|
+
}
|
27
|
+
//# sourceMappingURL=base.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/agents/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE/C,8BAAsB,SAAS;IAC7B,SAAS,CAAC,OAAO,EAAE,UAAU,CAAA;IAE7B;;OAEG;gBACS,OAAO,EAAE,UAAU;IAI/B;;OAEG;aACa,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAE3C;;;;;OAKG;aACa,GAAG,CACjB,KAAK,EAAE,MAAM,EACb,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAE/B;;;;;OAKG;aACa,IAAI,CAClB,KAAK,EAAE,MAAM,EACb,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,GACzC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agents/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA"}
|
@@ -0,0 +1,59 @@
|
|
1
|
+
import type { BaseLanguageModel } from '@langchain/core/language_models/base';
|
2
|
+
import type { BaseMessage } from '@langchain/core/messages';
|
3
|
+
import type { MCPClient } from '../client.js';
|
4
|
+
import type { BaseConnector } from '../connectors/base.js';
|
5
|
+
import type { ServerManager } from './server_manager.js';
|
6
|
+
import { SystemMessage } from '@langchain/core/messages';
|
7
|
+
import { LangChainAdapter } from '../adapters/langchain_adapter.js';
|
8
|
+
export declare class MCPAgent {
|
9
|
+
private llm;
|
10
|
+
private client?;
|
11
|
+
private connectors;
|
12
|
+
private maxSteps;
|
13
|
+
private autoInitialize;
|
14
|
+
private memoryEnabled;
|
15
|
+
private disallowedTools;
|
16
|
+
private useServerManager;
|
17
|
+
private verbose;
|
18
|
+
private systemPrompt?;
|
19
|
+
private systemPromptTemplateOverride?;
|
20
|
+
private additionalInstructions?;
|
21
|
+
private initialized;
|
22
|
+
private conversationHistory;
|
23
|
+
private agentExecutor;
|
24
|
+
private sessions;
|
25
|
+
private systemMessage;
|
26
|
+
private tools;
|
27
|
+
private adapter;
|
28
|
+
private serverManager;
|
29
|
+
constructor(options: {
|
30
|
+
llm: BaseLanguageModel;
|
31
|
+
client?: MCPClient;
|
32
|
+
connectors?: BaseConnector[];
|
33
|
+
serverName?: string;
|
34
|
+
maxSteps?: number;
|
35
|
+
autoInitialize?: boolean;
|
36
|
+
memoryEnabled?: boolean;
|
37
|
+
systemPrompt?: string | null;
|
38
|
+
systemPromptTemplate?: string | null;
|
39
|
+
additionalInstructions?: string | null;
|
40
|
+
disallowedTools?: string[];
|
41
|
+
useServerManager?: boolean;
|
42
|
+
verbose?: boolean;
|
43
|
+
adapter?: LangChainAdapter;
|
44
|
+
serverManagerFactory?: (client: MCPClient) => ServerManager;
|
45
|
+
});
|
46
|
+
initialize(): Promise<void>;
|
47
|
+
private createSystemMessageFromTools;
|
48
|
+
private createAgent;
|
49
|
+
getConversationHistory(): BaseMessage[];
|
50
|
+
clearConversationHistory(): void;
|
51
|
+
private addToHistory;
|
52
|
+
getSystemMessage(): SystemMessage | null;
|
53
|
+
setSystemMessage(message: string): void;
|
54
|
+
setDisallowedTools(disallowedTools: string[]): void;
|
55
|
+
getDisallowedTools(): string[];
|
56
|
+
run(query: string, maxSteps?: number, manageConnector?: boolean, externalHistory?: BaseMessage[]): Promise<string>;
|
57
|
+
close(): Promise<void>;
|
58
|
+
}
|
59
|
+
//# sourceMappingURL=mcp_agent.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"mcp_agent.d.ts","sourceRoot":"","sources":["../../../src/agents/mcp_agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAqB,MAAM,sCAAsC,CAAA;AAChG,OAAO,KAAK,EACV,WAAW,EACZ,MAAM,0BAA0B,CAAA;AAGjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAE1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EAGL,aAAa,EACd,MAAM,0BAA0B,CAAA;AAUjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AAKnE,qBAAa,QAAQ;IACnB,OAAO,CAAC,GAAG,CAAmB;IAC9B,OAAO,CAAC,MAAM,CAAC,CAAW;IAC1B,OAAO,CAAC,UAAU,CAAiB;IACnC,OAAO,CAAC,QAAQ,CAAQ;IACxB,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,eAAe,CAAU;IACjC,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,YAAY,CAAC,CAAe;IACpC,OAAO,CAAC,4BAA4B,CAAC,CAAe;IACpD,OAAO,CAAC,sBAAsB,CAAC,CAAe;IAE9C,OAAO,CAAC,WAAW,CAAQ;IAC3B,OAAO,CAAC,mBAAmB,CAAoB;IAC/C,OAAO,CAAC,aAAa,CAA6B;IAClD,OAAO,CAAC,QAAQ,CAAiC;IACjD,OAAO,CAAC,aAAa,CAA6B;IAClD,OAAO,CAAC,KAAK,CAA8B;IAC3C,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,aAAa,CAA6B;gBAEtC,OAAO,EAAE;QACnB,GAAG,EAAE,iBAAiB,CAAA;QACtB,MAAM,CAAC,EAAE,SAAS,CAAA;QAClB,UAAU,CAAC,EAAE,aAAa,EAAE,CAAA;QAC5B,UAAU,CAAC,EAAE,MAAM,CAAA;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,cAAc,CAAC,EAAE,OAAO,CAAA;QACxB,aAAa,CAAC,EAAE,OAAO,CAAA;QACvB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;QAC5B,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;QACpC,sBAAsB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;QACtC,eAAe,CAAC,EAAE,MAAM,EAAE,CAAA;QAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAA;QAC1B,OAAO,CAAC,EAAE,OAAO,CAAA;QACjB,OAAO,CAAC,EAAE,gBAAgB,CAAA;QAC1B,oBAAoB,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,aAAa,CAAA;KAC5D;IAkCY,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;YA8D1B,4BAA4B;IAuB1C,OAAO,CAAC,WAAW;IAyBZ,sBAAsB,IAAI,WAAW,EAAE;IAIvC,wBAAwB,IAAI,IAAI;IAIvC,OAAO,CAAC,YAAY;IAKb,gBAAgB,IAAI,aAAa,GAAG,IAAI;IAIxC,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAavC,kBAAkB,CAAC,eAAe,EAAE,MAAM,EAAE,GAAG,IAAI;IAQnD,kBAAkB,IAAI,MAAM,EAAE;IAIxB,GAAG,CACd,KAAK,EAAE,MAAM,EACb,QAAQ,CAAC,EAAE,MAAM,EACjB,eAAe,UAAO,EACtB,eAAe,CAAC,EAAE,WAAW,EAAE,GAC9B,OAAO,CAAC,MAAM,CAAC;IAyJL,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAyBpC"}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import type { DynamicStructuredTool } from '@langchain/core/tools';
|
2
|
+
import { SystemMessage } from '@langchain/core/messages';
|
3
|
+
export declare function generateToolDescriptions(tools: DynamicStructuredTool[], disallowedTools?: string[]): string[];
|
4
|
+
export declare function buildSystemPromptContent(template: string, toolDescriptionLines: string[], additionalInstructions?: string): string;
|
5
|
+
export declare function createSystemMessage(tools: DynamicStructuredTool[], systemPromptTemplate: string, serverManagerTemplate: string, useServerManager: boolean, disallowedTools?: string[], userProvidedPrompt?: string, additionalInstructions?: string): SystemMessage;
|
6
|
+
//# sourceMappingURL=system_prompt_builder.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"system_prompt_builder.d.ts","sourceRoot":"","sources":["../../../../src/agents/prompts/system_prompt_builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAExD,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,qBAAqB,EAAE,EAC9B,eAAe,CAAC,EAAE,MAAM,EAAE,GACzB,MAAM,EAAE,CAcV;AAED,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,EAChB,oBAAoB,EAAE,MAAM,EAAE,EAC9B,sBAAsB,CAAC,EAAE,MAAM,GAC9B,MAAM,CAiBR;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,qBAAqB,EAAE,EAC9B,oBAAoB,EAAE,MAAM,EAC5B,qBAAqB,EAAE,MAAM,EAC7B,gBAAgB,EAAE,OAAO,EACzB,eAAe,CAAC,EAAE,MAAM,EAAE,EAC1B,kBAAkB,CAAC,EAAE,MAAM,EAC3B,sBAAsB,CAAC,EAAE,MAAM,GAC9B,aAAa,CAiBf"}
|
@@ -0,0 +1,3 @@
|
|
1
|
+
export declare const DEFAULT_SYSTEM_PROMPT_TEMPLATE = "You are a helpful AI assistant.\nYou have access to the following tools:\n\n{tool_descriptions}\n\nUse the following format:\n\nQuestion: the input question you must answer\nThought: you should always think about what to do\nAction: the action to take, should be one of the available tools\nAction Input: the input to the action\nObservation: the result of the action\n... (this Thought/Action/Action Input/Observation can repeat N times)\nThought: I now know the final answer\nFinal Answer: the final answer to the original input question";
|
2
|
+
export declare const SERVER_MANAGER_SYSTEM_PROMPT_TEMPLATE = "You are a helpful assistant designed to interact with MCP\n (Model Context Protocol) servers. You can manage connections to different servers and use the tools\n provided by the currently active server.\n\nImportant: The available tools change depending on which server is active.\nIf a request requires tools not listed below (e.g., file operations, web browsing,\n image manipulation), you MUST first connect to the appropriate server using\n 'connect_to_mcp_server'.\nUse 'list_mcp_servers' to find the relevant server if you are unsure.\nOnly after successfully connecting and seeing the new tools listed in\nthe response should you attempt to use those server-specific tools.\nBefore attempting a task that requires specific tools, you should\nensure you are connected to the correct server and aware of its\navailable tools. If unsure, use 'list_mcp_servers' to see options\nor 'get_active_mcp_server' to check the current connection.\n\nWhen you connect to a server using 'connect_to_mcp_server',\n you will be informed about the new tools that become available.\nYou can then use these server-specific tools in subsequent steps.\n\nHere are the tools *currently* available to you (this list includes server management tools and will\n change when you connect to a server):\n{tool_descriptions}\n";
|
3
|
+
//# sourceMappingURL=templates.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../../../src/agents/prompts/templates.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,8BAA8B,giBAcmB,CAAA;AAE9D,eAAO,MAAM,qCAAqC,4xCAuBjD,CAAA"}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import type { LangChainAdapter } from '../adapters/langchain_adapter.js';
|
2
|
+
import type { MCPClient } from '../client.js';
|
3
|
+
import { DynamicStructuredTool } from '@langchain/core/tools';
|
4
|
+
export declare class ServerManager {
|
5
|
+
private readonly client;
|
6
|
+
private readonly adapter;
|
7
|
+
private activeServer;
|
8
|
+
private readonly initializedServers;
|
9
|
+
private readonly serverTools;
|
10
|
+
constructor(client: MCPClient, adapter: LangChainAdapter);
|
11
|
+
initialize(): Promise<void>;
|
12
|
+
getServerManagementTools(): Promise<DynamicStructuredTool[]>;
|
13
|
+
listServers(): Promise<string>;
|
14
|
+
connectToServer(serverName: string): Promise<string>;
|
15
|
+
getActiveServer(): Promise<string>;
|
16
|
+
disconnectFromServer(): Promise<string>;
|
17
|
+
getActiveServerTools(): Promise<DynamicStructuredTool[]>;
|
18
|
+
getAllTools(): Promise<DynamicStructuredTool[]>;
|
19
|
+
private ensureSession;
|
20
|
+
private ensureToolsFetched;
|
21
|
+
}
|
22
|
+
//# sourceMappingURL=server_manager.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"server_manager.d.ts","sourceRoot":"","sources":["../../../src/agents/server_manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAY7D,qBAAa,aAAa;IAMtB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAN1B,OAAO,CAAC,YAAY,CAAsB;IAC1C,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAA8B;IACjE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA8C;gBAGvD,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,gBAAgB;IAGtC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAM3B,wBAAwB,IAAI,OAAO,CAAC,qBAAqB,EAAE,CAAC;IAsC5D,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;IA0B9B,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAiCpD,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC;IAMlC,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC;IAUvC,oBAAoB,IAAI,OAAO,CAAC,qBAAqB,EAAE,CAAC;IAIxD,WAAW,IAAI,OAAO,CAAC,qBAAqB,EAAE,CAAC;YAIvC,aAAa;YAWb,kBAAkB;CAuBjC"}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { MCPSession } from './session.js';
|
2
|
+
export declare class MCPClient {
|
3
|
+
private config;
|
4
|
+
private sessions;
|
5
|
+
activeSessions: string[];
|
6
|
+
constructor(config?: string | Record<string, any>);
|
7
|
+
static fromDict(cfg: Record<string, any>): MCPClient;
|
8
|
+
static fromConfigFile(path: string): MCPClient;
|
9
|
+
addServer(name: string, serverConfig: Record<string, any>): void;
|
10
|
+
removeServer(name: string): void;
|
11
|
+
getServerNames(): string[];
|
12
|
+
saveConfig(filepath: string): void;
|
13
|
+
createSession(serverName: string, autoInitialize?: boolean): Promise<MCPSession>;
|
14
|
+
createAllSessions(autoInitialize?: boolean): Promise<Record<string, MCPSession>>;
|
15
|
+
getSession(serverName: string): MCPSession;
|
16
|
+
getAllActiveSessions(): Record<string, MCPSession>;
|
17
|
+
closeSession(serverName: string): Promise<void>;
|
18
|
+
closeAllSessions(): Promise<void>;
|
19
|
+
}
|
20
|
+
//# sourceMappingURL=client.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAA0B;IACxC,OAAO,CAAC,QAAQ,CAAiC;IAC1C,cAAc,EAAE,MAAM,EAAE,CAAK;gBAExB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;WAWnC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS;WAI7C,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS;IAI9C,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IAKhE,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAOhC,cAAc,IAAI,MAAM,EAAE;IAI1B,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAQ5B,aAAa,CACxB,UAAU,EAAE,MAAM,EAClB,cAAc,UAAO,GACpB,OAAO,CAAC,UAAU,CAAC;IAwBT,iBAAiB,CAC5B,cAAc,UAAO,GACpB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAc/B,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU;IAQ1C,oBAAoB,IAAI,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;IAM5C,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmB/C,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;CAqB/C"}
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import type { BaseConnector } from './connectors/base.js';
|
2
|
+
export declare function loadConfigFile(filepath: string): Record<string, any>;
|
3
|
+
export declare function createConnectorFromConfig(serverConfig: Record<string, any>): BaseConnector;
|
4
|
+
//# sourceMappingURL=config.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAMzD,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAGpE;AAED,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAChC,aAAa,CAwBf"}
|
@@ -0,0 +1,79 @@
|
|
1
|
+
import type { Client, ClientOptions } from '@modelcontextprotocol/sdk/client/index.js';
|
2
|
+
import type { RequestOptions } from '@modelcontextprotocol/sdk/shared/protocol.js';
|
3
|
+
import type { CallToolResult, Tool } from '@modelcontextprotocol/sdk/types.js';
|
4
|
+
import type { ConnectionManager } from '../task_managers/base.js';
|
5
|
+
export interface ConnectorInitOptions {
|
6
|
+
/**
|
7
|
+
* Options forwarded to the underlying MCP `Client` instance.
|
8
|
+
*/
|
9
|
+
clientOptions?: ClientOptions;
|
10
|
+
/**
|
11
|
+
* Arbitrary request options (timeouts, cancellation, etc.) used by helper
|
12
|
+
* methods when they issue SDK requests. Can be overridden per‑call.
|
13
|
+
*/
|
14
|
+
defaultRequestOptions?: RequestOptions;
|
15
|
+
}
|
16
|
+
/**
|
17
|
+
* Base class for MCP connectors.
|
18
|
+
*/
|
19
|
+
export declare abstract class BaseConnector {
|
20
|
+
protected client: Client | null;
|
21
|
+
protected connectionManager: ConnectionManager<any> | null;
|
22
|
+
protected toolsCache: Tool[] | null;
|
23
|
+
protected connected: boolean;
|
24
|
+
protected readonly opts: ConnectorInitOptions;
|
25
|
+
constructor(opts?: ConnectorInitOptions);
|
26
|
+
/** Establish the connection and create the SDK client. */
|
27
|
+
abstract connect(): Promise<void>;
|
28
|
+
/** Disconnect and release resources. */
|
29
|
+
disconnect(): Promise<void>;
|
30
|
+
/** Check if the client is connected */
|
31
|
+
get isClientConnected(): boolean;
|
32
|
+
/**
|
33
|
+
* Initialise the MCP session **after** `connect()` has succeeded.
|
34
|
+
*
|
35
|
+
* In the SDK, `Client.connect(transport)` automatically performs the
|
36
|
+
* protocol‑level `initialize` handshake, so we only need to cache the list of
|
37
|
+
* tools and expose some server info.
|
38
|
+
*/
|
39
|
+
initialize(defaultRequestOptions?: RequestOptions): Promise<ReturnType<Client['getServerCapabilities']>>;
|
40
|
+
/** Lazily expose the cached tools list. */
|
41
|
+
get tools(): Tool[];
|
42
|
+
/** Call a tool on the server. */
|
43
|
+
callTool(name: string, args: Record<string, any>, options?: RequestOptions): Promise<CallToolResult>;
|
44
|
+
/** List resources from the server. */
|
45
|
+
listResources(options?: RequestOptions): Promise<import("zod").objectOutputType<{
|
46
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
47
|
+
} & {
|
48
|
+
nextCursor: import("zod").ZodOptional<import("zod").ZodString>;
|
49
|
+
} & {
|
50
|
+
resources: import("zod").ZodArray<import("zod").ZodObject<{
|
51
|
+
uri: import("zod").ZodString;
|
52
|
+
name: import("zod").ZodString;
|
53
|
+
description: import("zod").ZodOptional<import("zod").ZodString>;
|
54
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
55
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
56
|
+
uri: import("zod").ZodString;
|
57
|
+
name: import("zod").ZodString;
|
58
|
+
description: import("zod").ZodOptional<import("zod").ZodString>;
|
59
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
60
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
61
|
+
uri: import("zod").ZodString;
|
62
|
+
name: import("zod").ZodString;
|
63
|
+
description: import("zod").ZodOptional<import("zod").ZodString>;
|
64
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
65
|
+
}, import("zod").ZodTypeAny, "passthrough">>, "many">;
|
66
|
+
}, import("zod").ZodTypeAny, "passthrough">>;
|
67
|
+
/** Read a resource by URI. */
|
68
|
+
readResource(uri: string, options?: RequestOptions): Promise<{
|
69
|
+
content: unknown;
|
70
|
+
mimeType: unknown;
|
71
|
+
}>;
|
72
|
+
/** Send a raw request through the client. */
|
73
|
+
request(method: string, params?: Record<string, any> | null, options?: RequestOptions): Promise<any>;
|
74
|
+
/**
|
75
|
+
* Helper to tear down the client & connection manager safely.
|
76
|
+
*/
|
77
|
+
protected cleanupResources(): Promise<void>;
|
78
|
+
}
|
79
|
+
//# sourceMappingURL=base.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/connectors/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAA;AACtF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAA;AAClF,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAA;AAC9E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAGjE,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B;;;OAGG;IACH,qBAAqB,CAAC,EAAE,cAAc,CAAA;CACvC;AAED;;GAEG;AACH,8BAAsB,aAAa;IACjC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAO;IACtC,SAAS,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,GAAG,CAAC,GAAG,IAAI,CAAO;IACjE,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,GAAG,IAAI,CAAO;IAC1C,SAAS,CAAC,SAAS,UAAQ;IAC3B,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAA;gBAEjC,IAAI,GAAE,oBAAyB;IAI3C,0DAA0D;IAC1D,QAAQ,CAAC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAEjC,wCAAwC;IAClC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAYjC,uCAAuC;IACvC,IAAI,iBAAiB,IAAI,OAAO,CAE/B;IAED;;;;;;OAMG;IACG,UAAU,CAAC,qBAAqB,GAAE,cAAsD,GAAG,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC,CAAC;IAkBrJ,2CAA2C;IAC3C,IAAI,KAAK,IAAI,IAAI,EAAE,CAKlB;IAED,iCAAiC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;IAW1G,sCAAsC;IAChC,aAAa,CAAC,OAAO,CAAC,EAAE,cAAc;;;;;;;;;;;;;;;;;;;;;;IAS5C,8BAA8B;IACxB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc;;;;IAUxD,6CAA6C;IACvC,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAW,EAAE,OAAO,CAAC,EAAE,cAAc;IASjG;;OAEG;cACa,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;CAsClD"}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import type { ConnectorInitOptions } from './base.js';
|
2
|
+
import { BaseConnector } from './base.js';
|
3
|
+
export interface HttpConnectorOptions extends ConnectorInitOptions {
|
4
|
+
authToken?: string;
|
5
|
+
headers?: Record<string, string>;
|
6
|
+
timeout?: number;
|
7
|
+
sseReadTimeout?: number;
|
8
|
+
clientInfo?: {
|
9
|
+
name: string;
|
10
|
+
version: string;
|
11
|
+
};
|
12
|
+
}
|
13
|
+
export declare class HttpConnector extends BaseConnector {
|
14
|
+
private readonly baseUrl;
|
15
|
+
private readonly headers;
|
16
|
+
private readonly timeout;
|
17
|
+
private readonly sseReadTimeout;
|
18
|
+
private readonly clientInfo;
|
19
|
+
constructor(baseUrl: string, opts?: HttpConnectorOptions);
|
20
|
+
/** Establish connection to the MCP implementation via SSE. */
|
21
|
+
connect(): Promise<void>;
|
22
|
+
}
|
23
|
+
//# sourceMappingURL=http.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/connectors/http.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAIrD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAEzC,MAAM,WAAW,oBAAqB,SAAQ,oBAAoB;IAChE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,UAAU,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAA;CAC/C;AAED,qBAAa,aAAc,SAAQ,aAAa;IAC9C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAQ;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAwB;IAChD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAQ;IAChC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAQ;IACvC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAmC;gBAElD,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,oBAAyB;IAc5D,8DAA8D;IACxD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAoC/B"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/connectors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA"}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import type { Writable } from 'node:stream';
|
2
|
+
import type { ConnectorInitOptions } from './base.js';
|
3
|
+
import { BaseConnector } from './base.js';
|
4
|
+
export interface StdioConnectorOptions extends ConnectorInitOptions {
|
5
|
+
clientInfo?: {
|
6
|
+
name: string;
|
7
|
+
version: string;
|
8
|
+
};
|
9
|
+
}
|
10
|
+
export declare class StdioConnector extends BaseConnector {
|
11
|
+
private readonly command;
|
12
|
+
private readonly args;
|
13
|
+
private readonly env?;
|
14
|
+
private readonly errlog;
|
15
|
+
private readonly clientInfo;
|
16
|
+
constructor({ command, args, env, errlog, ...rest }?: {
|
17
|
+
command?: string;
|
18
|
+
args?: string[];
|
19
|
+
env?: Record<string, string>;
|
20
|
+
errlog?: Writable;
|
21
|
+
} & StdioConnectorOptions);
|
22
|
+
/** Establish connection to the MCP implementation. */
|
23
|
+
connect(): Promise<void>;
|
24
|
+
}
|
25
|
+
//# sourceMappingURL=stdio.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["../../../src/connectors/stdio.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAE3C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAMrD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAEzC,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB;IACjE,UAAU,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAA;CAC/C;AAED,qBAAa,cAAe,SAAQ,aAAa;IAC/C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAQ;IAChC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAU;IAC/B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAwB;IAC7C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAU;IACjC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAmC;gBAG5D,EACE,OAAe,EACf,IAAS,EACT,GAAG,EACH,MAAuB,EACvB,GAAG,IAAI,EACR,GAAE;QACD,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;QACf,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QAC5B,MAAM,CAAC,EAAE,QAAQ,CAAA;KAClB,GAAG,qBAA0B;IAWhC,sDAAsD;IAChD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAiC/B"}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import type { RequestOptions } from '@modelcontextprotocol/sdk/shared/protocol.js';
|
2
|
+
import type { CallToolResult, Tool } from '@modelcontextprotocol/sdk/types.js';
|
3
|
+
import { WebSocketConnectionManager } from '../task_managers/websocket.js';
|
4
|
+
import { BaseConnector } from './base.js';
|
5
|
+
export interface WebSocketConnectorOptions {
|
6
|
+
authToken?: string;
|
7
|
+
headers?: Record<string, string>;
|
8
|
+
}
|
9
|
+
export declare class WebSocketConnector extends BaseConnector {
|
10
|
+
private readonly url;
|
11
|
+
private readonly headers;
|
12
|
+
protected connectionManager: WebSocketConnectionManager | null;
|
13
|
+
private ws;
|
14
|
+
private receiverTask;
|
15
|
+
private pending;
|
16
|
+
protected toolsCache: Tool[] | null;
|
17
|
+
constructor(url: string, opts?: WebSocketConnectorOptions);
|
18
|
+
connect(): Promise<void>;
|
19
|
+
disconnect(): Promise<void>;
|
20
|
+
private sendRequest;
|
21
|
+
private receiveLoop;
|
22
|
+
private rejectAll;
|
23
|
+
initialize(): Promise<Record<string, any>>;
|
24
|
+
listTools(): Promise<Tool[]>;
|
25
|
+
callTool(name: string, args: Record<string, any>, options?: RequestOptions): Promise<CallToolResult>;
|
26
|
+
listResources(options?: RequestOptions): Promise<any>;
|
27
|
+
readResource(uri: string, options?: RequestOptions): Promise<{
|
28
|
+
content: ArrayBuffer;
|
29
|
+
mimeType: string;
|
30
|
+
}>;
|
31
|
+
request(method: string, params?: Record<string, any> | null, options?: RequestOptions): Promise<any>;
|
32
|
+
get tools(): Tool[];
|
33
|
+
protected cleanupResources(): Promise<void>;
|
34
|
+
}
|
35
|
+
//# sourceMappingURL=websocket.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"websocket.d.ts","sourceRoot":"","sources":["../../../src/connectors/websocket.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAA;AAClF,OAAO,KAAK,EACV,cAAc,EACd,IAAI,EACL,MAAM,oCAAoC,CAAA;AAG3C,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAA;AAE1E,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAEzC,MAAM,WAAW,yBAAyB;IACxC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACjC;AAED,qBAAa,kBAAmB,SAAQ,aAAa;IACnD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAQ;IAC5B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAwB;IAEhD,SAAS,CAAC,iBAAiB,EAAE,0BAA0B,GAAG,IAAI,CAAO;IACrE,OAAO,CAAC,EAAE,CAAkD;IAC5D,OAAO,CAAC,YAAY,CAA6B;IACjD,OAAO,CAAC,OAAO,CACF;IAEb,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,GAAG,IAAI,CAAO;gBAE9B,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE,yBAA8B;IAQvD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAqBxB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAUjC,OAAO,CAAC,WAAW;YAiBL,WAAW;IAyCzB,OAAO,CAAC,SAAS;IAKX,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAS1C,SAAS,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;IAK5B,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;IAIpG,aAAa,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC;IAKrD,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,WAAW,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAKxG,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAW,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC;IAIhH,IAAI,KAAK,IAAI,IAAI,EAAE,CAIlB;cAEe,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;CAkBlD"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import type { Logger as WinstonLogger } from 'winston';
|
2
|
+
export declare class Logger {
|
3
|
+
private static loggers;
|
4
|
+
static getLogger(name?: string): WinstonLogger;
|
5
|
+
static configure(level?: string, toConsole?: boolean, toFile?: string): void;
|
6
|
+
static setDebug(debugLevel?: number): void;
|
7
|
+
}
|
8
|
+
export declare const logger: WinstonLogger;
|
9
|
+
//# sourceMappingURL=logging.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../src/logging.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,SAAS,CAAA;AAqBtD,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAAC,OAAO,CAAoC;WAE5C,SAAS,CAAC,IAAI,GAAE,MAAkB,GAAG,aAAa;WAelD,SAAS,CACrB,KAAK,CAAC,EAAE,MAAM,EACd,SAAS,GAAE,OAAc,EACzB,MAAM,CAAC,EAAE,MAAM,GACd,IAAI;WA0BO,QAAQ,CAAC,UAAU,GAAE,MAAU,GAAG,IAAI;CAarD;AAID,eAAO,MAAM,MAAM,eAAqB,CAAA"}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import type { BaseConnector } from './connectors/base.js';
|
2
|
+
export declare class MCPSession {
|
3
|
+
readonly connector: BaseConnector;
|
4
|
+
private autoConnect;
|
5
|
+
private _sessionInfo;
|
6
|
+
private _tools;
|
7
|
+
constructor(connector: BaseConnector, autoConnect?: boolean);
|
8
|
+
open(): Promise<this>;
|
9
|
+
close(): Promise<void>;
|
10
|
+
connect(): Promise<void>;
|
11
|
+
disconnect(): Promise<void>;
|
12
|
+
initialize(): Promise<Record<string, any>>;
|
13
|
+
get isConnected(): boolean;
|
14
|
+
get sessionInfo(): Record<string, any> | null;
|
15
|
+
get tools(): Record<string, any>[];
|
16
|
+
discoverTools(): Promise<Record<string, any>[]>;
|
17
|
+
callTool(name: string, args: Record<string, any>): Promise<any>;
|
18
|
+
}
|
19
|
+
//# sourceMappingURL=session.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAGzD,qBAAa,UAAU;IACrB,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAA;IACjC,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,YAAY,CAAmC;IACvD,OAAO,CAAC,MAAM,CAA4B;gBAE9B,SAAS,EAAE,aAAa,EAAE,WAAW,UAAO;IAKlD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAKrB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAItB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAIxB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3B,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAUhD,IAAI,WAAW,IAAI,OAAO,CAEzB;IAED,IAAI,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAE5C;IAED,IAAI,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAEjC;IAEK,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;IAK/C,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC;CAOtE"}
|
@@ -0,0 +1,56 @@
|
|
1
|
+
export type ConnectionType<T = any> = T;
|
2
|
+
export declare abstract class ConnectionManager<T = any> {
|
3
|
+
private _readyPromise;
|
4
|
+
private _readyResolver;
|
5
|
+
private _donePromise;
|
6
|
+
private _doneResolver;
|
7
|
+
private _exception;
|
8
|
+
private _connection;
|
9
|
+
private _task;
|
10
|
+
private _abortController;
|
11
|
+
constructor();
|
12
|
+
/**
|
13
|
+
* Establish the connection.
|
14
|
+
*
|
15
|
+
* This method should be implemented by subclasses to establish the specific
|
16
|
+
* type of connection needed.
|
17
|
+
*
|
18
|
+
* @returns The established connection.
|
19
|
+
* @throws If the connection cannot be established.
|
20
|
+
*/
|
21
|
+
protected abstract establishConnection(): Promise<T>;
|
22
|
+
/**
|
23
|
+
* Close the connection.
|
24
|
+
*
|
25
|
+
* This method should be implemented by subclasses to close the specific type
|
26
|
+
* of connection.
|
27
|
+
*
|
28
|
+
* @param connection The connection to close.
|
29
|
+
*/
|
30
|
+
protected abstract closeConnection(connection: T): Promise<void>;
|
31
|
+
/**
|
32
|
+
* Start the connection manager and establish a connection.
|
33
|
+
*
|
34
|
+
* @returns The established connection.
|
35
|
+
* @throws If the connection cannot be established.
|
36
|
+
*/
|
37
|
+
start(): Promise<T>;
|
38
|
+
/**
|
39
|
+
* Stop the connection manager and close the connection.
|
40
|
+
*/
|
41
|
+
stop(): Promise<void>;
|
42
|
+
/**
|
43
|
+
* Reset all internal state.
|
44
|
+
*/
|
45
|
+
private reset;
|
46
|
+
/**
|
47
|
+
* The background task responsible for establishing and maintaining the
|
48
|
+
* connection until it is cancelled.
|
49
|
+
*/
|
50
|
+
private connectionTask;
|
51
|
+
/**
|
52
|
+
* Helper that returns a promise which resolves when the abort signal fires.
|
53
|
+
*/
|
54
|
+
private waitForAbort;
|
55
|
+
}
|
56
|
+
//# sourceMappingURL=base.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/task_managers/base.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,cAAc,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,CAAA;AAEvC,8BAAsB,iBAAiB,CAAC,CAAC,GAAG,GAAG;IAC7C,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,cAAc,CAAa;IAEnC,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,aAAa,CAAa;IAElC,OAAO,CAAC,UAAU,CAAqB;IACvC,OAAO,CAAC,WAAW,CAAiB;IACpC,OAAO,CAAC,KAAK,CAA6B;IAC1C,OAAO,CAAC,gBAAgB,CAA+B;;IAMvD;;;;;;;;OAQG;IACH,SAAS,CAAC,QAAQ,CAAC,mBAAmB,IAAI,OAAO,CAAC,CAAC,CAAC;IAEpD;;;;;;;OAOG;IACH,SAAS,CAAC,QAAQ,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAEhE;;;;;OAKG;IACG,KAAK,IAAI,OAAO,CAAC,CAAC,CAAC;IAwBzB;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAwB3B;;OAEG;IACH,OAAO,CAAC,KAAK;IASb;;;OAGG;YACW,cAAc;IAsC5B;;OAEG;YACW,YAAY;CAqB3B"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/task_managers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AACnD,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAA"}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import type { SSEClientTransportOptions } from '@modelcontextprotocol/sdk/client/sse.js';
|
2
|
+
import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js';
|
3
|
+
import { ConnectionManager } from './base.js';
|
4
|
+
export declare class SseConnectionManager extends ConnectionManager<SSEClientTransport> {
|
5
|
+
private readonly url;
|
6
|
+
private readonly opts?;
|
7
|
+
private _transport;
|
8
|
+
/**
|
9
|
+
* Create an SSE connection manager.
|
10
|
+
*
|
11
|
+
* @param url The SSE endpoint URL.
|
12
|
+
* @param opts Optional transport options (auth, headers, etc.).
|
13
|
+
*/
|
14
|
+
constructor(url: string | URL, opts?: SSEClientTransportOptions);
|
15
|
+
/**
|
16
|
+
* Spawn a new `SSEClientTransport` and start the connection.
|
17
|
+
*/
|
18
|
+
protected establishConnection(): Promise<SSEClientTransport>;
|
19
|
+
/**
|
20
|
+
* Close the underlying transport and clean up resources.
|
21
|
+
*/
|
22
|
+
protected closeConnection(_connection: SSEClientTransport): Promise<void>;
|
23
|
+
}
|
24
|
+
//# sourceMappingURL=sse.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"sse.d.ts","sourceRoot":"","sources":["../../../src/task_managers/sse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAA;AACxF,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAA;AAE5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAE7C,qBAAa,oBAAqB,SAAQ,iBAAiB,CAAC,kBAAkB,CAAC;IAC7E,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAK;IACzB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAA2B;IACjD,OAAO,CAAC,UAAU,CAAkC;IAEpD;;;;;OAKG;gBACS,GAAG,EAAE,MAAM,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,yBAAyB;IAM/D;;OAEG;cACa,mBAAmB,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAQlE;;OAEG;cACa,eAAe,CAAC,WAAW,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;CAahF"}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import type { StdioServerParameters } from '@modelcontextprotocol/sdk/client/stdio.js';
|
2
|
+
import type { Writable } from 'node:stream';
|
3
|
+
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
|
4
|
+
import { ConnectionManager } from './base.js';
|
5
|
+
export declare class StdioConnectionManager extends ConnectionManager<StdioClientTransport> {
|
6
|
+
private readonly serverParams;
|
7
|
+
private readonly errlog;
|
8
|
+
private _transport;
|
9
|
+
/**
|
10
|
+
* Create a new stdio connection manager.
|
11
|
+
*
|
12
|
+
* @param serverParams Parameters for the stdio server process.
|
13
|
+
* @param errlog Stream to which the server's stderr should be piped.
|
14
|
+
* Defaults to `process.stderr`.
|
15
|
+
*/
|
16
|
+
constructor(serverParams: StdioServerParameters, errlog?: Writable);
|
17
|
+
/**
|
18
|
+
* Establish the stdio connection by spawning the server process and starting
|
19
|
+
* the SDK's transport. Returns the live `StdioClientTransport` instance.
|
20
|
+
*/
|
21
|
+
protected establishConnection(): Promise<StdioClientTransport>;
|
22
|
+
/**
|
23
|
+
* Close the stdio connection, making sure the transport cleans up the child
|
24
|
+
* process and associated resources.
|
25
|
+
*/
|
26
|
+
protected closeConnection(_connection: StdioClientTransport): Promise<void>;
|
27
|
+
}
|
28
|
+
//# sourceMappingURL=stdio.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["../../../src/task_managers/stdio.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2CAA2C,CAAA;AACtF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAEhF,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAE7C,qBAAa,sBAAuB,SAAQ,iBAAiB,CAAC,oBAAoB,CAAC;IACjF,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAuB;IACpD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAU;IACjC,OAAO,CAAC,UAAU,CAAoC;IAEtD;;;;;;OAMG;gBACS,YAAY,EAAE,qBAAqB,EAAE,MAAM,GAAE,QAAyB;IAMlF;;;OAGG;cACa,mBAAmB,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAcpE;;;OAGG;cACa,eAAe,CAAC,WAAW,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;CAalF"}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import WS from 'ws';
|
2
|
+
import { ConnectionManager } from './base.js';
|
3
|
+
export type IWebSocket = WS;
|
4
|
+
export declare class WebSocketConnectionManager extends ConnectionManager<IWebSocket> {
|
5
|
+
private readonly url;
|
6
|
+
private readonly headers;
|
7
|
+
private _ws;
|
8
|
+
/**
|
9
|
+
* @param url The WebSocket URL to connect to.
|
10
|
+
* @param headers Optional headers to include in the connection handshake.
|
11
|
+
*/
|
12
|
+
constructor(url: string, headers?: Record<string, string>);
|
13
|
+
/** Establish a WebSocket connection and wait until it is open. */
|
14
|
+
protected establishConnection(): Promise<IWebSocket>;
|
15
|
+
/** Cleanly close the WebSocket connection. */
|
16
|
+
protected closeConnection(connection: IWebSocket): Promise<void>;
|
17
|
+
}
|
18
|
+
//# sourceMappingURL=websocket.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"websocket.d.ts","sourceRoot":"","sources":["../../../src/task_managers/websocket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAA;AAEnB,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAE7C,MAAM,MAAM,UAAU,GAAG,EAAE,CAAA;AAE3B,qBAAa,0BAA2B,SAAQ,iBAAiB,CAAC,UAAU,CAAC;IAC3E,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAQ;IAC5B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAwB;IAChD,OAAO,CAAC,GAAG,CAA0B;IAErC;;;OAGG;gBACS,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM;IAM7D,kEAAkE;cAClD,mBAAmB,IAAI,OAAO,CAAC,UAAU,CAAC;IAgC1D,8CAA8C;cAC9B,eAAe,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;CA0BvE"}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "mcp-use",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.0.
|
4
|
+
"version": "0.0.2",
|
5
5
|
"description": "A utility library for integrating Model Context Protocol (MCP) with LangChain, Zod, and related tools. Provides helpers for schema conversion, event streaming, and SDK usage.",
|
6
6
|
"author": "Zane",
|
7
7
|
"license": "MIT",
|
@@ -41,7 +41,7 @@
|
|
41
41
|
"registry": "https://registry.npmjs.org"
|
42
42
|
},
|
43
43
|
"scripts": {
|
44
|
-
"build": "tsc && shx chmod +x dist/*.js",
|
44
|
+
"build": "rm -rf dist && tsc && shx chmod +x dist/*.js",
|
45
45
|
"watch": "tsc --watch",
|
46
46
|
"start": "node dist/index.js",
|
47
47
|
"prepublishOnly": "pnpm run build",
|