@x-otto/mcp 0.1.0-alpha.43 → 0.3.0-beta.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/dist/build-revision.json +4 -0
- package/dist/index.d.ts +220 -843
- package/dist/index.js +4992 -4
- package/package.json +12 -18
- package/README.md +0 -63
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@x-otto/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0-beta.0",
|
|
4
|
+
"description": "MCP 客户端:JSON-RPC/传输/工具适配/OAuth(协议层不认识 agent,装配归 assembly/)",
|
|
4
5
|
"files": [
|
|
5
6
|
"dist"
|
|
6
7
|
],
|
|
@@ -14,24 +15,17 @@
|
|
|
14
15
|
}
|
|
15
16
|
},
|
|
16
17
|
"dependencies": {
|
|
17
|
-
"
|
|
18
|
-
"@x-otto/
|
|
19
|
-
"@x-otto/
|
|
20
|
-
"@x-otto/
|
|
21
|
-
"@x-otto/
|
|
18
|
+
"@x-otto/atomic-fs": "^0.3.0-beta.0",
|
|
19
|
+
"@x-otto/auth-store": "^0.3.0-beta.0",
|
|
20
|
+
"@x-otto/env": "^0.3.0-beta.0",
|
|
21
|
+
"@x-otto/i18n": "^0.3.0-beta.0",
|
|
22
|
+
"@x-otto/kernel": "^0.3.0-beta.0",
|
|
23
|
+
"@x-otto/shared": "^0.3.0-beta.0",
|
|
24
|
+
"@x-otto/tool-schema": "^0.3.0-beta.0",
|
|
25
|
+
"@x-otto/universal": "^0.3.0-beta.0"
|
|
22
26
|
},
|
|
23
|
-
"devDependencies": {
|
|
24
|
-
"@x-otto/runtime": "0.1.0-alpha.43"
|
|
25
|
-
},
|
|
26
|
-
"private": false,
|
|
27
27
|
"publishConfig": {
|
|
28
28
|
"access": "public",
|
|
29
|
-
"
|
|
30
|
-
"tag": "alpha"
|
|
31
|
-
},
|
|
32
|
-
"scripts": {
|
|
33
|
-
"build": "tsdown",
|
|
34
|
-
"dev": "tsdown --watch",
|
|
35
|
-
"typecheck": "tsc --noEmit"
|
|
29
|
+
"tag": "beta"
|
|
36
30
|
}
|
|
37
|
-
}
|
|
31
|
+
}
|
package/README.md
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
# @x-otto/mcp
|
|
2
|
-
|
|
3
|
-
## Module Purpose
|
|
4
|
-
|
|
5
|
-
Implements the MCP (Model Context Protocol) client and server, supporting cross-process interaction for tools/resources/prompts, with dual Stdio and SSE transport layers.
|
|
6
|
-
|
|
7
|
-
## Core Features
|
|
8
|
-
|
|
9
|
-
| Module | Function |
|
|
10
|
-
| ---------------- | ------------------------------------------------- |
|
|
11
|
-
| McpClient | MCP client (callTool / readResource / getPrompt) |
|
|
12
|
-
| McpManager | Multi-server lifecycle management + tool/resource aggregation |
|
|
13
|
-
| StdioTransport | Child-process stdin/stdout transport |
|
|
14
|
-
| SseTransport | HTTP SSE transport + reconnection |
|
|
15
|
-
| McpToolAdapter | MCP tool → AgentTool adaptation (JSON Schema → Zod) |
|
|
16
|
-
|
|
17
|
-
## Installation
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
pnpm add @x-otto/mcp
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Quick Start
|
|
24
|
-
|
|
25
|
-
```ts
|
|
26
|
-
import { McpManager } from '@x-otto/mcp'
|
|
27
|
-
|
|
28
|
-
const manager = new McpManager()
|
|
29
|
-
await manager.connectAll({
|
|
30
|
-
'my-server': { type: 'stdio', command: 'node', args: ['server.js'] },
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
const tools = manager.getAllTools() // MCP tool → AgentTool adaptation
|
|
34
|
-
const client = manager.getClient('my-server')
|
|
35
|
-
const result = await client?.callTool({ name: 'tool-name', arguments: { key: 'value' } })
|
|
36
|
-
const prompt = await client?.getPrompt('greeting', { name: 'World' })
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## Directory Overview
|
|
40
|
-
|
|
41
|
-
```
|
|
42
|
-
src/
|
|
43
|
-
types.ts # core types
|
|
44
|
-
mcp-client.ts # MCP client
|
|
45
|
-
mcp-manager.ts # multi-server management
|
|
46
|
-
transport.ts # Stdio + streamable HTTP transports
|
|
47
|
-
sse.ts # streamable HTTP SSE framing/parsing
|
|
48
|
-
mcp-tool-adapter.ts # MCP → AgentTool adaptation
|
|
49
|
-
oauth/ # OAuth 2.1 (discovery / DCR / token / store / login)
|
|
50
|
-
index.ts
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
## Development Commands
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
pnpm --filter @x-otto/mcp build
|
|
57
|
-
pnpm --filter @x-otto/mcp typecheck
|
|
58
|
-
pnpm --filter @x-otto/mcp clean
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
## Related Packages
|
|
62
|
-
|
|
63
|
-
`@x-otto/credentials`, `@x-otto/env`, `@x-otto/interchange`, `@x-otto/shared`
|