mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-15 10:59:32 +01:00
feat(mcp): codeman mcp, a Model Context Protocol server for any MCP client
Agents pick tools from MCP clients and registries, and Codeman had no MCP surface: an assistant in Claude Desktop, Cursor, Codex or Gemini CLI could not start or drive Codeman sessions without hand-written HTTP calls. `codeman mcp` is a stdio MCP server and a CLIENT of the existing HTTP API (it reuses codeman agent's transport and guards; no new route). Seven tools: list_sessions, start_session, send_prompt, wait_for_session, read_output, interrupt_session, delete_session. - Dual-era: answers the legacy initialize handshake (2024-11-05 to 2025-11-25) and the 2026-07-28 revision (per-request _meta, server/discover, resultType, and the ttlMs/cacheScope hints a modern tools/list must carry: Claude Code 2.1.296 drops every tool without them). - Never guesses a server: the URL comes from --url or CODEMAN_API_URL. Unconfigured, it still lists its tools and every call says how to configure it. - Prompting, interrupting and deleting are limited to sessions the process started (or, inside a Codeman pane, that session's own workers) unless --allow-any-session; never its own session. Control bytes are refused before any request. - Waits default to 45 s (Codex's MCP tool timeout is 60 s), max 600 s. - read_output returns text only: a client that prefers structuredContent otherwise showed the model metadata instead of the output. - config/mcp-registry/server.json and package.json mcpName prepare the official MCP registry listing; sync-plugin.mjs keeps its version. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
aa3730aace
commit
c041a418e0
12 files changed
+1797
-8
No files matched your search
+20
@@ -20,6 +20,7 @@ import { casePath } from './config/cases-dir.js';
|
||||
import { assertValidBasePath } from './config/base-path.js';
|
||||
import { installAgentSkillInto, removeAgentSkillFrom, type AgentSkillApplyResult } from './hooks-config.js';
|
||||
import { registerAgentCommands } from './cli-agent.js';
|
||||
import { resolveMcpConfig, runMcpStdio } from './mcp-server.js';
|
||||
import { getSessionManager } from './session-manager.js';
|
||||
import { getTaskQueue } from './task-queue.js';
|
||||
import { getRalphLoop } from './ralph-loop.js';
|
||||
@@ -234,6 +235,25 @@ skillCmd
|
||||
|
||||
registerAgentCommands(program);
|
||||
|
||||
// ============ MCP server (any MCP client drives Codeman) ============
|
||||
|
||||
program
|
||||
.command('mcp')
|
||||
.description(
|
||||
'Run a Model Context Protocol server on stdio, so MCP clients (Claude Code, Claude Desktop, Codex, Gemini CLI, Cursor, ...) can start, prompt, wait on, read and delete Codeman sessions'
|
||||
)
|
||||
.option('--url <url>', 'Codeman server URL (default: $CODEMAN_API_URL; never guessed)')
|
||||
.option(
|
||||
'--allow-any-session',
|
||||
'Let the tools prompt, interrupt and delete sessions this server did not start (default: only its own)'
|
||||
)
|
||||
.action(async (options: { url?: string; allowAnySession?: boolean }) => {
|
||||
await runMcpStdio(
|
||||
resolveMcpConfig({ url: options.url, allowAnySession: options.allowAnySession, version: pkg.version })
|
||||
);
|
||||
process.exit(0);
|
||||
});
|
||||
|
||||
// ============ Session Commands ============
|
||||
|
||||
const sessionCmd = program.command('session').alias('s').description('Manage Claude sessions');
|
||||
|
||||
Reference in new issue
Block a user