FlowCheck MCP服务器
🛡️ 人工智能优先开发的生产级安全层
_Git卫生监控+安全扫描+语义搜索+完全可观察性_
  
______________________________________________________________________
为什么选择FlowCheck?
人工智能编码助手的工作效率非常高,但他们也可以创造 大量、难以审查的变更集 和 危险分子FlowCheck是一个生产级安全层,它:
- 🔍 监控Git状态 在人工智能辅助编码过程中实时
- 🔒 扫描安全问题 (个人身份信息、秘密、即时注射攻击)
- 🔎 语义历史搜索 -按含义而非关键字查找提交
- 📊 跟踪流量健康状况 (时间、线路、分支年龄、偏离主干)
- 📝 完全可观察性 (OpenTetry跟踪、审计日志)
- 🎯 意图验证 (差异对齐票)
- 🤖 专为AI代理设计 有可执行的规则
将FlowCheck视为您代码库的“带生物识别锁的智能健身手表”——它可以帮助您更快地编码,同时积极防御安全威胁。
AI优先设计
FlowCheck是专门为 能动性编码 工作流:
flowchart LR
Agent["🤖 AI Agent
(Claude, Cursor, etc)"]
FC["🛡️ FlowCheck
MCP Server"]
Git["📁 Git Repo
(.git)"]
Agent -->|"get_flow_state()"| FC
FC -->|"analyze"| Git
Git -->|"metrics"| FC
FC -->|"status: warning
security_flags: [...]"| Agent
Agent -->|"⏸️ Pause & suggest
checkpoint commit"| Agent代理规则(推荐)
复制 rules/flowcheck-rules.md 到AI工具的规则目录:
# For Cursor
cp rules/flowcheck-rules.md .cursor/rules/
# For Claude Projects
cp rules/flowcheck-rules.md .claude/rules/
# For other tools
cp rules/flowcheck-rules.md .agent/rules/这指示AI代理 自动检查Git卫生状况 在开始任务之前,并在超过阈值时暂停。
快速开始
安装
git clone https://github.com/backslash-ux/flowcheck.git
cd flowcheck
python3 -m venv .venv
source .venv/bin/activate
pip install -e .Claude桌面集成
添加到 ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"flowcheck": {
"command": "/path/to/flowcheck/.venv/bin/python",
"args": ["-m", "flowcheck.server"],
"env": {
"PYTHONPATH": "/path/to/flowcheck/src"
}
}
}
}MCP工具
核心工具
| 工具 | 目的 |
|---|---|
get_flow_state | 返回指标+ 安全标志 (PII/注射) |
get_recommendations | 返回可操作的提示+ 安全警告 |
set_rules | 动态调整阈值 |
v0.2智能功能(新)
| 工具 | 目的 |
|---|---|
search_history | 语义搜索 -按含义查找提交 |
verify_intent | 智能意图验证 -使用“AI Judge”(BYOK LLM)将差异与票对齐 |
sanitize_content | PII/秘密编辑 在与AI分享之前 |
例子: verify_intent (智能模式)
{
"alignment_score": 0.4,
"is_aligned": false,
"ticket_id": "42",
"scope_creep_warnings": ["Scope Creep Detected by AI Judge"],
"reasoning": "The ticket asks for a bug fix in auth, but the diff contains a full refactor of the billing module."
}配置
FlowCheck支持分层配置:
- 回购配置:
.flowcheck.json(以项目根为单位) - 全局配置:
~/.flowcheck/config.json - 默认值
.flowcheck.json 示例
{
"max_minutes_without_commit": 45,
"intent": {
"provider": "openai",
"model": "gpt-4o",
"api_key_env": "OPENAI_API_KEY"
}
}忽略文件(.flowcheckignore)
创建一个 .flowcheckignore 将文件从分析中排除(使用gitignore语法):
tests/fixtures/
*.min.js
legacy/安全特性
守护者层
- PII检测:电子邮件、电话号码、社会安全号码、信用卡
- 秘密扫描:AWS密钥、GitHub令牌、API密钥、密码
- 注射过滤:检测差异中的即时注入攻击
可观测性
- 开放遥测跟踪:
gen_ai.*语义约定 - 审计日志:在中仅附加JSON行格式
~/.flowcheck/audit.log - 所有工具调用都记录了跟踪ID
语义搜索
- TF-IDF矢量化:没有外部ML依赖关系
- SQLite存储:本地索引
~/.flowcheck/semantic_index.db - 按含义查找提交,而不仅仅是关键字
安装和部署
选项1:Docker(推荐)
让FlowCheck在30秒内运行:
# Clone and setup
git clone https://github.com/backslash-ux/flowcheck.git
cd flowcheck
# Configure environment
cp .env.example .env
nano .env # Add your API keys
# Start the stack
docker-compose upFlowCheck现在正在运行 http://localhost:8000
看 用于:
- 当地开发设置
- 生产部署
- 映像变体(生产/精简/开发)
- 故障排除
选项2:Python包
pip install git+https://github.com/backslash-ux/flowcheck.git
# Set environment variables
export ANTHROPIC_API_KEY=sk-ant-xxxxx
# Start server
flowcheck-server选项3:来源
git clone https://github.com/backslash-ux/flowcheck.git
cd flowcheck
# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate
# Install in development mode
pip install -e ".[dev]"
# Run tests
pytest tests/
# Start server
flowcheck-server部署
FlowCheck支持多种部署模型:
| 场景 | 时间 | 指南 |
|---|---|---|
| 本地开发 | 5分钟 | 码头工人 |
| 生产(Docker) | 10分钟 | |
| Kubernetes | 30分钟 | Kubernetes.md |
| CI/CD集成 | 15分钟 | CI-CD.md |
👉 部署指导 查看完整选项
发展
# Setup development environment
docker-compose -f docker-compose.dev.yml up
# Or use Python venv
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
# Run tests
pytest tests/ -v
# Run with coverage
pytest tests/ --cov=src/flowcheck哲学
FlowCheck体现了以下原则 良好的Git卫生可以实现良好的AI协作:
- 较小的提交 人类更容易审查和审计
- 频繁的检查站 防止在长时间会话中丢失工作
- 干净的历史 更容易理解AI的变化
- 非阻塞轻推 维护开发人员的自主权
许可证
麻省理工学院
