Skip to main content
Glama

agentflow-mcp

一个用于 agentflow 演示管道的企业架构知识 MCP 服务器。基于 FastMCP 和 TypeScript 构建,并部署在 GCP Cloud Run 上。

该服务器提供四个工具,使架构 Agent 和风险检查 Agent 能够基于精选的企业架构模式而非通用 LLM 推理来开展工作:

工具

调用方

返回内容

arch_pattern_lookup

架构 Agent

参考架构模式、组件、图表数据

tool_selection_lookup

架构 Agent

平台推荐,以及基于约束的推理

risk_policy_lookup

风险检查 Agent

所需控制项、风险标记、HITL 触发

brand_context_lookup

架构 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_API_KEY

brand_context_lookup

Brandfetch Brand Context API 的 Bearer 令牌

LOGO_DEV_SECRET_KEY

brand_context_lookup

logo.dev Brand API 的 Bearer 令牌

LOGO_DEV_PUBLISHABLE_KEY

brand_context_lookup

logo.dev CDN URL 的 publishable 密钥

MCP_TRANSPORT

服务器

stdio(默认)或 http-stream

PORT

服务器

HTTP 端口(默认 8080,在传输方式为 http-stream 时生效)

当 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, domaintitle, 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

媒体代理受众测量

media_agency

media_agency_audience_measurement

医疗患者洞察

healthcare

healthcare_patient_insights

零售 湖仓个性化

retail

retail_lakehouse_personalization

FSI 治理 Copilot

financial_services

fsi_governance_copilot

部署

Docker

docker build -t agentflow-mcp .
docker run -p 8080:8080 agentflow-mcp

GCP 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/ included

app.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

脚本

脚本

用途

scripts/validate-source-pack.ts

校验 data/ 中所有 markdown 文件是否具有有效的 YAML frontmatter

scripts/generate-frontmatter.mjs

为数据源包文件生成 frontmatter

scripts/mcp-list-check.ts

验证五个工具能否通过 MCP 工具列表被发现

scripts/brand-cache-warm.ts

作用于运行 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

Install Server
A
license - permissive license
A
quality
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

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

View all related MCP servers

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.

View all MCP Connectors

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/ishfuseini/agentflow-mcp'

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