Files
delegate-ai-mcp/src/qwen-delegate-server.ts
T
haylanandClaude-Bot 061a1f381d Rewrite README to match locked TS conventions; minor tool/doc tweaks
Reflects the resolved wayfinder map (issue #1): no build process ever,
separate MCP server process + registration per backend, no lint/format
tooling. Also includes small wording tweaks to the qwen_delegate tool
description and timeout comment made outside this session.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CRnb5Gqdu7gVTQrwAqFdfJ
2026-09-06 18:12:42 +02:00

34 lines
1.2 KiB
JavaScript

#!/usr/bin/env node
// MCP stdio server exposing a single tool, qwen_delegate, that runs a prompt through the
// local qwen-code CLI (see research/qwen-mcp-delegation.md). Register globally with:
// claude mcp add --scope user qwen-delegate -- node <path-to-this-file>
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { z } from "zod";
import { delegateToQwen } from "./qwen-delegate.ts";
const server = new McpServer({ name: "qwen-delegate", version: "0.1.0" });
server.registerTool(
"qwen_delegate",
{
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. ",
inputSchema: {
prompt: z.string().describe("The prompt to send to qwen, non-interactively."),
},
},
async ({ prompt }) => {
const result = await delegateToQwen(prompt);
return {
content: [{ type: "text", text: result.output }],
isError: !result.ok,
};
},
);
await server.connect(new StdioServerTransport());