@nodetool-ai/cli-mcp 0.0.0-stage → 0.8.9-bootstrap.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/README.md +21 -2
- package/dist/.nodetool-build-stamp +1 -0
- package/dist/commands/mcp.d.ts +21 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/mcp.js +166 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/dist/nodetool.d.ts +3 -0
- package/dist/nodetool.d.ts.map +1 -0
- package/dist/nodetool.js +11 -0
- package/dist/nodetool.js.map +1 -0
- package/package.json +64 -4
- package/server.json +31 -0
package/README.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
-
#
|
|
1
|
+
# MCP commands
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Client configuration and MCP serving. This feature also supplies the standalone
|
|
4
|
+
`nodetool-mcp` executable.
|
|
5
|
+
|
|
6
|
+
Install this independent command feature through the default CLI:
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
nodetool packs add cli-mcp --yes
|
|
10
|
+
nodetool mcp --help
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Commands do not install missing features automatically. See the
|
|
14
|
+
[command reference](../../docs/cli.md#install-command-features).
|
|
15
|
+
|
|
16
|
+
For the standalone MCP executable:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npx -y --package=@nodetool-ai/cli-mcp nodetool-mcp install
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
See the [MCP setup guide](../../docs/mcp-server.md).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2026-10-30T19:34:49.848Z
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `nodetool mcp install | uninstall | status | config` — register NodeTool as
|
|
3
|
+
* an MCP server in local agent harnesses. `nodetool mcp serve` stays in
|
|
4
|
+
* nodetool.ts, beside the node registry setup it needs.
|
|
5
|
+
*/
|
|
6
|
+
import type { Command } from "commander";
|
|
7
|
+
import type { McpLaunch } from "@nodetool-ai/websocket/mcp-client-config";
|
|
8
|
+
interface LaunchOptions {
|
|
9
|
+
http?: boolean;
|
|
10
|
+
url?: string;
|
|
11
|
+
npx?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* `--http` or `--url` selects the HTTP transport. Otherwise the client starts
|
|
15
|
+
* `nodetool-mcp mcp serve` itself: through the installed CLI when it is on PATH,
|
|
16
|
+
* or through `npx` when it is not.
|
|
17
|
+
*/
|
|
18
|
+
export declare function resolveLaunch(opts: LaunchOptions): Promise<McpLaunch>;
|
|
19
|
+
export declare function registerMcpClientCommands(mcp: Command): void;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=mcp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAEV,SAAS,EACV,MAAM,0CAA0C,CAAC;AAKlD,UAAU,aAAa;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAYD;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,SAAS,CAAC,CAM3E;AAyCD,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAkK5D"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { homedir } from "node:os";
|
|
2
|
+
import { printTable } from "@nodetool-ai/cli-common/commands/output";
|
|
3
|
+
const DEFAULT_HTTP_URL = "http://127.0.0.1:7777/mcp";
|
|
4
|
+
const loadConfig = () => import("@nodetool-ai/websocket/mcp-client-config");
|
|
5
|
+
/**
|
|
6
|
+
* `--http` or `--url` selects the HTTP transport. Otherwise the client starts
|
|
7
|
+
* `nodetool-mcp mcp serve` itself: through the installed CLI when it is on PATH,
|
|
8
|
+
* or through `npx` when it is not.
|
|
9
|
+
*/
|
|
10
|
+
export async function resolveLaunch(opts) {
|
|
11
|
+
if (opts.http || opts.url) {
|
|
12
|
+
return { transport: "http", url: opts.url ?? DEFAULT_HTTP_URL };
|
|
13
|
+
}
|
|
14
|
+
const { hasNodetoolCli, stdioLaunch } = await loadConfig();
|
|
15
|
+
return stdioLaunch({ npx: opts.npx === true || !hasNodetoolCli() });
|
|
16
|
+
}
|
|
17
|
+
function selectedTargets(opts) {
|
|
18
|
+
return ["claude", "codex", "opencode"].filter((id) => opts[id]);
|
|
19
|
+
}
|
|
20
|
+
function addTargetOptions(command, verb) {
|
|
21
|
+
return command
|
|
22
|
+
.option("--claude", `${verb} Claude Code`)
|
|
23
|
+
.option("--codex", `${verb} Codex`)
|
|
24
|
+
.option("--opencode", `${verb} OpenCode`);
|
|
25
|
+
}
|
|
26
|
+
function addLaunchOptions(command) {
|
|
27
|
+
return command
|
|
28
|
+
.option("--npx", "Launch through npx even when nodetool-mcp is on PATH")
|
|
29
|
+
.option("--http", `Connect to a running NodeTool server over HTTP (${DEFAULT_HTTP_URL})`)
|
|
30
|
+
.option("--url <url>", "Connect over HTTP to this MCP URL");
|
|
31
|
+
}
|
|
32
|
+
function printNextSteps(labels, launch) {
|
|
33
|
+
console.log("\nNext:");
|
|
34
|
+
console.log(` 1. Restart ${labels.join(", ")} to load the server.`);
|
|
35
|
+
console.log(' 2. Ask the agent: "Use NodeTool to list my workflows."');
|
|
36
|
+
console.log(" 3. Store provider keys once: nodetool secrets store OPENAI_API_KEY");
|
|
37
|
+
if (launch.transport === "http") {
|
|
38
|
+
console.log("\nAn HTTP entry works only while NodeTool runs (Studio or nodetool serve).");
|
|
39
|
+
}
|
|
40
|
+
console.log();
|
|
41
|
+
}
|
|
42
|
+
export function registerMcpClientCommands(mcp) {
|
|
43
|
+
addLaunchOptions(addTargetOptions(mcp
|
|
44
|
+
.command("install")
|
|
45
|
+
.description("Register NodeTool with Claude Code, Codex, and OpenCode. " +
|
|
46
|
+
"Without a target flag, installs for every client found on this machine."), "Install for"))
|
|
47
|
+
.option("--no-verify", "Write the config without starting the server first")
|
|
48
|
+
.action(async (opts) => {
|
|
49
|
+
const { MCP_CLIENT_IDS, MCP_CLIENT_LABELS, describeLaunch, isMcpClientPresent, probeMcpLaunch, writeMcpClientEntry } = await loadConfig();
|
|
50
|
+
const home = homedir();
|
|
51
|
+
const launch = await resolveLaunch(opts);
|
|
52
|
+
let targets = selectedTargets(opts);
|
|
53
|
+
if (targets.length === 0) {
|
|
54
|
+
targets = MCP_CLIENT_IDS.filter((id) => isMcpClientPresent(id, home));
|
|
55
|
+
}
|
|
56
|
+
if (targets.length === 0) {
|
|
57
|
+
console.error("No Claude Code, Codex, or OpenCode installation found.\n" +
|
|
58
|
+
"Pick one with --claude, --codex, or --opencode, or print a config " +
|
|
59
|
+
"for another client with: nodetool mcp config");
|
|
60
|
+
process.exitCode = 1;
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
console.log(`\nNodeTool MCP server: ${describeLaunch(launch)}`);
|
|
64
|
+
if (opts.verify) {
|
|
65
|
+
console.log("Starting the server to check it…");
|
|
66
|
+
try {
|
|
67
|
+
const probe = await probeMcpLaunch(launch);
|
|
68
|
+
console.log(`Verified: ${probe.tools.length} tools in ${(probe.elapsedMs / 1000).toFixed(1)}s`);
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
console.error(`\nThe server did not start: ${error instanceof Error ? error.message : String(error)}\n` +
|
|
72
|
+
(launch.transport === "http"
|
|
73
|
+
? "Start NodeTool (Studio or nodetool serve), or install the stdio server without --http."
|
|
74
|
+
: "Fix the error above, or skip this check with --no-verify."));
|
|
75
|
+
process.exitCode = 1;
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const results = targets.map((id) => {
|
|
80
|
+
try {
|
|
81
|
+
const path = writeMcpClientEntry(id, launch, home);
|
|
82
|
+
return { target: MCP_CLIENT_LABELS[id], status: `Installed → ${path}` };
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
process.exitCode = 1;
|
|
86
|
+
return { target: MCP_CLIENT_LABELS[id], status: `Error: ${String(error)}` };
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
console.log();
|
|
90
|
+
printTable(results);
|
|
91
|
+
printNextSteps(targets.map((id) => MCP_CLIENT_LABELS[id]), launch);
|
|
92
|
+
});
|
|
93
|
+
addTargetOptions(mcp
|
|
94
|
+
.command("uninstall")
|
|
95
|
+
.description("Remove the NodeTool MCP server from agent harness configs"), "Uninstall from").action(async (opts) => {
|
|
96
|
+
const { MCP_CLIENT_IDS, MCP_CLIENT_LABELS, removeMcpClientEntry } = await loadConfig();
|
|
97
|
+
const home = homedir();
|
|
98
|
+
const selected = selectedTargets(opts);
|
|
99
|
+
const targets = selected.length > 0 ? selected : [...MCP_CLIENT_IDS];
|
|
100
|
+
const results = targets.map((id) => {
|
|
101
|
+
try {
|
|
102
|
+
const removed = removeMcpClientEntry(id, home);
|
|
103
|
+
return {
|
|
104
|
+
target: MCP_CLIENT_LABELS[id],
|
|
105
|
+
status: removed ? "Removed" : "Not installed"
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
process.exitCode = 1;
|
|
110
|
+
return { target: MCP_CLIENT_LABELS[id], status: `Error: ${String(error)}` };
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
console.log();
|
|
114
|
+
printTable(results);
|
|
115
|
+
console.log();
|
|
116
|
+
});
|
|
117
|
+
mcp
|
|
118
|
+
.command("status")
|
|
119
|
+
.description("Show where NodeTool is registered as an MCP server")
|
|
120
|
+
.option("--check", "Start each registered server and list its tools")
|
|
121
|
+
.action(async (opts) => {
|
|
122
|
+
const { MCP_CLIENT_IDS, MCP_CLIENT_LABELS, describeLaunch, isMcpClientPresent, probeMcpLaunch, readMcpClientEntry } = await loadConfig();
|
|
123
|
+
const home = homedir();
|
|
124
|
+
const rows = [];
|
|
125
|
+
for (const id of MCP_CLIENT_IDS) {
|
|
126
|
+
let launch = null;
|
|
127
|
+
let status;
|
|
128
|
+
try {
|
|
129
|
+
launch = readMcpClientEntry(id, home);
|
|
130
|
+
status = launch
|
|
131
|
+
? "Installed"
|
|
132
|
+
: isMcpClientPresent(id, home)
|
|
133
|
+
? "Not installed"
|
|
134
|
+
: "Client not found";
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
status = "Unreadable config";
|
|
138
|
+
}
|
|
139
|
+
if (launch && opts.check) {
|
|
140
|
+
try {
|
|
141
|
+
const probe = await probeMcpLaunch(launch);
|
|
142
|
+
status = `OK: ${probe.tools.length} tools`;
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
process.exitCode = 1;
|
|
146
|
+
status = `Failed: ${(error instanceof Error ? error.message : String(error)).split("\n")[0]}`;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
rows.push({
|
|
150
|
+
target: MCP_CLIENT_LABELS[id],
|
|
151
|
+
status,
|
|
152
|
+
launch: launch ? describeLaunch(launch) : ""
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
console.log("\nNodeTool MCP status\n");
|
|
156
|
+
printTable(rows);
|
|
157
|
+
console.log();
|
|
158
|
+
});
|
|
159
|
+
addLaunchOptions(mcp
|
|
160
|
+
.command("config")
|
|
161
|
+
.description("Print an mcpServers JSON block for any MCP client (Cursor, Claude Desktop, Windsurf, …)")).action(async (opts) => {
|
|
162
|
+
const { mcpServersSnippet } = await loadConfig();
|
|
163
|
+
console.log(mcpServersSnippet(await resolveLaunch(opts)));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,MAAM,UAAU,EAAE,CAAC;QACjD,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,MAAM,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
/** Register MCP client configuration and the actual stdio MCP server. */
|
|
3
|
+
export declare function createProgram(): Command;
|
|
4
|
+
export declare function run(argv?: readonly string[]): Promise<void>;
|
|
5
|
+
export declare const feature: {
|
|
6
|
+
descriptor: {
|
|
7
|
+
id: string;
|
|
8
|
+
apiVersion: number;
|
|
9
|
+
requires: string[];
|
|
10
|
+
capabilities: string[];
|
|
11
|
+
};
|
|
12
|
+
run: typeof run;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,yEAAyE;AACzE,wBAAgB,aAAa,IAAI,OAAO,CA6BvC;AACD,wBAAsB,GAAG,CAAC,IAAI,GAAE,SAAS,MAAM,EAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CAIxF;AACD,eAAO,MAAM,OAAO;;QAAmB,EAAE;QAAa,UAAU;QAAK,QAAQ;QAAoB,YAAY;;;CAAsB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { registerMcpClientCommands } from "./commands/mcp.js";
|
|
3
|
+
/** Register MCP client configuration and the actual stdio MCP server. */
|
|
4
|
+
export function createProgram() {
|
|
5
|
+
const program = new Command("nodetool");
|
|
6
|
+
const mcp = program.command("mcp").description("Configure MCP clients or serve NodeTool tools over stdio");
|
|
7
|
+
registerMcpClientCommands(mcp);
|
|
8
|
+
mcp.command("serve").description("Run the NodeTool MCP server over stdio").action(async () => {
|
|
9
|
+
const { refusePackInstallsInProcess } = await import("@nodetool-ai/pack-manager/packs/install-process");
|
|
10
|
+
refusePackInstallsInProcess("mcp serve");
|
|
11
|
+
const { createMcpServer, createMcpStdioTransport, forwardMcpStdioToLocalServer } = await import("@nodetool-ai/websocket");
|
|
12
|
+
if (await forwardMcpStdioToLocalServer()) {
|
|
13
|
+
process.stderr.write("NodeTool MCP forwarding to the local API server.\n");
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const { setupCliDb } = await import("@nodetool-ai/cli-local/local-db");
|
|
17
|
+
await setupCliDb();
|
|
18
|
+
const { NodeRegistry } = await import("@nodetool-ai/node-sdk");
|
|
19
|
+
const { registerCliPacks, configureCliPackHost } = await import("@nodetool-ai/cli-execution/packs/host");
|
|
20
|
+
const { CLI_LOCAL_BUILTIN_PACK_POLICY } = await import("@nodetool-ai/cli-execution/node-registry");
|
|
21
|
+
configureCliPackHost(import.meta.url);
|
|
22
|
+
const registry = new NodeRegistry();
|
|
23
|
+
await registerCliPacks(registry, CLI_LOCAL_BUILTIN_PACK_POLICY);
|
|
24
|
+
const { createCatalogPackSource } = await import("@nodetool-ai/websocket/pack-source");
|
|
25
|
+
await createCatalogPackSource().registerProviders(CLI_LOCAL_BUILTIN_PACK_POLICY);
|
|
26
|
+
const { installSandboxCatalog } = await import("@nodetool-ai/cli-execution/sandbox-catalog");
|
|
27
|
+
installSandboxCatalog();
|
|
28
|
+
const server = createMcpServer({ registry, agentToolsScope: { userId: "1", source: "stdio-local" } });
|
|
29
|
+
await server.connect(createMcpStdioTransport());
|
|
30
|
+
process.stderr.write("NodeTool MCP server ready on stdio.\n");
|
|
31
|
+
});
|
|
32
|
+
return program;
|
|
33
|
+
}
|
|
34
|
+
export async function run(argv = process.argv.slice(2)) {
|
|
35
|
+
const { initializeCliRuntime } = await import("@nodetool-ai/cli-common/runtime-env");
|
|
36
|
+
initializeCliRuntime(import.meta.url);
|
|
37
|
+
await createProgram().parseAsync([...argv], { from: "user" });
|
|
38
|
+
}
|
|
39
|
+
export const feature = { descriptor: { id: "cli-mcp", apiVersion: 1, requires: ["core", "text"], capabilities: ["cli:mcp"] }, run };
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAE9D,yEAAyE;AACzE,MAAM,UAAU,aAAa;IAC3B,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;IACxC,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,0DAA0D,CAAC,CAAC;IAC3G,yBAAyB,CAAC,GAAG,CAAC,CAAC;IAC/B,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,wCAAwC,CAAC,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE;QAC3F,MAAM,EAAE,2BAA2B,EAAE,GAAG,MAAM,MAAM,CAAC,iDAAiD,CAAC,CAAC;QACxG,2BAA2B,CAAC,WAAW,CAAC,CAAC;QACzC,MAAM,EAAE,eAAe,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,GAAG,MAAM,MAAM,CAAC,wBAAwB,CAAC,CAAC;QAC1H,IAAI,MAAM,4BAA4B,EAAE,EAAE,CAAC;YACzC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,oDAAoD,CAAC,CAAC;YAC3E,OAAO;QACT,CAAC;QACD,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,MAAM,CAAC,iCAAiC,CAAC,CAAC;QACvE,MAAM,UAAU,EAAE,CAAC;QACnB,MAAM,EAAE,YAAY,EAAE,GA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C,GAAG,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;AAChE,CAAC;AACD,MAAM,CAAC,MAAM,OAAO,GAAG,EAAE,UAAU,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodetool.d.ts","sourceRoot":"","sources":["../src/nodetool.ts"],"names":[],"mappings":""}
|
package/dist/nodetool.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { run } from "./index.js";
|
|
3
|
+
const args = process.argv.slice(2);
|
|
4
|
+
if (!args.length) {
|
|
5
|
+
args.push("serve");
|
|
6
|
+
}
|
|
7
|
+
void run(args[0] === "mcp" ? args : ["mcp", ...args]).catch((error) => {
|
|
8
|
+
process.stderr.write(`${error instanceof Error ? error.message : "MCP command failed"}\n`);
|
|
9
|
+
process.exitCode = 1;
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=nodetool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodetool.js","sourceRoot":"","sources":["../src/nodetool.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACnC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;IAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAAC,CAAC;AACzC,KAAK,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IAC7E,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,oBAAoB,IAAI,CAAC,CAAC;IAC3F,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,66 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nodetool-ai/cli-mcp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.8.9-bootstrap.0",
|
|
4
|
+
"description": "Independent NodeTool mcp command module",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=22.0.0"
|
|
8
|
+
},
|
|
9
|
+
"main": "dist/index.js",
|
|
10
|
+
"types": "dist/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"nodetool-dev": "./src/index.ts",
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js",
|
|
16
|
+
"default": "./dist/index.js"
|
|
17
|
+
},
|
|
18
|
+
"./*": {
|
|
19
|
+
"nodetool-dev": "./src/*.ts",
|
|
20
|
+
"types": "./dist/*.d.ts",
|
|
21
|
+
"import": "./dist/*.js",
|
|
22
|
+
"default": "./dist/*.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "node ../../scripts/build-typescript-workspace.mjs",
|
|
27
|
+
"test": "node ../../scripts/run-vitest.mjs run",
|
|
28
|
+
"lint": "node ../../scripts/run-tsc.mjs --noEmit"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@nodetool-ai/cli-common": "0.8.9-bootstrap.0",
|
|
32
|
+
"@nodetool-ai/cli-execution": "0.8.9-bootstrap.0",
|
|
33
|
+
"@nodetool-ai/cli-local": "0.8.9-bootstrap.0",
|
|
34
|
+
"@nodetool-ai/node-sdk": "0.8.9-bootstrap.0",
|
|
35
|
+
"@nodetool-ai/pack-manager": "0.8.9-bootstrap.0",
|
|
36
|
+
"@nodetool-ai/websocket": "0.8.9-bootstrap.0",
|
|
37
|
+
"commander": "^12.1.0",
|
|
38
|
+
"@nodetool-ai/core-nodes": "0.8.9-bootstrap.0",
|
|
39
|
+
"@nodetool-ai/text-nodes": "0.8.9-bootstrap.0"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@types/node": "^22.0.0",
|
|
43
|
+
"typescript": "npm:@typescript/typescript6@6.0.2",
|
|
44
|
+
"vitest": "^5.0.1",
|
|
45
|
+
"tsx": "^4.0.0",
|
|
46
|
+
"@modelcontextprotocol/sdk": "^1.32.1"
|
|
47
|
+
},
|
|
48
|
+
"license": "MIT",
|
|
49
|
+
"repository": {
|
|
50
|
+
"type": "git",
|
|
51
|
+
"url": "https://github.com/nodetool-ai/nodetool.git",
|
|
52
|
+
"directory": "packages/cli-mcp"
|
|
53
|
+
},
|
|
54
|
+
"publishConfig": {
|
|
55
|
+
"access": "public"
|
|
56
|
+
},
|
|
57
|
+
"files": [
|
|
58
|
+
"dist",
|
|
59
|
+
"README.md",
|
|
60
|
+
"server.json"
|
|
61
|
+
],
|
|
62
|
+
"bin": {
|
|
63
|
+
"nodetool-mcp": "dist/nodetool.js"
|
|
64
|
+
},
|
|
65
|
+
"mcpName": "io.github.nodetool-ai/nodetool"
|
|
66
|
+
}
|
package/server.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
|
+
"name": "io.github.nodetool-ai/nodetool",
|
|
4
|
+
"title": "NodeTool",
|
|
5
|
+
"description": "Image, video and audio generation, workflows, a video timeline and a game engine over MCP",
|
|
6
|
+
"websiteUrl": "https://docs.nodetool.ai/mcp-server",
|
|
7
|
+
"repository": {
|
|
8
|
+
"url": "https://github.com/nodetool-ai/nodetool",
|
|
9
|
+
"source": "github",
|
|
10
|
+
"subfolder": "packages/cli-mcp"
|
|
11
|
+
},
|
|
12
|
+
"version": "0.8.9-bootstrap.0",
|
|
13
|
+
"packages": [
|
|
14
|
+
{
|
|
15
|
+
"registryType": "npm",
|
|
16
|
+
"registryBaseUrl": "https://registry.npmjs.org",
|
|
17
|
+
"identifier": "@nodetool-ai/cli-mcp",
|
|
18
|
+
"version": "0.8.9-bootstrap.0",
|
|
19
|
+
"runtimeHint": "npx",
|
|
20
|
+
"transport": {
|
|
21
|
+
"type": "stdio"
|
|
22
|
+
},
|
|
23
|
+
"packageArguments": [
|
|
24
|
+
{
|
|
25
|
+
"type": "positional",
|
|
26
|
+
"value": "serve"
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|