Token导航 LogoToken导航TokenDH.com
Gemini Workflow Bridge MCP logo
AI代理stdio官方级别未说明来源级核验

Gemini Workflow Bridge MCP

MCP Server

Gemini Workflow Bridge MCP 是一个结合了 Gemini 和 Claude 的上下文压缩引擎,通过 Gemini 提供事实提取和 Claude 进行推理,实现高质量的规范生成和代码编辑,同时显著降低 Claude 的令牌使用成本。

工具数

11

提示词数

0

GitHub Stars

0

资源数

0
PythonClaude工作流自动化Claude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

hitoshura25

提供方

hitoshura25

最后核验

2026/5/17 20:22

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

pip install -e .

详细介绍

Gemini工作流桥MCP

Gemini作为上下文压缩引擎+Claude作为推理引擎=A级结果

概述

此MCP是 上下文压缩引擎 这最佳地利用了Claude Code和Gemini的优势。

主要特点

  • 质量: A级规格(双子座提供事实,克劳德进行推理)
  • 成本: Claude代币减少47-61%(昂贵的操作转移到免费的Gemini层)
  • 压缩: 174:1令牌压缩比(50K令牌→ 300 令牌摘要)
  • DX: 自动生成的工作流和常用任务的斜线命令

建筑

┌─────────────────────────────────────────┐
│   Claude Code (Reasoning Engine)        │
│   - Superior planning & specifications  │
│   - Precise code editing                │
│   - A-grade output quality              │
└──────────────┬──────────────────────────┘
               │ MCP Protocol
               ↓
┌─────────────────────────────────────────┐
│   MCP Server (Compression Layer)        │
│   - 50K tokens → 300 token summaries    │
│   - Fact extraction only                │
│   - Validation & consistency checks     │
└──────────────┬──────────────────────────┘
               │ Gemini CLI
               ↓
┌─────────────────────────────────────────┐
│   Gemini (Context Engine)               │
│   - 2M token window (free tier)         │
│   - Factual extraction only             │
│   - No opinions or planning             │
└─────────────────────────────────────────┘

安装

先决条件

  1. Gemini CLI -安装并验证:
   npm install -g @google/gemini-cli
   gemini  # Follow authentication prompts
  1. Python 3.11+ 使用pip

安装MCP服务器

# Clone the repository
git clone https://github.com/hitoshura25/gemini-workflow-bridge-mcp
cd gemini-workflow-bridge-mcp

# Install dependencies
pip install -e .

配置Claude代码

添加到您的Claude Code MCP设置中(通常 claude_desktop_config.json):

{
  "mcpServers": {
    "gemini-workflow-bridge": {
      "command": "python",
      "args": ["-m", "hitoshura25_gemini_workflow_bridge"],
      "env": {
        "CONTEXT_CACHE_TTL_MINUTES": "30",
        "MAX_TOKENS_PER_ANSWER": "300",
        "TARGET_COMPRESSION_RATIO": "100"
      }
    }
  }
}

快速开始

1.设置工作流(推荐的第一步)

安装MCP服务器后,设置推荐的工作流:

In Claude Code:
"Set up the spec-only workflow for me"

Claude will use setup_workflows_tool to create:
- .claude/workflows/spec-only.md
- .claude/commands/spec-only.md

现在,您可以使用 /spec-only 斜线命令:

/spec-only Add user authentication with OAuth2 support

要设置所有工作流,请执行以下操作:

"Set up all workflows"

Creates: spec-only, feature, refactor, and review workflows

2.直接使用工具

# 1. Extract facts about your codebase
query_codebase_tool(
    questions=["How is authentication implemented?"],
    scope="src/"
)
# Returns: Compressed facts with file:line references

# 2. Create specification using those facts (Claude does this)
# [Your reasoning creates A-grade spec here]

# 3. Validate specification
validate_against_codebase_tool(
    spec_content="...",
    validation_checks=["missing_files", "undefined_dependencies"]
)
# Returns: Completeness score, issues, suggestions

文档

工具概述

🔍 第1层:事实提取

工具目的关键功能
query_codebase_tool()多问题分析174:1压缩比
find_code_by_intent_tool()语义搜索返回摘要,而不是完整代码
trace_feature_tool()遵循执行流程逐步处理数据流
list_error_patterns_tool()提取图案边缘过滤

✅ 第2层:验证

工具目的
validate_against_codebase_tool()验证规格的完整性
check_consistency_tool()验证图案对齐

🚀 第3层:工作流自动化

工具目的快速示例
setup_workflows_tool()设置推荐的工作流程workflows=["all"]
generate_feature_workflow_tool()生成可执行工作流逐步披露
generate_slash_command_tool()创建自定义斜线命令自动化常见任务

🔍 第4层:工具发现

工具目的快速示例
discover_tools()按关键字、类别或用例查找工具query="validation"category="fact_extraction"
get_tool_schema()获取特定工具的详细架构tool_name="query_codebase_tool"

示例:完整功能实现

User: "Add Redis caching to product API"

# Step 1: Extract facts
→ query_codebase_tool(questions=[...])
← 52K tokens → 387 tokens (134:1 compression)

# Step 2: Claude creates A-grade spec using facts
→ [Your superior reasoning]
← High-quality specification

# Step 3: Validate spec
→ validate_against_codebase_tool(spec=...)
← Completeness: 92%, 1 minor issue

# Step 4: Implement
→ [Your precise code editing]

Result: ✅ A-grade spec, 61% token savings, 3.5 minutes

运作原理

特性描述
规范创建Claude生成A级规格
令牌使用情况3100个克劳德代币(与传统方法相比减少61%)
双子座角色仅提供事实
克劳德角色用事实从头开始创造
质量A级
工作流自动生成

配置

关键环境变量(参见 .env.example 所有人):

# Context & Compression
CONTEXT_CACHE_TTL_MINUTES=30     # Cache duration
MAX_TOKENS_PER_ANSWER=300        # Compression target
TARGET_COMPRESSION_RATIO=100     # Aim for 100:1
GEMINI_MODEL=auto                # or specific model

# Retry Mechanism (Exponential Backoff)
GEMINI_RETRY_MAX_ATTEMPTS=3      # Total attempts (1 initial + 2 retries)
GEMINI_RETRY_INITIAL_DELAY=1.0   # Starting delay in seconds
GEMINI_RETRY_MAX_DELAY=60.0      # Maximum delay in seconds
GEMINI_RETRY_BASE=2.0            # Exponential backoff multiplier (delay = initial * base^attempt)
GEMINI_RETRY_ENABLED=true        # Enable/disable retry mechanism

# Command/Workflow Prefixes (Namespace Management)
GEMINI_COMMAND_PREFIX=gemini-    # Prefix for generated commands
GEMINI_WORKFLOW_PREFIX=gemini-   # Prefix for generated workflows
                                 # Set to empty string to disable

用法示例

# 1. Get facts
facts = query_codebase_tool(questions=[...])

# 2. Create spec (Claude does this with superior reasoning)
spec = create_your_a_grade_spec(facts)

# 3. Validate
validate_against_codebase_tool(spec=spec)

故障排除

“找不到Gemini CLI”

npm install -g @google/gemini-cli

“双子座的空洞回应”

gemini --version  # Check installation
gemini            # Re-authenticate if needed

发展

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run with debug logging
DEBUG_MODE=true python -m hitoshura25_gemini_workflow_bridge

项目结构

hitoshura25_gemini_workflow_bridge/
├── tools/           # 8 tools (Tier 1, 2, 3)
├── prompts/         # Strict fact extraction prompts
├── workflows/       # Workflow templates
├── utils/           # Token counting, prompt loading
├── server.py        # MCP server
└── generator.py     # Legacy implementations

成功指标

  • 成本降低61% 克劳德代币
  • 174:1压缩比 (50K → 300 代币)
  • A级质量 规格
  • 渐进式披露 使用工作流

贡献

欢迎投稿!请阅读:

  1. 实施计划
  2. 架构概述
  3. 提交带有测试的PR

许可证

Apache 2.0许可证-请参阅 许可证

鸣谢

______________________________________________________________________

状态: ✅ 生产就绪 最后更新时间: 2025年11月15日

🌟 如果你觉得这很有用,请在GitHub上给我们加星!

目录标签

目录标签

PythonClaude工作流自动化上下文压缩本地部署规范生成代码编辑令牌优化

支持客户端

Claude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

token

工具数量(toolCount,工具数)

11

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdiotoken部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP