mirror of
https://bitbucket.org/siakitem/my-pi.git
synced 2026-08-28 08:35:57 +00:00
fix: route Exa and CodeGraph through shared mcp adapter
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import test from "node:test";
|
||||
|
||||
import { EXA_TOOLS, MCP_CONFIG } from "../extensions/mcp-config.ts";
|
||||
|
||||
test("one MCP adapter config contains both Exa and CodeGraph", () => {
|
||||
assert.deepEqual(MCP_CONFIG, {
|
||||
settings: {
|
||||
disableProxyTool: true,
|
||||
scriptMode: false,
|
||||
},
|
||||
mcpServers: {
|
||||
exa: {
|
||||
url: `https://mcp.exa.ai/mcp?tools=${EXA_TOOLS.join(",")}`,
|
||||
protocolVersion: "auto",
|
||||
lifecycle: "eager",
|
||||
directTools: EXA_TOOLS,
|
||||
includeTools: EXA_TOOLS,
|
||||
toolPrefix: "none",
|
||||
approveTools: false,
|
||||
exposeResources: false,
|
||||
},
|
||||
codegraph: {
|
||||
command: "codegraph",
|
||||
args: ["serve", "--mcp"],
|
||||
lifecycle: "keep-alive",
|
||||
directTools: ["codegraph_explore"],
|
||||
includeTools: ["codegraph_explore"],
|
||||
toolPrefix: "none",
|
||||
approveTools: false,
|
||||
exposeResources: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
test("the package loads only the shared MCP extension entry", async () => {
|
||||
const packageJson = JSON.parse(await readFile(new URL("../package.json", import.meta.url), "utf8")) as {
|
||||
pi: { extensions: string[] };
|
||||
};
|
||||
const localMcpEntries = packageJson.pi.extensions.filter((entry) =>
|
||||
entry === "./extensions/mcp.ts" || entry === "./extensions/exa.ts" || entry === "./extensions/codegraph.ts"
|
||||
);
|
||||
|
||||
assert.deepEqual(localMcpEntries, ["./extensions/mcp.ts"]);
|
||||
});
|
||||
Reference in New Issue
Block a user