diff --git a/README.md b/README.md index bfbf303..f9e1606 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@ # delegate-ai-mcp -An MCP server that lets Claude Code delegate light, low-stakes work to a local -[qwen-code](https://github.com/QwenLM/qwen-code) CLI instance, instead of spending its own -budget on it. +MCP servers that let Claude Code delegate light, low-stakes work to local AI CLI backends, +instead of spending its own budget on it. Currently one backend: qwen-code. ## How it works @@ -17,10 +16,18 @@ was confirmed. Replies can take several minutes on a cold local model, so the to generous (10 min) timeout rather than trying to enforce "light work" in code — that's a judgment call left to whoever's calling the tool. +Each backend is its own MCP server process with its own `claude mcp add` registration — +there's no single multi-tool server. Adding a second backend means adding its own +`src/-delegate.ts` + `src/-delegate-server.ts` pair and registering it +separately (see Status below — the shared subprocess helper this implies isn't extracted yet). + +No build step: everything runs as plain `.ts` source via Node's native TypeScript +type-stripping. No `tsconfig.json`, no `dist/`, no lint/format tooling — deliberate choices, +not oversights (see the wayfinder map linked below). + ## Prerequisites -- Node.js 24+ (the server runs `.ts` source directly via Node's native TypeScript - type-stripping — no build step, no compiler) +- Node.js 24+ (native TypeScript type-stripping) - `qwen` on `PATH` and working (`qwen -p "test"` should return a reply) ## Setup @@ -61,9 +68,12 @@ Runs `test/qwen-delegate.test.ts` on Node's built-in test runner (`node --test`) framework dependency. The subprocess spawn is mocked, so tests run in milliseconds and don't require a live `qwen` install. -## Status / roadmap +## Status -Project conventions (build/typecheck strategy, lint/format tooling, multi-tool source -structure, publish-shaped `package.json`) are being worked through a +Project conventions are being worked through a [wayfinder map](https://git.arthurerlich.de/haylan/delegate-ai-mcp/issues/1) on this repo's -issue tracker — see `docs/agents/issue-tracker.md` for how issues/tickets work here. +issue tracker (see `docs/agents/issue-tracker.md` for how issues/tickets work here). Decided +so far: no build process, ever; separate MCP server process + registration per backend, with a +shared `src/lib/spawn-cli.ts` helper once a second backend exists (not extracted yet — still +just `qwen-delegate.ts`); no lint/format tooling for now. Still open: a publish-shaped +`package.json`. diff --git a/src/qwen-delegate-server.ts b/src/qwen-delegate-server.ts index c39145d..7162484 100644 --- a/src/qwen-delegate-server.ts +++ b/src/qwen-delegate-server.ts @@ -16,8 +16,7 @@ server.registerTool( title: "Delegate to qwen", description: "Delegate a light, low-stakes prompt (simple lookups, quick research, boilerplate text, " + - "small single-file edits) to the local qwen-code CLI, offloading it from the main session. " + - "Can take several minutes to respond — only use for work that doesn't block on a fast reply.", + "small single-file edits) to the local qwen-code CLI, offloading it from the main session. ", inputSchema: { prompt: z.string().describe("The prompt to send to qwen, non-interactively."), }, diff --git a/src/qwen-delegate.ts b/src/qwen-delegate.ts index 2f8bfed..04317a9 100644 --- a/src/qwen-delegate.ts +++ b/src/qwen-delegate.ts @@ -10,7 +10,8 @@ export interface DelegateResult { } export interface DelegateOptions { - /** Milliseconds before giving up. qwen-code has been observed taking 3-6 min for a trivial + /** Milliseconds before giving up. qwen-code has been observed taking 3-6 min for a trivial, + * takes time to warm up on the first request, * prompt against a local model proxy, so default generous — see research/qwen-mcp-delegation.md. */ timeoutMs?: number; /** Injectable for tests. Defaults to node:child_process's spawn. */ @@ -24,7 +25,7 @@ const DEFAULT_TIMEOUT_MS = 10 * 60 * 1000; // 10 min * qwen-code prints startup warnings (e.g. failed MCP sub-servers) to stderr; those are * ignored on success and surfaced only when the run itself fails. */ -export function delegateToQwen( +export function delegateToQwen ( prompt: string, options: DelegateOptions = {}, ): Promise {