@claudexor/mcp-server 1.0.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/LICENSE +21 -0
- package/README.md +7 -0
- package/dist/index.d.ts +85 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +487 -0
- package/dist/index.js.map +1 -0
- package/package.json +42 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 joi-lab
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# @claudexor/mcp-server
|
|
2
|
+
|
|
3
|
+
Internal package of [Claudexor](https://github.com/razzant/claudexor) — MCP server (official SDK, stdio) exposing Claudexor run/status tools with elicitation-backed interactive questions.
|
|
4
|
+
|
|
5
|
+
Published as part of the Claudexor toolchain; it follows the monorepo's
|
|
6
|
+
lockstep version and has no separate semver contract. Use the `claudexor`
|
|
7
|
+
CLI (or `@claudexor/cli`) as the supported entry point.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { Readable, Writable } from "node:stream";
|
|
2
|
+
import { McpServer as SdkMcpServer } from "@modelcontextprotocol/server";
|
|
3
|
+
import { type InteractionAnswer, type InteractionQuestion } from "@claudexor/schema";
|
|
4
|
+
/**
|
|
5
|
+
* Claudexor's MCP surface on the official TypeScript SDK v2.
|
|
6
|
+
*
|
|
7
|
+
* The SDK owns the protocol core: version negotiation (2025-11-25 down to
|
|
8
|
+
* 2024-10-07 — Cursor's 2025-06-18 handshake keeps working), CONCURRENT
|
|
9
|
+
* request dispatch (a multi-minute race no longer blocks ping/tools/list —
|
|
10
|
+
* the old hand-rolled loop awaited every call inline), structural argument
|
|
11
|
+
* validation against the declared JSON Schemas, and elicitation round-trips.
|
|
12
|
+
* This module stays a THIN surface: tool descriptors, Claudexor's semantic
|
|
13
|
+
* argument checks (the parts a JSON Schema cannot express), and translation
|
|
14
|
+
* between runner results/interactions and MCP shapes. No business logic.
|
|
15
|
+
*/
|
|
16
|
+
export interface McpToolContext {
|
|
17
|
+
/**
|
|
18
|
+
* Ask the user the engine's interactive questions through MCP elicitation.
|
|
19
|
+
* Resolves null when the host lacks the elicitation capability or declines
|
|
20
|
+
* — the engine's timeout-decline fallback stays the honest default.
|
|
21
|
+
*/
|
|
22
|
+
elicit: ((request: {
|
|
23
|
+
interaction_id: string;
|
|
24
|
+
questions: InteractionQuestion[];
|
|
25
|
+
}) => Promise<InteractionAnswer[] | null>) | null;
|
|
26
|
+
/**
|
|
27
|
+
* The request's cancellation signal (`notifications/cancelled` from the
|
|
28
|
+
* host) — runners abort the underlying run with it, exactly like Ctrl-C
|
|
29
|
+
* on the CLI.
|
|
30
|
+
*/
|
|
31
|
+
signal?: AbortSignal;
|
|
32
|
+
}
|
|
33
|
+
/** Behavior hints per the MCP ToolAnnotations contract (all advisory). */
|
|
34
|
+
export interface McpToolAnnotations {
|
|
35
|
+
readOnlyHint?: boolean;
|
|
36
|
+
destructiveHint?: boolean;
|
|
37
|
+
idempotentHint?: boolean;
|
|
38
|
+
}
|
|
39
|
+
/** Tool output: plain text, or text plus a structured mirror (structuredContent). */
|
|
40
|
+
export type McpToolOutput = string | {
|
|
41
|
+
text: string;
|
|
42
|
+
structured?: Record<string, unknown>;
|
|
43
|
+
};
|
|
44
|
+
export interface McpTool {
|
|
45
|
+
name: string;
|
|
46
|
+
description: string;
|
|
47
|
+
inputSchema: Record<string, unknown>;
|
|
48
|
+
/** JSON Schema of the structured result (declared to hosts as outputSchema). */
|
|
49
|
+
outputSchema?: Record<string, unknown>;
|
|
50
|
+
annotations?: McpToolAnnotations;
|
|
51
|
+
handler: (args: any, ctx: McpToolContext) => Promise<McpToolOutput>;
|
|
52
|
+
}
|
|
53
|
+
export interface McpServerOptions {
|
|
54
|
+
name?: string;
|
|
55
|
+
version?: string;
|
|
56
|
+
tools: McpTool[];
|
|
57
|
+
/** Custom stdio streams (tests, socket bindings); defaults to process stdio. */
|
|
58
|
+
transport?: {
|
|
59
|
+
read: Readable;
|
|
60
|
+
write: Writable;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/** Build the SDK server with Claudexor's tools registered (one era-agnostic factory). */
|
|
64
|
+
export declare function buildMcpServer(opts: {
|
|
65
|
+
name?: string;
|
|
66
|
+
version?: string;
|
|
67
|
+
tools: McpTool[];
|
|
68
|
+
}): SdkMcpServer;
|
|
69
|
+
/**
|
|
70
|
+
* Serve Claudexor over stdio. The SDK entry owns the era decision per
|
|
71
|
+
* connection; the factory registers the same tools for every era.
|
|
72
|
+
*/
|
|
73
|
+
export declare function serveClaudexorMcp(opts: McpServerOptions): {
|
|
74
|
+
close(): Promise<void>;
|
|
75
|
+
};
|
|
76
|
+
export interface RunnerHooks {
|
|
77
|
+
/** Interactive question surface; resolve with answers or null to decline. */
|
|
78
|
+
onInteraction?: (ctx: any) => Promise<any | null>;
|
|
79
|
+
/** Cooperative cancellation: host `notifications/cancelled` aborts the run. */
|
|
80
|
+
signal?: AbortSignal;
|
|
81
|
+
}
|
|
82
|
+
export type RunnerFn = (params: any, hooks?: RunnerHooks) => Promise<unknown>;
|
|
83
|
+
/** Default Claudexor tool surface for MCP (v0.9: 5 canonical modes + strategy flags). */
|
|
84
|
+
export declare function defaultClaudexorTools(runner: RunnerFn): McpTool[];
|
|
85
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EACL,SAAS,IAAI,YAAY,EAG1B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAML,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACzB,MAAM,mBAAmB,CAAC;AAuD3B;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE;QAAE,cAAc,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,mBAAmB,EAAE,CAAA;KAAE,KAAK,OAAO,CAAC,iBAAiB,EAAE,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC;IAChI;;;;OAIG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,0EAA0E;AAC1E,MAAM,WAAW,kBAAkB;IACjC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;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AAI,CAAC,CAAC;IAClD,+EAA+E;IAC/E,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,MAAM,QAAQ,GAAG,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAmD9E,yFAAyF;AACzF,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,EAAE,CAsMjE"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,487 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { isAbsolute } from "node:path";
|
|
3
|
+
import { McpServer as SdkMcpServer, MissingRequiredClientCapabilityError, fromJsonSchema, } from "@modelcontextprotocol/server";
|
|
4
|
+
import { StdioServerTransport, serveStdio } from "@modelcontextprotocol/server/stdio";
|
|
5
|
+
import { EffortHint, ExternalContextPolicy, ProviderFamily, validateOptionalNonEmptyString, validateSurfaceRunControls, } from "@claudexor/schema";
|
|
6
|
+
import { assertNoInlineSecretValues, errorCode } from "@claudexor/util";
|
|
7
|
+
// Generated JSON Schemas from @claudexor/schema (the SSOT): declared to hosts
|
|
8
|
+
// as tool outputSchema so structured results are validated shapes, not blobs.
|
|
9
|
+
// zod-to-json-schema emits a `$ref`+`definitions` wrapper; the SDK's
|
|
10
|
+
// fromJsonSchema wants a self-contained schema, so internal refs are inlined
|
|
11
|
+
// once at load (cycle-safe: a cyclic ref degrades to a permissive subschema).
|
|
12
|
+
function inlineJsonSchemaRefs(schema) {
|
|
13
|
+
// zod-to-json-schema dedupes with FULL JSON-pointer refs (e.g.
|
|
14
|
+
// "#/definitions/X/properties/y/items"), so resolution walks pointers over
|
|
15
|
+
// the whole document, not just top-level definition names.
|
|
16
|
+
const resolvePointer = (pointer) => {
|
|
17
|
+
let node = schema;
|
|
18
|
+
for (const rawSegment of pointer.split("/").slice(1)) {
|
|
19
|
+
const segment = rawSegment.replaceAll("~1", "/").replaceAll("~0", "~");
|
|
20
|
+
if (Array.isArray(node))
|
|
21
|
+
node = node[Number(segment)];
|
|
22
|
+
else if (node && typeof node === "object")
|
|
23
|
+
node = node[segment];
|
|
24
|
+
else
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
return node;
|
|
28
|
+
};
|
|
29
|
+
const resolve = (node, stack) => {
|
|
30
|
+
if (Array.isArray(node))
|
|
31
|
+
return node.map((child) => resolve(child, stack));
|
|
32
|
+
if (!node || typeof node !== "object")
|
|
33
|
+
return node;
|
|
34
|
+
const obj = node;
|
|
35
|
+
const ref = obj["$ref"];
|
|
36
|
+
if (typeof ref === "string" && ref.startsWith("#/")) {
|
|
37
|
+
// Claudexor's generated schemas are trees; a cycle would mean a schema
|
|
38
|
+
// refactor introduced recursion — fail LOUDLY at server start rather
|
|
39
|
+
// than silently degrading validation to permissive.
|
|
40
|
+
if (stack.includes(ref))
|
|
41
|
+
throw new Error(`cyclic $ref '${ref}' in a generated tool schema — flatten the schema or drop its outputSchema`);
|
|
42
|
+
const target = resolvePointer(ref);
|
|
43
|
+
if (target === undefined)
|
|
44
|
+
throw new Error(`unresolved $ref '${ref}' in a generated tool schema`);
|
|
45
|
+
return resolve(target, [...stack, ref]);
|
|
46
|
+
}
|
|
47
|
+
const out = {};
|
|
48
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
49
|
+
if (key === "definitions")
|
|
50
|
+
continue;
|
|
51
|
+
out[key] = resolve(value, stack);
|
|
52
|
+
}
|
|
53
|
+
return out;
|
|
54
|
+
};
|
|
55
|
+
return resolve(schema, []);
|
|
56
|
+
}
|
|
57
|
+
const require = createRequire(import.meta.url);
|
|
58
|
+
const mcpRunToolResultSchema = inlineJsonSchemaRefs(require("@claudexor/schema/generated/McpRunToolResult.schema.json"));
|
|
59
|
+
const agentCapabilityCatalogSchema = inlineJsonSchemaRefs(require("@claudexor/schema/generated/AgentCapabilityCatalog.schema.json"));
|
|
60
|
+
/** Build the SDK server with Claudexor's tools registered (one era-agnostic factory). */
|
|
61
|
+
export function buildMcpServer(opts) {
|
|
62
|
+
const server = new SdkMcpServer({
|
|
63
|
+
name: opts.name ?? "claudexor",
|
|
64
|
+
version: opts.version ?? "dev",
|
|
65
|
+
});
|
|
66
|
+
for (const tool of opts.tools) {
|
|
67
|
+
server.registerTool(tool.name, {
|
|
68
|
+
description: tool.description,
|
|
69
|
+
inputSchema: fromJsonSchema(tool.inputSchema),
|
|
70
|
+
// Structured results are DECLARED (outputSchema) and mirrored in text;
|
|
71
|
+
// annotations are the MCP behavior hints (read-only vs mutating).
|
|
72
|
+
...(tool.outputSchema ? { outputSchema: fromJsonSchema(tool.outputSchema) } : {}),
|
|
73
|
+
...(tool.annotations ? { annotations: tool.annotations } : {}),
|
|
74
|
+
}, (async (args, ctx) => {
|
|
75
|
+
const provided = (args ?? {});
|
|
76
|
+
// Semantic checks a JSON Schema cannot express (absolute paths, the
|
|
77
|
+
// secret fence, cross-field equality). Structural validation already
|
|
78
|
+
// happened in the SDK against the same schema.
|
|
79
|
+
const validation = validateToolArguments(tool, provided);
|
|
80
|
+
if (validation) {
|
|
81
|
+
// The official SDK's contract: tool-argument failures surface as
|
|
82
|
+
// isError:true TOOL results (its own structural validation does the
|
|
83
|
+
// same), not JSON-RPC protocol errors — a thrown handler error maps
|
|
84
|
+
// there. The old hand-rolled -32602 contract is retired with it.
|
|
85
|
+
throw new Error(validation);
|
|
86
|
+
}
|
|
87
|
+
// Offer the elicitation bridge ONLY when the client declared the
|
|
88
|
+
// capability — otherwise the ENGINE must not think an interactive
|
|
89
|
+
// channel exists (it would offer the harness a channel whose every
|
|
90
|
+
// question dies as a decline).
|
|
91
|
+
const canElicit = Boolean(server.server.getClientCapabilities()?.elicitation);
|
|
92
|
+
const out = await tool.handler(provided, {
|
|
93
|
+
elicit: canElicit ? elicitBridge(ctx) : null,
|
|
94
|
+
signal: ctx?.mcpReq?.signal,
|
|
95
|
+
});
|
|
96
|
+
const text = typeof out === "string" ? out : out.text;
|
|
97
|
+
const structured = typeof out === "string" ? undefined : out.structured;
|
|
98
|
+
return {
|
|
99
|
+
content: [{ type: "text", text }],
|
|
100
|
+
...(structured !== undefined ? { structuredContent: structured } : {}),
|
|
101
|
+
};
|
|
102
|
+
}));
|
|
103
|
+
}
|
|
104
|
+
return server;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Serve Claudexor over stdio. The SDK entry owns the era decision per
|
|
108
|
+
* connection; the factory registers the same tools for every era.
|
|
109
|
+
*/
|
|
110
|
+
export function serveClaudexorMcp(opts) {
|
|
111
|
+
warnOnPluginVersionSkew(opts.version);
|
|
112
|
+
const serveOpts = {
|
|
113
|
+
...(opts.transport ? { transport: new StdioServerTransport(opts.transport.read, opts.transport.write) } : {}),
|
|
114
|
+
// Out-of-band transport errors go to stderr — stdout is the wire.
|
|
115
|
+
onerror: (err) => process.stderr.write(`claudexor mcp: ${err.message}\n`),
|
|
116
|
+
};
|
|
117
|
+
return serveStdio(() => buildMcpServer(opts), serveOpts);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Installed host plugins export CLAUDEXOR_PLUGIN_VERSION into the server env
|
|
121
|
+
* (plugins.ts). A mismatch with the running CLI means the host is driving a
|
|
122
|
+
* NEWER/OLDER runtime than the artifacts it discovered — tool schemas may be
|
|
123
|
+
* stale until `claudexor plugin repair`. Disclose on stderr (the wire stays
|
|
124
|
+
* clean); this is the env var's first real reader.
|
|
125
|
+
*/
|
|
126
|
+
function warnOnPluginVersionSkew(serverVersion) {
|
|
127
|
+
const pluginVersion = process.env["CLAUDEXOR_PLUGIN_VERSION"];
|
|
128
|
+
if (pluginVersion && serverVersion && pluginVersion !== serverVersion) {
|
|
129
|
+
// The env value is environment-sourced: never echo arbitrary content to
|
|
130
|
+
// the log — a non-version-shaped value is disclosed generically.
|
|
131
|
+
const shown = /^[\w.+-]{1,32}$/.test(pluginVersion) ? pluginVersion : "<non-version value>";
|
|
132
|
+
process.stderr.write(`claudexor mcp: plugin artifacts are version ${shown} but the CLI is ${serverVersion}; ` +
|
|
133
|
+
`run \`claudexor plugin repair all\` and reload the host to refresh cached tool schemas\n`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Map the SDK's server-initiated elicitation onto the engine's typed
|
|
138
|
+
* interaction questions. One elicitation per QUESTION (MCP forms are flat);
|
|
139
|
+
* a missing client capability resolves null so the engine's timeout-decline
|
|
140
|
+
* fallback applies — never a fake answer.
|
|
141
|
+
*/
|
|
142
|
+
function elicitBridge(ctx) {
|
|
143
|
+
const elicitInput = ctx?.mcpReq?.elicitInput;
|
|
144
|
+
if (typeof elicitInput !== "function")
|
|
145
|
+
return null;
|
|
146
|
+
return async ({ questions }) => {
|
|
147
|
+
const answers = [];
|
|
148
|
+
for (const q of questions) {
|
|
149
|
+
const hasOptions = q.options.length > 0;
|
|
150
|
+
const property = hasOptions
|
|
151
|
+
? q.multi_select
|
|
152
|
+
? { type: "array", items: { type: "string", enum: q.options.map((o) => o.label) }, description: optionLegend(q) }
|
|
153
|
+
: { type: "string", enum: q.options.map((o) => o.label), description: optionLegend(q) }
|
|
154
|
+
: { type: "string", description: "Free-text answer" };
|
|
155
|
+
let result;
|
|
156
|
+
try {
|
|
157
|
+
result = await ctx.mcpReq.elicitInput({
|
|
158
|
+
message: q.header ? `${q.header}: ${q.question}` : q.question,
|
|
159
|
+
requestedSchema: {
|
|
160
|
+
type: "object",
|
|
161
|
+
properties: { answer: property },
|
|
162
|
+
required: ["answer"],
|
|
163
|
+
},
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
catch (err) {
|
|
167
|
+
if (err instanceof MissingRequiredClientCapabilityError)
|
|
168
|
+
return null;
|
|
169
|
+
throw err;
|
|
170
|
+
}
|
|
171
|
+
if (result?.action !== "accept" || !result?.content || typeof result.content !== "object") {
|
|
172
|
+
// Decline/cancel any single question = decline the whole interaction
|
|
173
|
+
// (the engine treats partial answer sets as declines anyway).
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
const answer = result.content["answer"];
|
|
177
|
+
if (hasOptions && q.multi_select && Array.isArray(answer)) {
|
|
178
|
+
answers.push({ question_id: q.id, selected_labels: answer.map(String), free_text: null });
|
|
179
|
+
}
|
|
180
|
+
else if (hasOptions && typeof answer === "string") {
|
|
181
|
+
answers.push({ question_id: q.id, selected_labels: [answer], free_text: null });
|
|
182
|
+
}
|
|
183
|
+
else if (typeof answer === "string" && answer.trim()) {
|
|
184
|
+
answers.push({ question_id: q.id, selected_labels: [], free_text: answer });
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
return null;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return answers;
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
function optionLegend(q) {
|
|
194
|
+
const withDetail = q.options.filter((o) => o.description);
|
|
195
|
+
if (withDetail.length === 0)
|
|
196
|
+
return "Choose from the listed options";
|
|
197
|
+
return withDetail.map((o) => `${o.label}: ${o.description}`).join("; ");
|
|
198
|
+
}
|
|
199
|
+
function validateToolArguments(tool, args) {
|
|
200
|
+
if (!args || typeof args !== "object" || Array.isArray(args))
|
|
201
|
+
return "tool arguments must be an object";
|
|
202
|
+
const obj = args;
|
|
203
|
+
const allowed = new Set(Object.keys((tool.inputSchema.properties ?? {})));
|
|
204
|
+
for (const key of Object.keys(obj)) {
|
|
205
|
+
if (!allowed.has(key))
|
|
206
|
+
return `unknown argument: ${key}`;
|
|
207
|
+
}
|
|
208
|
+
// Prompt is required exactly when the tool's own schema REQUIRES it — no
|
|
209
|
+
// per-tool-name special cases (no-argument tools like status/capabilities
|
|
210
|
+
// simply do not declare a prompt property).
|
|
211
|
+
const requiredKeys = Array.isArray(tool.inputSchema.required) ? tool.inputSchema.required : [];
|
|
212
|
+
if (requiredKeys.includes("prompt")) {
|
|
213
|
+
if (typeof obj.prompt !== "string" || obj.prompt.trim().length === 0)
|
|
214
|
+
return "prompt must be a non-empty string";
|
|
215
|
+
}
|
|
216
|
+
const harnessError = validateOptionalNonEmptyString(obj.harness, "harness");
|
|
217
|
+
if (harnessError)
|
|
218
|
+
return harnessError;
|
|
219
|
+
if (obj.repoPath !== undefined && (typeof obj.repoPath !== "string" || !isAbsolute(obj.repoPath)))
|
|
220
|
+
return "repoPath must be an absolute path";
|
|
221
|
+
const nSchema = (tool.inputSchema.properties ?? {}).n;
|
|
222
|
+
const minN = typeof nSchema?.minimum === "number" ? nSchema.minimum : 1;
|
|
223
|
+
if (obj.n !== undefined && (!Number.isInteger(obj.n) || obj.n < minN))
|
|
224
|
+
return `n must be an integer >= ${minN}`;
|
|
225
|
+
// Shared semantic run-control rules (ONE owner in @claudexor/schema).
|
|
226
|
+
const runControlError = validateSurfaceRunControls(obj);
|
|
227
|
+
if (runControlError)
|
|
228
|
+
return runControlError;
|
|
229
|
+
return validateNoInlineSecrets(obj, "MCP tool arguments");
|
|
230
|
+
}
|
|
231
|
+
const PROVIDER_FAMILIES = ProviderFamily.options;
|
|
232
|
+
function validateNoInlineSecrets(value, context) {
|
|
233
|
+
try {
|
|
234
|
+
assertNoInlineSecretValues(value, "$", context);
|
|
235
|
+
return null;
|
|
236
|
+
}
|
|
237
|
+
catch (err) {
|
|
238
|
+
// MCP tool failures are text results (until structured outputs land):
|
|
239
|
+
// prefix the machine-readable class so hosts can branch on it.
|
|
240
|
+
const code = errorCode(err);
|
|
241
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
242
|
+
return code ? `${code}: ${message}` : message;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Render a run result for an MCP host: the human-readable summary FIRST, then
|
|
247
|
+
* the artifact handles (runId/artifacts/status) so the host can inspect,
|
|
248
|
+
* apply, follow, or unblock the run through the CLI — the old surface dropped
|
|
249
|
+
* the runId and left hosts with no handle at all.
|
|
250
|
+
*/
|
|
251
|
+
function formatRunResult(result) {
|
|
252
|
+
if (typeof result === "string")
|
|
253
|
+
return result.trim();
|
|
254
|
+
if (result && typeof result === "object") {
|
|
255
|
+
const r = result;
|
|
256
|
+
let summary = "";
|
|
257
|
+
for (const key of ["summary", "answer", "text"]) {
|
|
258
|
+
const v = r[key];
|
|
259
|
+
if (typeof v === "string" && v.trim()) {
|
|
260
|
+
summary = v.trim();
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
const trailer = [];
|
|
265
|
+
if (typeof r["runId"] === "string" && r["runId"])
|
|
266
|
+
trailer.push(`runId: ${r["runId"]}`);
|
|
267
|
+
if (typeof r["runDir"] === "string" && r["runDir"])
|
|
268
|
+
trailer.push(`artifacts: ${r["runDir"]}`);
|
|
269
|
+
if (typeof r["status"] === "string" && r["status"])
|
|
270
|
+
trailer.push(`status: ${r["status"]}`);
|
|
271
|
+
if (!summary && trailer.length === 0)
|
|
272
|
+
return JSON.stringify(result);
|
|
273
|
+
return trailer.length > 0 ? `${summary ? `${summary}\n\n` : ""}${trailer.join("\n")}` : summary;
|
|
274
|
+
}
|
|
275
|
+
return result === undefined || result === null ? "" : String(result);
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Structured mirror of a run result (McpRunToolResult shape): the SAME facts
|
|
279
|
+
* the text trailer carries, machine-readable — summary, recovery handles, and
|
|
280
|
+
* the derived apply-gate verdict when the runner surfaced one.
|
|
281
|
+
*/
|
|
282
|
+
function structuredRunResult(result) {
|
|
283
|
+
const r = (result && typeof result === "object" ? result : {});
|
|
284
|
+
let summary = typeof result === "string" ? result.trim() : "";
|
|
285
|
+
for (const key of ["summary", "answer", "text"]) {
|
|
286
|
+
const v = r[key];
|
|
287
|
+
if (!summary && typeof v === "string" && v.trim())
|
|
288
|
+
summary = v.trim();
|
|
289
|
+
}
|
|
290
|
+
return {
|
|
291
|
+
summary,
|
|
292
|
+
runId: typeof r["runId"] === "string" && r["runId"] ? r["runId"] : null,
|
|
293
|
+
runDir: typeof r["runDir"] === "string" && r["runDir"] ? r["runDir"] : null,
|
|
294
|
+
status: typeof r["status"] === "string" && r["status"] ? r["status"] : null,
|
|
295
|
+
applyEligibility: r["applyEligibility"] && typeof r["applyEligibility"] === "object" ? r["applyEligibility"] : null,
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
/** Default Claudexor tool surface for MCP (v0.9: 5 canonical modes + strategy flags). */
|
|
299
|
+
export function defaultClaudexorTools(runner) {
|
|
300
|
+
const reviewerModelProperties = Object.fromEntries(PROVIDER_FAMILIES.map((family) => [family, { type: "string", minLength: 1 }]));
|
|
301
|
+
const reviewerEffortProperties = Object.fromEntries(PROVIDER_FAMILIES.map((family) => [
|
|
302
|
+
family,
|
|
303
|
+
{ type: "string", enum: EffortHint.options },
|
|
304
|
+
]));
|
|
305
|
+
const promptSchema = (minN = 1) => ({
|
|
306
|
+
type: "object",
|
|
307
|
+
additionalProperties: false,
|
|
308
|
+
properties: {
|
|
309
|
+
prompt: { type: "string", minLength: 1, pattern: "\\S", description: "The user task or question to run through Claudexor." },
|
|
310
|
+
harness: { type: "string", minLength: 1, description: "Optional harness id to force for this one-shot run." },
|
|
311
|
+
primaryHarness: { type: "string", minLength: 1, description: "Optional primary harness id for this run." },
|
|
312
|
+
model: { type: "string", minLength: 1, description: "Optional model override for the primary harness." },
|
|
313
|
+
effort: { type: "string", enum: EffortHint.options, description: "Optional effort override for the primary harness." },
|
|
314
|
+
web: { type: "string", enum: ExternalContextPolicy.options, description: "External context policy for this run." },
|
|
315
|
+
externalContextPolicy: { type: "string", enum: ExternalContextPolicy.options, description: "Alias of web for control-api parity." },
|
|
316
|
+
n: { type: "integer", minimum: minN, description: "Optional best-of-N width for candidate races." },
|
|
317
|
+
repoPath: { type: "string", description: "Absolute path of the target project. Defaults to the MCP server cwd." },
|
|
318
|
+
tests: { type: "array", items: { type: "string", minLength: 1 }, description: "Deterministic gate commands for this run." },
|
|
319
|
+
maxUsd: { type: "number", minimum: 0, description: "Optional per-run budget ceiling." },
|
|
320
|
+
access: {
|
|
321
|
+
type: "string",
|
|
322
|
+
enum: ["readonly", "workspace_write", "full", "external_sandbox_full", "inherit_native"],
|
|
323
|
+
description: "Optional access profile for this run.",
|
|
324
|
+
},
|
|
325
|
+
reviewerPanel: {
|
|
326
|
+
type: "array",
|
|
327
|
+
minItems: 1,
|
|
328
|
+
description: "Explicit reviewer panel entries, preserving order and duplicates.",
|
|
329
|
+
items: {
|
|
330
|
+
type: "object",
|
|
331
|
+
additionalProperties: false,
|
|
332
|
+
properties: {
|
|
333
|
+
harness: { type: "string", minLength: 1 },
|
|
334
|
+
model: { type: "string", minLength: 1 },
|
|
335
|
+
effort: { type: "string", enum: ["low", "medium", "high", "xhigh", "max"] },
|
|
336
|
+
},
|
|
337
|
+
required: ["harness"],
|
|
338
|
+
},
|
|
339
|
+
},
|
|
340
|
+
reviewerModels: {
|
|
341
|
+
type: "object",
|
|
342
|
+
additionalProperties: false,
|
|
343
|
+
properties: reviewerModelProperties,
|
|
344
|
+
description: "Per-provider reviewer model overrides.",
|
|
345
|
+
},
|
|
346
|
+
reviewerEfforts: {
|
|
347
|
+
type: "object",
|
|
348
|
+
additionalProperties: false,
|
|
349
|
+
properties: reviewerEffortProperties,
|
|
350
|
+
description: "Per-provider reviewer effort overrides.",
|
|
351
|
+
},
|
|
352
|
+
protectedPathApprovals: {
|
|
353
|
+
type: "array",
|
|
354
|
+
description: "Typed approvals for existing protected path edits.",
|
|
355
|
+
items: {
|
|
356
|
+
type: "object",
|
|
357
|
+
additionalProperties: false,
|
|
358
|
+
properties: {
|
|
359
|
+
path: { type: "string", minLength: 1 },
|
|
360
|
+
reason: { type: "string", minLength: 1 },
|
|
361
|
+
},
|
|
362
|
+
required: ["path"],
|
|
363
|
+
},
|
|
364
|
+
},
|
|
365
|
+
},
|
|
366
|
+
required: ["prompt"],
|
|
367
|
+
});
|
|
368
|
+
// Behavior hints derive from the tool's MODE (data, not per-name hardcode):
|
|
369
|
+
// ask/audit/plan are read-only by construction, and MCP orchestrate is
|
|
370
|
+
// suggest-autonomy only (a read-only plan). Only agent-mode tools mutate.
|
|
371
|
+
const annotationsFor = (params) => params["mode"] === "agent" ? { readOnlyHint: false, destructiveHint: false } : { readOnlyHint: true };
|
|
372
|
+
const mk = (name, description, params, minN = 1) => ({
|
|
373
|
+
name,
|
|
374
|
+
description,
|
|
375
|
+
inputSchema: promptSchema(minN),
|
|
376
|
+
outputSchema: mcpRunToolResultSchema,
|
|
377
|
+
annotations: annotationsFor(params),
|
|
378
|
+
// Summary first, then the runId/artifacts trailer (hosts get a handle);
|
|
379
|
+
// the structured mirror carries the same facts machine-readably.
|
|
380
|
+
// The elicitation bridge rides the hooks: the runner surfaces the engine's
|
|
381
|
+
// interactive questions and this tool answers them via the host.
|
|
382
|
+
handler: async (args, ctx) => {
|
|
383
|
+
const result = await runner({ ...args, ...params }, {
|
|
384
|
+
...(ctx.signal ? { signal: ctx.signal } : {}),
|
|
385
|
+
...(ctx.elicit
|
|
386
|
+
? {
|
|
387
|
+
onInteraction: async (ictx) => {
|
|
388
|
+
const interactionId = ictx?.request?.interaction_id ?? "";
|
|
389
|
+
const answers = await ctx.elicit({
|
|
390
|
+
interaction_id: interactionId,
|
|
391
|
+
questions: Array.isArray(ictx?.request?.questions) ? ictx.request.questions : [],
|
|
392
|
+
});
|
|
393
|
+
// The TYPED InteractionAnswerSet carries the interaction id
|
|
394
|
+
// (ACP/daemon parity; the engine keys the set to the request).
|
|
395
|
+
return answers ? { interaction_id: interactionId, answers } : null;
|
|
396
|
+
},
|
|
397
|
+
}
|
|
398
|
+
: {}),
|
|
399
|
+
});
|
|
400
|
+
return { text: formatRunResult(result), structured: structuredRunResult(result) };
|
|
401
|
+
},
|
|
402
|
+
});
|
|
403
|
+
const runIdSchema = {
|
|
404
|
+
type: "object",
|
|
405
|
+
additionalProperties: false,
|
|
406
|
+
properties: { runId: { type: "string", minLength: 1, description: "Daemon run id (from a run tool's runId trailer or claudexor_runs)." } },
|
|
407
|
+
required: ["runId"],
|
|
408
|
+
};
|
|
409
|
+
return [
|
|
410
|
+
mk("claudexor_ask", "One-shot read-only answer through Claudexor; returns final output, not a live thread.", { mode: "ask" }),
|
|
411
|
+
mk("claudexor_explore", "One-shot bounded read-only exploration and synthesis through Claudexor.", { mode: "audit", swarm: true }),
|
|
412
|
+
mk("claudexor_run", "One-shot Agent-mode Claudexor run; returns the final WorkProduct summary plus runId.", { mode: "agent" }),
|
|
413
|
+
mk("claudexor_best_of", "One-shot best-of-N Claudexor run with cross-family review.", { mode: "agent", race: true }, 2),
|
|
414
|
+
mk("claudexor_plan", "One-shot read-only Claudexor implementation plan.", { mode: "plan" }),
|
|
415
|
+
mk("claudexor_create", "One-shot create-from-scratch Claudexor run.", { mode: "agent", create: true }),
|
|
416
|
+
mk("claudexor_orchestrate", "One-shot typed Claudexor orchestration plan over the tool belt.", { mode: "orchestrate" }),
|
|
417
|
+
{
|
|
418
|
+
name: "claudexor_status",
|
|
419
|
+
description: "Return doctor-backed Claudexor runtime status: per-harness verdicts with enabled/disabled intents, doctor reasons and checks, and the configured model.",
|
|
420
|
+
inputSchema: { type: "object", additionalProperties: false, properties: {} },
|
|
421
|
+
annotations: { readOnlyHint: true },
|
|
422
|
+
handler: async () => {
|
|
423
|
+
const result = await runner({ mode: "__status" });
|
|
424
|
+
return {
|
|
425
|
+
text: formatRunResult(result),
|
|
426
|
+
structured: (result && typeof result === "object" ? result : {}),
|
|
427
|
+
};
|
|
428
|
+
},
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
name: "claudexor_capabilities",
|
|
432
|
+
description: "Return the derived AgentCapabilityCatalog: per-harness live capabilities (doctor-backed), canonical modes, the mutability matrix, run-control keys, CLI verbs, and the run-apply-state vocabulary.",
|
|
433
|
+
inputSchema: { type: "object", additionalProperties: false, properties: {} },
|
|
434
|
+
outputSchema: agentCapabilityCatalogSchema,
|
|
435
|
+
annotations: { readOnlyHint: true },
|
|
436
|
+
handler: async () => {
|
|
437
|
+
const result = await runner({ mode: "__capabilities" });
|
|
438
|
+
return {
|
|
439
|
+
text: formatRunResult(result),
|
|
440
|
+
structured: (result && typeof result === "object" ? result : {}),
|
|
441
|
+
};
|
|
442
|
+
},
|
|
443
|
+
},
|
|
444
|
+
// Recovery tools — thin read-only wrappers over the daemon control API,
|
|
445
|
+
// so a host that lost a run handle (timeout, restart) can find it again.
|
|
446
|
+
{
|
|
447
|
+
name: "claudexor_runs",
|
|
448
|
+
description: "List recent daemon-tracked Claudexor runs (recovery: find a lost runId).",
|
|
449
|
+
inputSchema: { type: "object", additionalProperties: false, properties: {} },
|
|
450
|
+
annotations: { readOnlyHint: true },
|
|
451
|
+
handler: async () => {
|
|
452
|
+
const result = await runner({ mode: "__runs_list" });
|
|
453
|
+
return {
|
|
454
|
+
text: formatRunResult(result),
|
|
455
|
+
structured: (result && typeof result === "object" ? result : {}),
|
|
456
|
+
};
|
|
457
|
+
},
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
name: "claudexor_inspect",
|
|
461
|
+
description: "Inspect a daemon-tracked run: status, summary, decision verdict, and the derived applyEligibility (what unblocks apply).",
|
|
462
|
+
inputSchema: runIdSchema,
|
|
463
|
+
annotations: { readOnlyHint: true },
|
|
464
|
+
handler: async (args) => {
|
|
465
|
+
const result = await runner({ mode: "__run_inspect", runId: String(args?.runId ?? "") });
|
|
466
|
+
return {
|
|
467
|
+
text: formatRunResult(result),
|
|
468
|
+
structured: (result && typeof result === "object" ? result : {}),
|
|
469
|
+
};
|
|
470
|
+
},
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
name: "claudexor_apply_check",
|
|
474
|
+
description: "Dry-check whether a run's patch would apply cleanly to its original project (no mutation).",
|
|
475
|
+
inputSchema: runIdSchema,
|
|
476
|
+
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
477
|
+
handler: async (args) => {
|
|
478
|
+
const result = await runner({ mode: "__apply_check", runId: String(args?.runId ?? "") });
|
|
479
|
+
return {
|
|
480
|
+
text: formatRunResult(result),
|
|
481
|
+
structured: (result && typeof result === "object" ? result : {}),
|
|
482
|
+
};
|
|
483
|
+
},
|
|
484
|
+
},
|
|
485
|
+
];
|
|
486
|
+
}
|
|
487
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,EACL,SAAS,IAAI,YAAY,EACzB,oCAAoC,EACpC,cAAc,GACf,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAA0B,MAAM,oCAAoC,CAAC;AAC9G,OAAO,EACL,UAAU,EACV,qBAAqB,EACrB,cAAc,EACd,8BAA8B,EAC9B,0BAA0B,GAG3B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,0BAA0B,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAExE,8EAA8E;AAC9E,8EAA8E;AAC9E,qEAAqE;AACrE,6EAA6E;AAC7E,8EAA8E;AAC9E,SAAS,oBAAoB,CAAC,MAA+B;IAC3D,+DAA+D;IAC/D,2EAA2E;IAC3E,2DAA2D;IAC3D,MAAM,cAAc,GAAG,CAAC,OAAe,EAAW,EAAE;QAClD,IAAI,IAAI,GAAY,MAAM,CAAC;QAC3B,KAAK,MAAM,UAAU,IAAI,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;YACrD,MAAM,OAAO,GAAG,UAAU,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;YACvE,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;gBAAE,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;iBACjD,IAAI,IA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AE,CAA4B;iBAC5F,CAAC;YACJ,CAAC;SACF;QACD;YACE,IAAI,EAAE,uBAAuB;YAC7B,WAAW,EAAE,4FAA4F;YACzG,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE;YACzD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;gBACtB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;gBACzF,OAAO;oBACL,IAAI,EAAE,eAAe,CAAC,MAAM,CAAC;oBAC7B,UAAU,EAAE,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAA4B;iBAC5F,CAAC;YACJ,CAAC;SACF;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@claudexor/mcp-server",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "MCP server (official SDK, stdio) exposing Claudexor run/status tools with elicitation-backed interactive questions.",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@modelcontextprotocol/server": "2.0.0-beta.1",
|
|
20
|
+
"@claudexor/util": "1.0.0",
|
|
21
|
+
"@claudexor/schema": "1.0.0"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/razzant/claudexor.git",
|
|
26
|
+
"directory": "packages/mcp-server"
|
|
27
|
+
},
|
|
28
|
+
"homepage": "https://github.com/razzant/claudexor#readme",
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": "https://github.com/razzant/claudexor/issues"
|
|
31
|
+
},
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=20.19"
|
|
34
|
+
},
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "tsc",
|
|
40
|
+
"typecheck": "tsc --noEmit"
|
|
41
|
+
}
|
|
42
|
+
}
|