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:
@@ -1,23 +0,0 @@
|
||||
import { createMcpAdapter } from "pi-mcp-adapter";
|
||||
|
||||
/** Connect Pi to the CodeGraph MCP server provided by the host machine. */
|
||||
export default createMcpAdapter({
|
||||
config: {
|
||||
settings: {
|
||||
disableProxyTool: true,
|
||||
scriptMode: false,
|
||||
},
|
||||
mcpServers: {
|
||||
codegraph: {
|
||||
command: "codegraph",
|
||||
args: ["serve", "--mcp"],
|
||||
lifecycle: "keep-alive",
|
||||
directTools: ["codegraph_explore"],
|
||||
includeTools: ["codegraph_explore"],
|
||||
toolPrefix: "none",
|
||||
approveTools: false,
|
||||
exposeResources: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -1,32 +0,0 @@
|
||||
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
||||
import { createMcpAdapter } from "pi-mcp-adapter";
|
||||
import { createExaToolApiOverride } from "./exa-tool-prefix.ts";
|
||||
|
||||
const EXA_TOOLS = ["web_search_exa", "web_fetch_exa", "web_search_advanced_exa"];
|
||||
const EXA_MCP_URL = `https://mcp.exa.ai/mcp?tools=${EXA_TOOLS.join(",")}`;
|
||||
|
||||
const exaAdapter = createMcpAdapter({
|
||||
config: {
|
||||
settings: {
|
||||
disableProxyTool: true,
|
||||
scriptMode: false,
|
||||
},
|
||||
mcpServers: {
|
||||
exa: {
|
||||
url: EXA_MCP_URL,
|
||||
protocolVersion: "auto",
|
||||
lifecycle: "eager",
|
||||
directTools: EXA_TOOLS,
|
||||
includeTools: EXA_TOOLS,
|
||||
toolPrefix: "none",
|
||||
approveTools: false,
|
||||
exposeResources: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
/** Connect Pi to Exa while exposing every direct tool as `exa_<original-name>`. */
|
||||
export default function exaExtension(pi: ExtensionAPI): void {
|
||||
exaAdapter(createExaToolApiOverride(pi));
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import type { McpConfig } from "pi-mcp-adapter";
|
||||
|
||||
export const EXA_TOOLS = ["web_search_exa", "web_fetch_exa", "web_search_advanced_exa"];
|
||||
const EXA_MCP_URL = `https://mcp.exa.ai/mcp?tools=${EXA_TOOLS.join(",")}`;
|
||||
|
||||
export const MCP_CONFIG: McpConfig = {
|
||||
settings: {
|
||||
disableProxyTool: true,
|
||||
scriptMode: false,
|
||||
},
|
||||
mcpServers: {
|
||||
exa: {
|
||||
url: EXA_MCP_URL,
|
||||
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,
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
||||
import { createMcpAdapter } from "pi-mcp-adapter";
|
||||
import { createExaToolApiOverride } from "./exa-tool-prefix.ts";
|
||||
import { MCP_CONFIG } from "./mcp-config.ts";
|
||||
|
||||
const mcpAdapter = createMcpAdapter({
|
||||
config: MCP_CONFIG,
|
||||
});
|
||||
|
||||
/** Connect Pi to Exa and CodeGraph through one shared MCP adapter instance. */
|
||||
export default function mcpExtension(pi: ExtensionAPI): void {
|
||||
mcpAdapter(createExaToolApiOverride(pi));
|
||||
}
|
||||
Reference in New Issue
Block a user