Files
Netcatty/electron/bridges/externalMcp/universalSetupPrompt.test.cjs
T
Ryanisgoodandbincxz 3738565b1b feat(mcp): improve external agent discovery and setup (#3407)
* fix(ai): expose renamed terminal session labels

* feat(mcp): guide agents toward Netcatty tools

* feat(mcp): load Netcatty toolsets on demand

* feat(codex): install Netcatty skill with external MCP

* feat(mcp): install skills for Claude Code and Grok

* feat(mcp): add universal client setup prompt

* fix(mcp): keep Cursor in client setup tabs

* chore(ai): refresh generated tool specs

* fix(mcp): honor Claude skill config root and run MCP tests in CI

---------

Co-authored-by: bincxz <16399091+binaricat@users.noreply.github.com>
2026-09-18 14:10:20 +08:00

49 lines
1.8 KiB
JavaScript

"use strict";
const test = require("node:test");
const assert = require("node:assert/strict");
const { buildUniversalSetupPrompt } = require("./universalSetupPrompt.cjs");
test("builds a portable MCP and Skill installation prompt", () => {
const prompt = buildUniversalSetupPrompt({
launcherPath: "/Applications/Netcatty App/netcatty-external-mcp",
discoveryPath: "/Users/test/Library/Application Support/Netcatty/discovery.json",
skillContent: "---\nname: netcatty-mcp\nmetadata:\n managed-by: netcatty\n---\nUse get_environment first.\n",
});
assert.match(prompt, /Install the Netcatty integration/);
assert.match(prompt, /Agent Skills are unsupported/);
assert.match(prompt, /managed-by: netcatty/);
assert.match(prompt, /call `get_environment`/);
const jsonBlock = prompt.match(/```json\n([\s\S]*?)\n```/u)?.[1];
assert.ok(jsonBlock);
assert.deepEqual(JSON.parse(jsonBlock), {
mcpServers: {
"netcatty-external": {
command: "/Applications/Netcatty App/netcatty-external-mcp",
args: [],
env: {
NETCATTY_EXTERNAL_MCP_DISCOVERY_FILE: "/Users/test/Library/Application Support/Netcatty/discovery.json",
},
},
},
});
});
test("requires all runtime-specific installation values", () => {
assert.throws(
() => buildUniversalSetupPrompt({ launcherPath: "", discoveryPath: "/tmp/d", skillContent: "skill" }),
/launcher path is unavailable/i,
);
assert.throws(
() => buildUniversalSetupPrompt({ launcherPath: "/bin/mcp", discoveryPath: "", skillContent: "skill" }),
/discovery path is unavailable/i,
);
assert.throws(
() => buildUniversalSetupPrompt({ launcherPath: "/bin/mcp", discoveryPath: "/tmp/d", skillContent: "" }),
/skill content is unavailable/i,
);
});