Skip to main content
Glama

fastly-mcp

一个用于 Fastly REST API 的 Node.js Model Context Protocol 服务器。它支持 stdio 和 Streamable HTTP 传输、租户范围内的用户或账户身份、持久化 Postgres 配置以及持久化 Vault 密钥。

保证

  • 每个 Fastly 请求都使用调用者的用户级 Fastly-Key;进程中不配置共享的 Fastly 令牌。

  • 令牌材料仅写入 Vault 中的 fastly/tenants/<tenant>/{users|accounts}/<principal>/http/auth/token-index/fastly

  • 非机密配置使用 Postgres 表 fastly_config,以租户、主体类型、主体 ID 和键为键。

  • 当设置了环境变量 MCP_ADMIN_AUTH_KEY 时,变更操作需要通过 authorizationKey 工具参数提供该密钥。

  • service_api_request 支持所有已记录的 Fastly 方法和路径,包括此服务器版本之后添加的 API。

Related MCP server: Terros MCP Server

工具

service_query_suggestion 是只读的 schema 发现工具。当意图或正确的 Fastly 路由不明确时使用它;它返回推荐的先决条件、安全检查、工具 schema 和示例。

service_connection_infoservice_scope_info 是只读的运行时和租户/账户发现工具。在操作工作流之前使用它们。

service_health_check 使用用户令牌调用 GET /tokens/selffastly_list_services 调用 GET /servicefastly_list_versions 调用 GET /service/:service_id/version

service_api_request 是全覆盖的逃生舱口。它接受 methodpath、可选的 querybodyheaders 以及必需的 fastlyToken。GET/HEAD 是只读的;POST/PUT/PATCH/DELETE 是变更操作,在配置时需要 authorizationKey

fastly_purge_service 是高风险操作,调用 POST /service/:service_id/purge_all。确认服务 ID 并使用管理员密钥。fastly_update_user_token 是高风险操作,将替换令牌持久化到 Vault;提供 userIdaccountId 中的一个,以及 tenantIdfastlyToken 和管理员密钥。

所有响应都包含 JSON 文本,格式为 { "ok": true, "status": 200, "data": {} };失败时设置 MCP isError 并返回 { "ok": false, "status": 4xx, "error": "..." }。默认情况下,看起来像机密的字段会被编辑。

配置

.env.example 复制为 .env。设置 POSTGRES_*VAULT_ADDRVAULT_TOKEN 或 Vault Agent 设置,以及 MCP_ADMIN_AUTH_KEYTARGET_SERVICE_BASE_URL 默认为 https://api.fastly.com。使用 MCP_TRANSPORT_MODE=stdiohttpboth

使用 docker compose up -d postgres vault 运行本地依赖项,然后根据 vault-production/README.md 初始化 Vault。使用 npm start 启动服务器,或使用 npm run start:http 启动 HTTP。HTTP 端点默认为 http://127.0.0.1:3000/mcp,需要 bearer 令牌。

外部服务模式

当 Fastly MCP 连接到外部 Vault 和 Postgres 服务时,使用 docker-compose.external.yml。在启动仅应用 Compose 服务之前,设置 POSTGRES_HOSTVAULT_ADDR 以及相应的凭据。

清单和测试

npm run inventory:generate 获取 Fastly 的 API 参考索引,或由 FASTLY_OPENAPI_URL 提供的 JSON OpenAPI 文档,并写入 artifacts/fastly-openapi-endpoints.json。该工件已提交,当生成更改它时 CI 会失败。

npm test 运行 Fastly 客户端、MCP 授权、持久化支持基础设施、HTTP 和 Vault 测试。GitHub Actions 在测试作业之前运行清单生成。

MCP 客户端注册

{
  "mcpServers": {
    "fastly-mcp": {
      "command": "npm",
      "args": ["run", "start:stdio"],
      "cwd": "/Users/{user}/Documents/GitHub/fastly-mcp"
    }
  }
}

开发说明

Fastly API 使用 TLS 1.2 或更高版本,并应用单独的读取、写入和清除限制。避免对同一服务进行并发写入。切勿记录或提交 fastlyToken 值。本项目根据 MIT 许可证发布;请参阅 LICENSE

Install Server
A
license - permissive license
B
quality
B
maintenance

Maintenance

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

Related MCP Servers

View all related MCP servers

Related MCP Connectors

  • Access the Notra API for managing posts, brand identities, integrations, and schedules.

  • Issue, rotate and revoke scoped API-key passes for 25+ providers — the agent never sees a real key

  • 34 production API tools over one hosted MCP endpoint.

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/LesterAJohn/fastly-mcp'

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