Skip to main content
Glama
SobieskiCodes

MCP-Claude Code Bridge

claude_code_task

Execute coding tasks using Claude Code CLI to build applications, create APIs, and debug scripts while maintaining interaction through Claude Desktop.

Instructions

Execute a coding task using Claude Code CLI

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
taskYesThe coding task to execute
project_pathNoPath to the project directory

Implementation Reference

  • Tool schema definition for claude_code_task with input parameters (task: required string, project_path: optional string)
    name: "claude_code_task", description: "Execute a coding task using Claude Code CLI", inputSchema: { type: "object", properties: { task: { type: "string", description: "The coding task to execute" }, project_path: { type: "string", description: "Path to the project directory", default: "" } }, required: ["task"] } },
  • server.js:135-136 (registration)
    Registration case that routes claude_code_task calls to the executeClaudeCodeTask handler function
    case 'claude_code_task': return await this.executeClaudeCodeTask(args.task, args.project_path);
  • Main handler implementation that spawns claude-code CLI process with the task, captures stdout/stderr, and returns formatted results
    async executeClaudeCodeTask(task, projectPath = '') { return new Promise((resolve, reject) => { const fullPath = projectPath ? path.join(this.workingDir, projectPath) : this.workingDir; const claudeCode = spawn('claude-code', [task], { cwd: fullPath, stdio: ['pipe', 'pipe', 'pipe'], env: { ...process.env, ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY } }); let stdout = ''; let stderr = ''; claudeCode.stdout.on('data', (data) => { stdout += data.toString(); }); claudeCode.stderr.on('data', (data) => { stderr += data.toString(); }); claudeCode.on('close', (code) => { if (code === 0) { resolve({ content: [ { type: "text", text: `Claude Code task completed successfully:\n\n${stdout}` } ] }); } else { resolve({ content: [ { type: "text", text: `Claude Code task failed (exit code ${code}):\n\nSTDOUT:\n${stdout}\n\nSTDERR:\n${stderr}` } ] }); } }); claudeCode.on('error', (error) => { reject(new Error(`Failed to execute Claude Code: ${error.message}`)); }); }); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/SobieskiCodes/claude-desktop-mcp-to-claude-agent'

If you have feedback or need assistance with the MCP directory API, please join our Discord server