@zswarm/mcp 0.1.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/LICENSE +21 -0
- package/README.md +45 -0
- package/dist/mcp-server.d.ts +2 -0
- package/dist/mcp-server.js +42 -0
- package/package.json +36 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 zSwarm contributors
|
|
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,45 @@
|
|
|
1
|
+
# @zswarm/mcp
|
|
2
|
+
|
|
3
|
+
stdio MCP server. One tool named `zswarm` with an `op` enum, dispatched through
|
|
4
|
+
`@zswarm/core`.
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install @zswarm/mcp
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
From a checkout of this repo:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install ./packages/mcp
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Requires Zellij >= 0.42 and Node >= 20. The bin is `zswarm-mcp`.
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```json
|
|
23
|
+
{
|
|
24
|
+
"mcpServers": {
|
|
25
|
+
"zswarm": {
|
|
26
|
+
"command": "/path/to/node",
|
|
27
|
+
"args": ["/path/to/node_modules/@zswarm/mcp/dist/mcp-server.js"],
|
|
28
|
+
"env": { "ZSWARM_SESSION": "<session-name>" }
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
zswarm({ op: "list" })
|
|
36
|
+
zswarm({ op: "send", to: "terminal_2", body: "ping" })
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Some MCP hosts spawn servers outside your shell and inherit neither PATH nor
|
|
40
|
+
the Zellij environment. Give the interpreter an absolute path and set
|
|
41
|
+
`ZSWARM_SESSION`. Details: the [zswarm README](../../README.md).
|
|
42
|
+
|
|
43
|
+
## License
|
|
44
|
+
|
|
45
|
+
MIT
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
5
|
+
import { dispatchZswarm, mcpInputSchema, MCP_TOOL_DESCRIPTION, } from "@zswarm/core";
|
|
6
|
+
const server = new Server({ name: "zswarm", version: "0.1.0" }, { capabilities: { tools: {} } });
|
|
7
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
8
|
+
tools: [
|
|
9
|
+
{
|
|
10
|
+
name: "zswarm",
|
|
11
|
+
description: MCP_TOOL_DESCRIPTION,
|
|
12
|
+
inputSchema: mcpInputSchema(),
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
}));
|
|
16
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
17
|
+
const name = request.params.name;
|
|
18
|
+
const args = (request.params.arguments ?? {});
|
|
19
|
+
if (name !== "zswarm") {
|
|
20
|
+
return {
|
|
21
|
+
content: [
|
|
22
|
+
{
|
|
23
|
+
type: "text",
|
|
24
|
+
text: JSON.stringify({
|
|
25
|
+
ok: false,
|
|
26
|
+
error: { code: "unknown_tool", message: `unknown tool ${name}` },
|
|
27
|
+
}),
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
isError: true,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const result = await dispatchZswarm(args);
|
|
34
|
+
return {
|
|
35
|
+
content: [
|
|
36
|
+
{ type: "text", text: JSON.stringify(result, null, 2) },
|
|
37
|
+
],
|
|
38
|
+
isError: !result.ok,
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
const transport = new StdioServerTransport();
|
|
42
|
+
await server.connect(transport);
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@zswarm/mcp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "zSwarm MCP server — Zellij pane coordination",
|
|
6
|
+
"bin": {
|
|
7
|
+
"zswarm-mcp": "./dist/mcp-server.js"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@modelcontextprotocol/sdk": "1.30.0",
|
|
11
|
+
"@zswarm/core": "0.1.0"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@types/node": "22.14.1",
|
|
15
|
+
"typescript": "5.8.3"
|
|
16
|
+
},
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=20"
|
|
19
|
+
},
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"files": [
|
|
22
|
+
"dist",
|
|
23
|
+
"README.md"
|
|
24
|
+
],
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
28
|
+
"exports": {
|
|
29
|
+
".": "./dist/mcp-server.js",
|
|
30
|
+
"./package.json": "./package.json"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "tsc -p tsconfig.json",
|
|
34
|
+
"mcp": "node dist/mcp-server.js"
|
|
35
|
+
}
|
|
36
|
+
}
|