Add README
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CRnb5Gqdu7gVTQrwAqFdfJ
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
# 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.
|
||||
|
||||
## How it works
|
||||
|
||||
- `src/qwen-delegate.ts` — core logic: spawns `qwen -p "<prompt>"`, captures stdout, handles
|
||||
timeouts and errors. Exported separately from the MCP wiring so it's unit-testable without a
|
||||
live MCP connection or a live qwen endpoint.
|
||||
- `src/qwen-delegate-server.ts` — thin MCP stdio server exposing one tool, `qwen_delegate`.
|
||||
|
||||
qwen-code runs natively on Windows here (no WSL), backed by a local OpenAI-compatible model
|
||||
proxy configured in `~/.qwen/settings.json`. See `research/qwen-mcp-delegation.md` for how that
|
||||
was confirmed. Replies can take several minutes on a cold local model, so the tool uses a
|
||||
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.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Node.js 24+ (the server runs `.ts` source directly via Node's native TypeScript
|
||||
type-stripping — no build step, no compiler)
|
||||
- `qwen` on `PATH` and working (`qwen -p "test"` should return a reply)
|
||||
|
||||
## Setup
|
||||
|
||||
```bash
|
||||
npm install
|
||||
npm test
|
||||
```
|
||||
|
||||
## Register with Claude Code
|
||||
|
||||
Global (available in every project):
|
||||
|
||||
```bash
|
||||
claude mcp add --scope user qwen-delegate -- node /absolute/path/to/src/qwen-delegate-server.ts
|
||||
```
|
||||
|
||||
Verify it connected:
|
||||
|
||||
```bash
|
||||
claude mcp list
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Once registered, Claude Code can call the `qwen_delegate` tool directly. The routing
|
||||
convention — *when* to delegate — lives in `~/.claude/CLAUDE.md` under "Delegating light work
|
||||
to qwen": simple lookups, quick research, boilerplate text, small single-file edits. Claude
|
||||
decides per-request; there's no enforced dispatcher.
|
||||
|
||||
## Testing
|
||||
|
||||
```bash
|
||||
npm test
|
||||
```
|
||||
|
||||
Runs `test/qwen-delegate.test.ts` on Node's built-in test runner (`node --test`) — no test
|
||||
framework dependency. The subprocess spawn is mocked, so tests run in milliseconds and don't
|
||||
require a live `qwen` install.
|
||||
|
||||
## Status / roadmap
|
||||
|
||||
Project conventions (build/typecheck strategy, lint/format tooling, multi-tool source
|
||||
structure, publish-shaped `package.json`) 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.
|
||||
Reference in New Issue
Block a user