@orkestrel/mcp 0.0.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Orkestrel
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,75 @@
1
+ # @orkestrel/mcp
2
+
3
+ A typed [Model Context Protocol](https://modelcontextprotocol.io) client/server
4
+ for the `@orkestrel` line, with pluggable HTTP, WebSocket, and stdio
5
+ transports. `createMCPServer` wraps a live `ToolManagerInterface`
6
+ (`@orkestrel/agent`) as an MCP server; `createMCPClient` drives a remote MCP
7
+ server and surfaces its tools as local `ToolInterface`s an agent can call as
8
+ if they were its own. The dispatch core is transport- and provider-agnostic
9
+ (`src/core` — JSON-RPC 2.0, no HTTP, no `as`); every transport (Streamable
10
+ HTTP over `@orkestrel/router` / `@orkestrel/server`, WebSocket over
11
+ `@orkestrel/websocket`, and stdio over `node:child_process`) lives one layer
12
+ out (`src/server`), each mechanism, not policy. Part of the `@orkestrel` line.
13
+
14
+ ## Install
15
+
16
+ ```sh
17
+ npm install @orkestrel/mcp
18
+ ```
19
+
20
+ ## Requirements
21
+
22
+ - Node.js >= 24
23
+ - ESM and CommonJS builds ship for both the core and server entry points
24
+ - `@orkestrel/server` and `@orkestrel/router` are peer dependencies (the HTTP
25
+ spine the `./server` transports mount onto)
26
+
27
+ ## Usage
28
+
29
+ Expose a tool registry over MCP, mounted on the HTTP spine:
30
+
31
+ ```ts
32
+ import { createMCPServer } from '@orkestrel/mcp'
33
+ import { createMCPRoutes } from '@orkestrel/mcp/server'
34
+ import { createToolManager } from '@orkestrel/agent'
35
+
36
+ const tools = createToolManager()
37
+ tools.add({ id: 'add', name: 'add', execute: (a) => Number(a.x) + Number(a.y) })
38
+
39
+ const mcp = createMCPServer({ name: 'calculator', version: '1.0.0', tools })
40
+ const routes = createMCPRoutes(mcp) // POST /mcp dispatches JSON-RPC (JSON or SSE per Accept)
41
+ router.add(routes)
42
+ ```
43
+
44
+ Drive a remote MCP server as a client, over the same transport-agnostic core:
45
+
46
+ ```ts
47
+ import { createMCPClient } from '@orkestrel/mcp'
48
+ import { createHTTPClientTransport } from '@orkestrel/mcp/server'
49
+
50
+ const client = createMCPClient({
51
+ transport: createHTTPClientTransport({ url: 'http://localhost:3000/mcp' }),
52
+ })
53
+ await client.connect()
54
+ const tools = await client.tools()
55
+ const value = await client.call('add', { x: 2, y: 5 })
56
+ ```
57
+
58
+ The SAME `MCPClient` drives a `createWebSocketClientTransport` or
59
+ `createStdioClientTransport` instead — only the injected transport changes.
60
+
61
+ ## Guide
62
+
63
+ For the full surface — the JSON-RPC dispatch core, the three server
64
+ transports (HTTP, WebSocket, stdio), the native session middleware, and
65
+ usage patterns — see [`guides/src/mcp.md`](guides/src/mcp.md).
66
+
67
+ ## Package
68
+
69
+ Published with two entry points per the `exports` field in `package.json`:
70
+ the environment-agnostic core (`.`) and the Node-only server surface
71
+ (`./server`).
72
+
73
+ ## License
74
+
75
+ MIT © [Orkestrel](https://github.com/orkestrel) — see [LICENSE](./LICENSE).