Skip to content

armgit / Ix

Public Imported from GitHub
0

Understand any codebase instantly. System intelligence for codebases, built for humans and AI.

fix(mcp): reject conflicting ingest sources (#432)

Hiro-Chibad8dfb82f4139
diff --git a/ix-cli/src/cli/__tests__/mcp.test.ts b/ix-cli/src/cli/__tests__/mcp.test.ts
index 6eed589b..7263affc 100644
--- a/ix-cli/src/cli/__tests__/mcp.test.ts
+++ b/ix-cli/src/cli/__tests__/mcp.test.ts
@@ -280,9 +280,40 @@ describe("ix mcp", () => {
return { ok: true, stdout: "{}", stderr: "" };
});
- await client.callTool({ name: "ix_ingest", arguments: { github: "owner/repo", limit: 25 } });
+ await client.callTool({
+ name: "ix_ingest",
+ arguments: { github: "owner/repo", since: "2026-01-01", limit: 25 },
+ });
+
+ expect(calls).toEqual([
+ ["ingest", "--github=owner/repo", "--since=2026-01-01", "--limit=25", "--format=json"],
+ ]);
+ });
+
+ it("rejects simultaneous ix_ingest path and github sources before running the CLI", async () => {
+ const calls: string[][] = [];
+ const client = await connect(async (args) => {
+ calls.push(args);
+ return { ok: true, stdout: "{}", stderr: "" };
+ });
+
+ const result = (await client.callTool({
+ name: "ix_ingest",
+ arguments: { path: "src", github: "owner/repo" },
+ })) as CallToolResult;
- expect(calls).toEqual([["ingest", "--github=owner/repo", "--limit=25", "--format=json"]]);
+ expect(calls).toEqual([]);
+ expect(result.isError).toBe(true);
+ expect(result.structuredContent).toBeUndefined();
+ expect(result.content).toEqual([
+ {
+ type: "text",
+ text: JSON.stringify({
+ error: "path and github are mutually exclusive; provide only one",
+ tool: "ix_ingest",
+ }),
+ },
+ ]);
});
it("does not pass --limit when ingesting a local path", async () => {
diff --git a/ix-cli/src/mcp/server.ts b/ix-cli/src/mcp/server.ts
index 283fd670..d3fa75e9 100644
--- a/ix-cli/src/mcp/server.ts
+++ b/ix-cli/src/mcp/server.ts
@@ -439,6 +439,12 @@ export function createIxMcpServer(options: CreateServerOptions = {}): McpServer
since: z.string().min(1).optional().describe("ISO 8601 date"),
},
async (input) => {
+ if (typeof input.path === "string" && typeof input.github === "string") {
+ return textResult(
+ JSON.stringify({ error: "path and github are mutually exclusive; provide only one", tool: "ix_ingest" }),
+ true,
+ );
+ }
const options: string[] = [];
pushOption(options, "--github", input.github);
pushOption(options, "--since", input.since);