mcp-use 0.0.2 → 0.0.4
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
<h1 align="center">Unified MCP Client Library</h1>
|
2
2
|
|
3
|
-
[](https://www.npmjs.com/package/mcp-use)
|
4
|
+
[](https://www.npmjs.com/package/mcp-use)
|
5
5
|
[](https://github.com/zandko/mcp-use/blob/main/LICENSE)
|
6
6
|
[](https://eslint.org)
|
7
7
|
[](https://github.com/zandko/mcp-use/stargazers)
|
@@ -28,6 +28,11 @@
|
|
28
28
|
|
29
29
|
## 🚀 Quick Start
|
30
30
|
|
31
|
+
### Requirements
|
32
|
+
|
33
|
+
- Node.js 22.0.0 or higher
|
34
|
+
- npm, yarn, or pnpm (examples use pnpm)
|
35
|
+
|
31
36
|
### Installation
|
32
37
|
|
33
38
|
```bash
|
@@ -125,6 +130,22 @@ const agent = new MCPAgent({
|
|
125
130
|
})
|
126
131
|
```
|
127
132
|
|
133
|
+
## 👥 Contributors
|
134
|
+
|
135
|
+
<table>
|
136
|
+
<tr>
|
137
|
+
<td align="center" style="word-wrap: break-word; width: 150.0; height: 150.0">
|
138
|
+
<a href=https://github.com/zandko>
|
139
|
+
<img src=https://avatars.githubusercontent.com/u/37948383?v=4 width="100;" style="border-radius:50%;align-items:center;justify-content:center;overflow:hidden;padding-top:10px" alt=Zane/>
|
140
|
+
<br />
|
141
|
+
<sub style="font-size:14px"><b>Zane</b></sub>
|
142
|
+
</a>
|
143
|
+
</td>
|
144
|
+
</tr>
|
145
|
+
</table>
|
146
|
+
|
147
|
+
<!-- Contributors section will be automatically generated here -->
|
148
|
+
|
128
149
|
## 📜 License
|
129
150
|
|
130
151
|
MIT © [Zane](https://github.com/zandko)
|
package/dist/index.js
CHANGED
File without changes
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import type { RequestOptions } from '@modelcontextprotocol/sdk/shared/protocol.js';
|
2
1
|
import type { CallToolResult, Tool } from '@modelcontextprotocol/sdk/types.js';
|
3
2
|
import { WebSocketConnectionManager } from '../task_managers/websocket.js';
|
4
3
|
import { BaseConnector } from './base.js';
|
@@ -22,13 +21,13 @@ export declare class WebSocketConnector extends BaseConnector {
|
|
22
21
|
private rejectAll;
|
23
22
|
initialize(): Promise<Record<string, any>>;
|
24
23
|
listTools(): Promise<Tool[]>;
|
25
|
-
callTool(name: string, args: Record<string, any
|
26
|
-
listResources(
|
27
|
-
readResource(uri: string
|
24
|
+
callTool(name: string, args: Record<string, any>): Promise<CallToolResult>;
|
25
|
+
listResources(): Promise<any>;
|
26
|
+
readResource(uri: string): Promise<{
|
28
27
|
content: ArrayBuffer;
|
29
28
|
mimeType: string;
|
30
29
|
}>;
|
31
|
-
request(method: string, params?: Record<string, any> | null
|
30
|
+
request(method: string, params?: Record<string, any> | null): Promise<any>;
|
32
31
|
get tools(): Tool[];
|
33
32
|
protected cleanupResources(): Promise<void>;
|
34
33
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"websocket.d.ts","sourceRoot":"","sources":["../../../src/connectors/websocket.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
1
|
+
{"version":3,"file":"websocket.d.ts","sourceRoot":"","sources":["../../../src/connectors/websocket.ts"],"names":[],"mappings":"AAAA,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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
73
|
+
logger.warn('Received non‑JSON frame', e);
|
74
74
|
return;
|
75
75
|
}
|
76
76
|
const id = data.id;
|
@@ -114,18 +114,18 @@ export class WebSocketConnector extends BaseConnector {
|
|
114
114
|
const res = await this.sendRequest('tools/list');
|
115
115
|
return res.tools ?? [];
|
116
116
|
}
|
117
|
-
async callTool(name, args
|
117
|
+
async callTool(name, args) {
|
118
118
|
return await this.sendRequest('tools/call', { name, arguments: args });
|
119
119
|
}
|
120
|
-
async listResources(
|
120
|
+
async listResources() {
|
121
121
|
const resources = await this.sendRequest('resources/list');
|
122
122
|
return { resources: Array.isArray(resources) ? resources : [] };
|
123
123
|
}
|
124
|
-
async readResource(uri
|
124
|
+
async readResource(uri) {
|
125
125
|
const res = await this.sendRequest('resources/read', { uri });
|
126
126
|
return { content: res.content, mimeType: res.mimeType };
|
127
127
|
}
|
128
|
-
async request(method, params = null
|
128
|
+
async request(method, params = null) {
|
129
129
|
return await this.sendRequest(method, params);
|
130
130
|
}
|
131
131
|
get tools() {
|
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.4",
|
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",
|
@@ -37,20 +37,12 @@
|
|
37
37
|
"files": [
|
38
38
|
"dist"
|
39
39
|
],
|
40
|
+
"engines": {
|
41
|
+
"node": ">=22.0.0"
|
42
|
+
},
|
40
43
|
"publishConfig": {
|
41
44
|
"registry": "https://registry.npmjs.org"
|
42
45
|
},
|
43
|
-
"scripts": {
|
44
|
-
"build": "rm -rf dist && tsc && shx chmod +x dist/*.js",
|
45
|
-
"watch": "tsc --watch",
|
46
|
-
"start": "node dist/index.js",
|
47
|
-
"prepublishOnly": "pnpm run build",
|
48
|
-
"lint": "eslint",
|
49
|
-
"lint:fix": "eslint --fix",
|
50
|
-
"release": "npm version patch && git push --follow-tags",
|
51
|
-
"release:minor": "npm version minor && git push --follow-tags",
|
52
|
-
"release:major": "npm version major && git push --follow-tags"
|
53
|
-
},
|
54
46
|
"dependencies": {
|
55
47
|
"@dmitryrechkin/json-schema-to-zod": "^1.0.1",
|
56
48
|
"@langchain/community": "0.3.41",
|
@@ -71,5 +63,15 @@
|
|
71
63
|
"eslint-plugin-format": "^1.0.1",
|
72
64
|
"shx": "^0.4.0",
|
73
65
|
"typescript": "^5.8.3"
|
66
|
+
},
|
67
|
+
"scripts": {
|
68
|
+
"build": "rm -rf dist && tsc && shx chmod +x dist/*.js",
|
69
|
+
"watch": "tsc --watch",
|
70
|
+
"start": "node dist/index.js",
|
71
|
+
"lint": "eslint",
|
72
|
+
"lint:fix": "eslint --fix",
|
73
|
+
"release": "npm version patch && git push --follow-tags",
|
74
|
+
"release:minor": "npm version minor && git push --follow-tags",
|
75
|
+
"release:major": "npm version major && git push --follow-tags"
|
74
76
|
}
|
75
|
-
}
|
77
|
+
}
|