MCP Workflow CLI Bridge

MCP Workflow CLI Bridge

Acts as a unified dispatch hub for local coding agent CLIs, supporting capability-based routing, schema validation, and retries via MCP tools.

Category
访问服务器

README

<h1 align="center">MCP Workflow CLI Bridge</h1>

<p align="center"> <img src="https://github.com/mateusoliveirab/mcp-workflow-cli-bridge/actions/workflows/ci.yml/badge.svg" alt="CI" /> <img src="https://img.shields.io/badge/node-%3E%3D20-blue" alt="node" /> <img src="https://img.shields.io/badge/typescript-5.x-blue" alt="typescript" /> <img src="https://img.shields.io/badge/license-MIT-green" alt="license" /> <img src="https://img.shields.io/badge/mcp-supported-orange" alt="mcp" /> </p>

A local Model Context Protocol (MCP) server that acts as a dispatch hub, routing tasks to coding agent CLIs installed on your local machine (claude, codex, opencode, gemini, agy).

It provides capability-based routing, CLI availability discovery, strict JSON Schema output validation, automatic execution retries, and a normalized response envelope.

Table of Contents

Problem & Context

Claude Code Dynamic Workflows (.claude/workflows/*.js) and other MCP clients often need to delegate sub-tasks to specialized CLI engines—e.g., Codex for structured output with image analysis, or OpenCode for lightweight generation—without hardcoding provider-specific APIs or rewriting execution logic for each different client environment.

The MCP Workflow CLI Bridge solves this by abstracting local CLI tool execution behind a standardized MCP interface.

How It Works

Claude Dynamic Workflow (.claude/workflows/*.js)
  -> agent() call with agentType: "workflow-cli-router"
  -> .claude/agents/workflow-cli-router.md (Claude subagent)
  -> MCP tool: code_cli_bridge.run_agent
  -> broker: routing + schema validation + retry
  -> provider adapter (claude | codex | opencode | gemini | agy)
  -> local CLI process
  -> normalized response envelope

[!NOTE] What this project is not:

  • It does not port the Claude workflow runtime to other clients; .claude/workflows/*.js continues to run natively within Claude Code.
  • It is not a persistent background daemon. One process is spawned per MCP session.

Supported Providers & Capabilities

Below is the capabilities matrix for the supported local CLI engines:

Provider CLI structuredOutput images sandbox skipPermissions
claude Yes - - Yes
codex Yes Yes Yes Yes
gemini Yes - - -
opencode Yes Yes - Yes
agy - - Yes Yes

If a call requires a capability the target provider does not support (e.g., passing a schema to agy), the broker rejects the request with a validation error before spawning any process.

Installation & Client Configuration

Prerequisites

  • Node.js >= 20.19.4
  • Local installation of the CLI engines you plan to use (e.g., claude, codex, etc.) available on your system PATH.
git clone https://github.com/mateusoliveirab/mcp-workflow-cli-bridge.git
cd mcp-workflow-cli-bridge
npm install

1. Claude Desktop

Add the server configuration to your claude_desktop_config.json:

MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "mcp-workflow-cli-bridge": {
      "command": "node",
      "args": ["--import", "tsx", "/absolute/path/to/mcp-workflow-cli-bridge/src/mcp-server.ts"]
    }
  }
}

2. Claude Code

To use this inside Claude Code, define the server in your project's local .mcp.json configuration file:

{
  "mcpServers": {
    "mcp-workflow-cli-bridge": {
      "cwd": ".",
      "command": "node",
      "args": ["--import", "tsx", "/absolute/path/to/mcp-workflow-cli-bridge/src/mcp-server.ts"]
    }
  }
}

Then, create .claude/agents/workflow-cli-router.md to map agent work to code_cli_bridge.run_agent.

3. Codex Plugin

You can add the bridge directly as a Codex plugin:

codex plugin marketplace add /path/to/mcp-workflow-cli-bridge
codex plugin add mcp-workflow-cli-bridge@mcp-workflow-cli-bridge-local

4. Cursor / Windsurf

In Cursor/Windsurf, navigate to Settings -> Features -> MCP and add a new MCP Server:

  • Name: mcp-workflow-cli-bridge
  • Type: command
  • Command: node --import tsx /absolute/path/to/mcp-workflow-cli-bridge/src/mcp-server.ts

MCP Tools Spec

code_cli_bridge.providers

Returns all registered provider adapters, their capabilities, and whether their CLI binaries are available on the user's PATH.

code_cli_bridge.run_agent

Runs a task on the targeted provider.

Parameters:

Field Type Required Description
prompt string Yes Task instruction/prompt
cwd string Yes Working directory for the CLI process
workflow string Yes Name of the active workflow (for logging)
phase string Yes Active workflow phase (used for route matching)
label string Yes Step label (for logging)
provider string No Overrides routing config to target a specific provider
schema object No JSON Schema to strictly validate provider output against
attachments object[] No List of attachment inputs, e.g. [{"type": "image", "path": "path/to/img.png"}]

Example Call:

{
  "workflow": "blog-pipeline",
  "phase": "Generate",
  "label": "generate:iter1",
  "cwd": "/path/to/project",
  "prompt": "Generate a blog post about TypeScript performance",
  "provider": "codex",
  "schema": {
    "type": "object",
    "properties": {
      "title": { "type": "string" },
      "body": { "type": "string" }
    },
    "required": ["title", "body"]
  }
}

Routing Configuration

Create a route-config.json at your repository root to govern automatic tool execution routing:

{
  "defaultProvider": "opencode",
  "routes": [
    { "phase": "Extract", "provider": "codex" },
    { "phase": "Generate", "provider": "opencode" }
  ]
}

If no route configuration matches, the broker will auto-select a provider only if exactly one available CLI satisfies the requested capabilities.

Security & Sandbox Guidelines

[!WARNING] Because this bridge executes local CLI commands on your host system:

  1. Use providers supporting sandboxing (e.g., codex, agy with sandbox flags) when executing untrusted workflow instructions.
  2. Ensure sensitive files (.env, credentials.json) are excluded in your project configurations.
  3. Limit the permissions granted to local agent sessions.

Development & Testing

Run the local test suite using:

npm install
npm test          # Runs 50 deterministic tests via node:test
npm run typecheck # Strict TypeScript check

Validate provider connectivity without spawning actual CLI tasks:

npm run smoke

Validate live provider adapters (requires the corresponding CLI binaries installed and configured):

npm run live:validate
npm run live:validate:claude

Contributing

See our CONTRIBUTING.md for guidelines on developer setup, coding style, and test validations.

Changelog

For a full list of changes and releases, see CHANGELOG.md.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选