agentflow-mcp
agentflow-mcp
一个用于 agentflow 演示管道的企业架构知识 MCP 服务器。基于 FastMCP 和 TypeScript 构建,并部署在 GCP Cloud Run 上。
该服务器提供四个工具,使架构 Agent 和风险检查 Agent 能够基于精选的企业架构模式而非通用 LLM 推理来开展工作:
工具 | 调用方 | 返回内容 |
| 架构 Agent | 参考架构模式、组件、图表数据 |
| 架构 Agent | 平台推荐,以及基于约束的推理 |
| 风险检查 Agent | 所需控制项、风险标记、HITL 触发 |
| 架构 Agent | 公司身份、定位、Logo(通过 Brandfetch + logo.dev) |
它如何融入其中
agentflow pipeline agentflow-mcp
┌──────────────────────┐ ┌───────────────────────┐
│ Qualifier Agent │ │ arch_pattern_lookup │
│ - clarifies the ask │ │ tool_selection_lookup │
└──────┬───────────────┘ │ risk_policy_lookup │
│ handoff │ brand_context_lookup │
┌──────▼───────────────┐ │ │
│ Architect Agent │──── MCP calls ───▶│ Source pack (data/) │
│ - pattern selection │ │ 102 markdown files │
│ - tool selection │◀── JSON response ─│ with YAML frontmatter │
│ - diagram rendering │ │ │
└──────┬───────────────┘ │ Brandfetch + logo.dev │
│ handoff │ (cached, additive) │
┌──────▼───────────────┐ └───────────────────────┘
│ Risk Checker Agent │──── risk_policy_lookup ──▶
│ - HITL gate trigger │◀── risk_flags, HITL ──
└──────────────────────┘MCP 是一个工具提供方,而非 Agent 编排器。Agent 提示词和架构图技能位于 agentflow 项目中。MCP 提供结构化数据;Agent 负责解读这些数据并采取行动。
Related MCP server: MCP Architect
快速开始
前提条件
Node.js >= 20
(可选)用于
brand_context_lookup的 Brandfetch API 密钥和 logo.dev 密钥
安装与运行
npm install
npm run dev # stdio transport (local dev + MCP Inspector)HTTP 传输(Cloud Run)
MCP_TRANSPORT=http-stream PORT=8080 npm run dev
# agentflow-mcp listening on http://0.0.0.0:8080/mcp运行测试
npm test # 31 unit + integration tests
npm run typecheck # tsc --noEmit
npm run check # biome lint + format环境变量
将 .env.example 复制为 .env 并填入相关密钥。只有 brand_context_lookup 需要外部 API 密钥——其余三个工具都可以离线直接从数据源包中心运行。
变量 | 使用方 | 用途 |
|
| Brandfetch Brand Context API 的 Bearer 令牌 |
|
| logo.dev Brand API 的 Bearer 令牌 |
|
| logo.dev CDN URL 的 publishable 密钥 |
| 服务器 |
|
| 服务器 | HTTP 端口(默认 8080,在传输方式为 |
当 API 密钥缺失时,brand_context_lookup 会为已缓存的域名返回缓存响应,或为未缓存的域名返回一个合理的不可用响应。其余三个工具仍会正常连接。
工具
arch_pattern_lookup
将企业的需求匹配到精选的参考架构模式。
输入:
{
"industry": "media_agency",
"data_stack": ["BigQuery", "Snowflake"],
"cloud": "GCP",
"constraints": ["SAML SSO", "EU data residency", "cross-client governance"],
"latency": "batch"
}输出:
{
"pattern_id": "media_agency_audience_measurement",
"architecture_summary": "...",
"recommended_components": ["BigQuery", "Snowflake", "SAML SSO", "GCP EU Region"],
"data_zones": ["bronze", "silver", "gold"],
"integration_notes": ["..."],
"confidence": 0.87,
"diagram_data": {
"components": [{ "name": "BigQuery", "type": "database", "sublabel": "...", "zone": "gold" }],
"connections": [{ "from": "Users", "to": "SAML SSO", "label": "OAuth 2.0", "style": "dashed" }],
"boundaries": [{ "label": "GCP EU Region", "type": "region" }]
},
"source_references": [{ "path": "data/patterns/...", "title": "...", "source_url": "..." }]
}匹配逻辑: 确定性、基于规则——行业匹配(40%)+ 数据栈重叠(30%)+ 约束覆盖(30%)。精选匹配(置信度 >= 0.85)包含 diagram_data 和来源引用。弱匹配则回退到通用企业级 AI POC 模式,置信度 < 0.5。
tool_selection_lookup
根据负载、数据栈、约束和延迟来推荐平台。
输入:
{
"use_case": "AI-powered patient insights",
"data_stack": ["Databricks"],
"constraints": ["HIPAA", "PHI", "US data residency"],
"latency": "batch"
}输出:
{
"recommended_platform": "Databricks",
"cloud_fit": "Azure or AWS",
"reasoning": "Strong lakehouse fit for healthcare AI with HIPAA-compliant governance...",
"alternatives": [{ "platform": "Snowflake", "rationale": "..." }, { "platform": "BigQuery", "rationale": "..." }]
}risk_policy_lookup
返回特定行业的风险与治理检查,包括针对受监管数据的 HITL 触发条件。
输入:
{
"industry": "healthcare",
"data_classification": ["PHI", "PII"],
"region": "US",
"deployment": "cloud",
"constraints": ["HIPAA"]
}输出:
{
"required_controls": ["RBAC", "audit logs", "data lineage", "SAML SSO"],
"risk_flags": ["prompt leakage", "overbroad analyst access"],
"hitl_required": true,
"review_reason": "PHI access requires human approval before final architecture signoff"
}HITL 会在出现受监管数据类型(PHI、PII、受监管金融数据)时触发,并提供人类可读的 review_reason。
brand_context_lookup
通过 Brandfetch 获取丰富的公司上下文,并通过 logo.dev 获取 Logo,同时支持多层缓存。
输入:
{
"domain": "havas.com"
}输出:
{
"company_name": "Havas",
"domain": "havas.com",
"industry_hint": "media_agency",
"description": "...",
"tags": ["advertising", "marketing", "media"],
"positioning": { "value_proposition": "...", "target_audience": "...", "products_and_services": "..." },
"brand": { "voice": "...", "style": "..." },
"logo_url": "https://...",
"confidence": 0.85
}缓存层级: (1) Brandfetch cachedOnly=true,用于即时缓存查询;(2) 本地文件缓存,带 TTL。重复查询会返回缓存数据,不消耗 API 配额。当 API 不可访问时,提供优雅降级。
数据源包
data/ 目录包含 102 个 Markdown 文件,带有结构化的 YAML frontmatter,组织方式如下:
data/
├── industry/ # Industry-specific architecture notes
├── vendors/ # Vendor documentation (GCP, AWS, Azure, Snowflake, Databricks)
└── patterns/ # Curated reference architecture patterns (4 demo scenarios)Frontmatter 字段:type, domain、title, source_url, vendor, industry, data_stack, cloud, constraints, compliance, region, data_zones, latency, pattern_id, architecture_summary, recommended_components, integration_notes, confidence_baseline, diagram_data.
数据源包在服务器启动时会加载到内存索引中,并以行业、数据栈、约束和 pattern_id 作为键。
演示场景
场景 | 行业 | 模式 ID |
媒体代理受众测量 |
|
|
医疗患者洞察 |
|
|
零售 湖仓个性化 |
|
|
FSI 治理 Copilot |
|
|
部署
Docker
docker build -t agentflow-mcp .
docker run -p 8080:8080 agentflow-mcpGCP Cloud Run
gcloud run deploy agentflow-mcp \
--source . \
--region run.googleapis.com \
--port 8080 \
--set-env-vars "MCP_TRANSPORT=http-stream" \
--set-secrets "BRANDFETCH_API_KEY=brandfetch-api-key:latest,LOGO_DEV_SECRET_KEY=logo-dev-secret-key:latest,LOGO_DEV_PUBLISHABLE_KEY=logo-dev-publishable-key:latest"完整的服务配置请参见 cloud-run.yaml。
Google App Engine
App Engine Standard 不会运行构建步骤——请在本地编译后再部署:
npm run build # compile src/ -> dist/
# (Optional) Warm brand cache for demo domains before deploy
npx tsx scripts/brand-cache-warm.ts
gcloud app deploy # deploys with dist/ and data/ includedapp.yaml 会设置 MCP_TRANSPORT=http-stream,并在空闲时将实例缩放至零(对演示来说更便宜)。App Engine 会自动设置 PORT——服务器仍然会读取该变量。
如需使用 Secret Manager 管理密钥:
# Create secrets
gcloud secrets create brandfetch-api-key --data-file=<(echo -n "$BRANDFETCH_API_KEY")
gcloud secrets create logo-dev-secret-key --data-file=<(echo -n "$LOGO_DEV_SECRET_KEY")
gcloud secrets create logo-dev-publishable-key --data-file=<(echo -n "$LOGO_DEV_PUBLISHABLE_KEY")
# Reference them in app.yaml (uncomment the includes: section)完整配置请参见 app.yaml 和 .gcloudignore。
脚本
脚本 | 用途 |
| 校验 |
| 为数据源包文件生成 frontmatter |
| 验证五个工具能否通过 MCP 工具列表被发现 |
| 作用于运行 MCP 的 Docker 执行器使用的所有辅助进程 |
npx tsx scripts/validate-source-pack.ts # validate source pack
npx tsx scripts/mcp-list-check.ts # verify tool discovery
npx tsx scripts/brand-cache-warm.ts # warm brand cache使用 MCP Inspector 测试
npx @modelcontextprotocol/inspector npm run dev这会启动 MCP Inspector UI,你可以通过它交互式地调用工具并验证响应。
项目结构
agentflow-mcp/
├── src/
│ ├── index.ts # MCP server entry point (stdio + http-stream)
│ ├── tools/
│ │ ├── archPatternLookup.ts # Pattern matching + confidence scoring
│ │ ├── toolSelectionLookup.ts # Platform recommendation
│ │ ├── riskPolicyLookup.ts # Risk/governance checks + HITL
│ │ └── brandContextLookup.ts # Brandfetch + logo.dev with caching
│ ├── data/
│ │ ├── loader.ts # Source pack parser + in-memory index
│ │ ├── brandfetchClient.ts # Brandfetch Brand Context API client
│ │ ├── logoDevClient.ts # logo.dev Brand API client
│ │ └── brandCache.ts # Local file cache with TTL
│ └── types/
│ ├── source.ts # Source pack entry types
│ ├── arch-pattern.ts # arch_pattern_lookup types
│ ├── tool-selection.ts # tool_selection_lookup types
│ ├── risk-policy.ts # risk_policy_lookup types
│ └── brand-context.ts # brand_context_lookup types
├── data/ # Source pack (102 markdown files)
│ ├── industry/
│ ├── vendors/
│ └── patterns/
├── tests/ # Unit + integration tests
├── docs/ # PRD, MCP overview
├── scripts/ # Validation + cache warming scripts
├── openspec/ # OpenSpec specs (4 capabilities)
│ ├── specs/ # Main specs (synced from archived change)
│ └── changes/archive/ # Archived change proposals
├── Dockerfile # Multi-stage build for Cloud Run
├── cloud-run.yaml # Cloud Run service config
└── package.json技术栈
运行时: Node.js >= 20
MCP 框架: FastMCP v4
编程语言: TypeScript(严格模式)
校验库: Zod v4
Lint/格式化: Biome
测试: Node.js 内置测试运行器
部署: Docker + GCP Cloud Run
OpenSpec
本项目使用 OpenSpec 进行 Spec 驱动开发。四个工具能力在 openspec/specs/ 下定义:
arch-pattern-lookup(7 个需求)brand-context-lookup(6 个需求)risk-policy-lookup(4 个需求)tool-selection-lookup(5 个需求)
使用以下命令验证规格:
openspec validate --specs
openspec doctor许可证
MIT
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
FlicenseAqualityCmaintenanceProvides a persistent memory and governance layer that allows AI coding agents to query documented architecture rules and validate code against team standards. It enables agents to verify compliance across categories like security and testing before suggesting changes to ensure consistency across development sessions.317- AlicenseNot gradedqualityDmaintenanceProvides comprehensive architectural expertise through specialized agents, resources, and tools for generating, evaluating, and modifying architectural designs.785ISC
- FlicenseNot gradedqualityBmaintenanceEnables AI agents to index, search, and retrieve architectural documentation and store self-learning notes from codebases.1
- FlicenseNot gradedqualityCmaintenanceProvides a set of MCP tools (file, database, GitHub, Slack, browser, calendar, email, vector search, Python execution) with safety constraints and OpenAI integration for enterprise architecture automation.
Related MCP Connectors
Shared, permission-aware company context for AI agents, with provenance, approvals and audit.
Your company's brain for AI agents. Cited, permission-aware knowledge across every system.
Curated knowledge API for AI agents - skill packs, semantic search, validated patterns.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/ishfuseini/agentflow-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server