@aicommander/mcp 1.0.0 → 1.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/README.md +5 -5
- package/dist/bin/mcp.js +10 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ Universal **stdio MCP server** for [AI Commander](https://aicommander.dev) — r
|
|
|
5
5
|
Use this package to connect any MCP client that speaks **stdio** (Codex CLI, Claude Desktop's config file, Cursor, Windsurp, …) to your AI Commander relay. It wraps the remote HTTPS/SSE MCP endpoint so clients that can only launch a local process get the same `remote_exec` and `session_status` tools.
|
|
6
6
|
|
|
7
7
|
> Using **Claude Code**? You don't need this package — add the relay directly:
|
|
8
|
-
> `claude mcp add --transport http aicommander https
|
|
8
|
+
> `claude mcp add --transport http aicommander https://aicommander.dev/mcp --header "Authorization: Bearer <token>"`
|
|
9
9
|
|
|
10
10
|
## Tools
|
|
11
11
|
|
|
@@ -21,7 +21,7 @@ Two environment variables:
|
|
|
21
21
|
| Variable | Required | Default | Description |
|
|
22
22
|
|---|---|---|---|
|
|
23
23
|
| `AICOMMANDER_ADMIN_TOKEN` | **yes** | — | Admin token from `POST /api/admin/token` on your relay. |
|
|
24
|
-
| `AICOMMANDER_SERVER` | no | `https://
|
|
24
|
+
| `AICOMMANDER_SERVER` | no | `https://aicommander.dev` | Base URL of your self-hosted AI Commander Worker. |
|
|
25
25
|
|
|
26
26
|
## Usage
|
|
27
27
|
|
|
@@ -31,7 +31,7 @@ Two environment variables:
|
|
|
31
31
|
[mcp_servers.aicommander]
|
|
32
32
|
command = "npx"
|
|
33
33
|
args = ["-y", "@aicommander/mcp"]
|
|
34
|
-
env = { AICOMMANDER_ADMIN_TOKEN = "<token>", AICOMMANDER_SERVER = "https
|
|
34
|
+
env = { AICOMMANDER_ADMIN_TOKEN = "<token>", AICOMMANDER_SERVER = "https://aicommander.dev" }
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
### Claude Desktop — `claude_desktop_config.json`
|
|
@@ -44,7 +44,7 @@ env = { AICOMMANDER_ADMIN_TOKEN = "<token>", AICOMMANDER_SERVER = "https://<your
|
|
|
44
44
|
"args": ["-y", "@aicommander/mcp"],
|
|
45
45
|
"env": {
|
|
46
46
|
"AICOMMANDER_ADMIN_TOKEN": "<token>",
|
|
47
|
-
"AICOMMANDER_SERVER": "https
|
|
47
|
+
"AICOMMANDER_SERVER": "https://aicommander.dev"
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -53,7 +53,7 @@ env = { AICOMMANDER_ADMIN_TOKEN = "<token>", AICOMMANDER_SERVER = "https://<your
|
|
|
53
53
|
|
|
54
54
|
Then just mention a session code in chat:
|
|
55
55
|
|
|
56
|
-
> *"Show disk usage on AIC-
|
|
56
|
+
> *"Show disk usage on AIC-XYZ-1234"*
|
|
57
57
|
|
|
58
58
|
The client detects the `AIC-` prefix and calls `remote_exec` for you.
|
|
59
59
|
|
package/dist/bin/mcp.js
CHANGED
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
-
const SERVER_URL = process.env["AICOMMANDER_SERVER"] ?? "https://
|
|
5
|
+
const SERVER_URL = process.env["AICOMMANDER_SERVER"] ?? "https://aicommander.dev";
|
|
6
|
+
// Optional. If set, it logs into your AI Commander account (stage 2 — saved
|
|
7
|
+
// machines, aliases, API keys). Without it the bridge works anonymously and you
|
|
8
|
+
// drive machines by their session code (AIC-…).
|
|
6
9
|
const ADMIN_TOKEN = process.env["AICOMMANDER_ADMIN_TOKEN"];
|
|
7
|
-
if (!ADMIN_TOKEN) {
|
|
8
|
-
process.stderr.write("Error: AICOMMANDER_ADMIN_TOKEN environment variable is required\n");
|
|
9
|
-
process.exit(1);
|
|
10
|
-
}
|
|
11
10
|
const server = new McpServer({
|
|
12
11
|
name: "aicommander",
|
|
13
12
|
version: "1.0.0",
|
|
@@ -16,11 +15,11 @@ const server = new McpServer({
|
|
|
16
15
|
server.registerTool("remote_exec", {
|
|
17
16
|
description: "Execute a shell command on a remote machine running the AI Commander agent. " +
|
|
18
17
|
"Use this tool whenever the user mentions a server/machine code that starts with 'AIC-' " +
|
|
19
|
-
"(e.g. AIC-
|
|
18
|
+
"(e.g. AIC-XYZ-1234). Streams stdout/stderr output in real time.",
|
|
20
19
|
inputSchema: {
|
|
21
20
|
code: z
|
|
22
21
|
.string()
|
|
23
|
-
.describe("AI Commander session code — always starts with 'AIC-' (e.g. AIC-
|
|
22
|
+
.describe("AI Commander session code — always starts with 'AIC-' (e.g. AIC-XYZ-1234)"),
|
|
24
23
|
command: z
|
|
25
24
|
.string()
|
|
26
25
|
.describe("Shell command to execute (runs via /bin/sh -c on the remote machine)"),
|
|
@@ -38,7 +37,7 @@ server.registerTool("remote_exec", {
|
|
|
38
37
|
method: "POST",
|
|
39
38
|
headers: {
|
|
40
39
|
"Content-Type": "application/json",
|
|
41
|
-
Authorization: `Bearer ${ADMIN_TOKEN}
|
|
40
|
+
...(ADMIN_TOKEN ? { Authorization: `Bearer ${ADMIN_TOKEN}` } : {}),
|
|
42
41
|
Accept: "text/event-stream",
|
|
43
42
|
},
|
|
44
43
|
body: JSON.stringify({
|
|
@@ -95,18 +94,18 @@ server.registerTool("remote_exec", {
|
|
|
95
94
|
// Tool: session_status
|
|
96
95
|
server.registerTool("session_status", {
|
|
97
96
|
description: "Check whether a remote machine is online and ready. Use this when the user asks about " +
|
|
98
|
-
"a server/machine identified by an AIC- code (e.g. AIC-
|
|
97
|
+
"a server/machine identified by an AIC- code (e.g. AIC-XYZ-1234).",
|
|
99
98
|
inputSchema: {
|
|
100
99
|
code: z
|
|
101
100
|
.string()
|
|
102
|
-
.describe("AI Commander session code starting with 'AIC-' (e.g. AIC-
|
|
101
|
+
.describe("AI Commander session code starting with 'AIC-' (e.g. AIC-XYZ-1234)"),
|
|
103
102
|
},
|
|
104
103
|
}, async ({ code }) => {
|
|
105
104
|
const res = await fetch(`${SERVER_URL}/mcp`, {
|
|
106
105
|
method: "POST",
|
|
107
106
|
headers: {
|
|
108
107
|
"Content-Type": "application/json",
|
|
109
|
-
Authorization: `Bearer ${ADMIN_TOKEN}
|
|
108
|
+
...(ADMIN_TOKEN ? { Authorization: `Bearer ${ADMIN_TOKEN}` } : {}),
|
|
110
109
|
},
|
|
111
110
|
body: JSON.stringify({
|
|
112
111
|
jsonrpc: "2.0",
|
package/package.json
CHANGED