Skip to main content
Glama

fastly-mcp

A Node.js Model Context Protocol server for the Fastly REST API. It supports stdio and Streamable HTTP transports, tenant-scoped user or account identities, persistent Postgres configuration, and persistent Vault secrets.

Guarantees

  • Every Fastly request uses the caller's user-scoped Fastly-Key; no shared Fastly token is configured in the process.

  • Token material is written only to Vault at fastly/tenants/<tenant>/{users|accounts}/<principal>/http/auth/token-index/fastly.

  • Non-secret configuration uses the Postgres table fastly_config, keyed by tenant, principal type, principal ID, and key.

  • Mutations require MCP_ADMIN_AUTH_KEY through the authorizationKey tool parameter when that environment variable is set.

  • service_api_request supports every documented Fastly method and path, including APIs added after this server release.

Related MCP server: Terros MCP Server

Tools

service_query_suggestion is read-only schema discovery. Use it when intent or the correct Fastly route is unclear; it returns recommended prerequisites, safety checks, tool schemas, and examples.

service_connection_info and service_scope_info are read-only runtime and tenant/account discovery tools. Use them before an operational workflow.

service_health_check calls GET /tokens/self with a user token. fastly_list_services calls GET /service. fastly_list_versions calls GET /service/:service_id/version.

service_api_request is the full-coverage escape hatch. It accepts method, path, optional query, body, headers, and required fastlyToken. GET/HEAD are read-only; POST/PUT/PATCH/DELETE are mutations and require authorizationKey when configured.

fastly_purge_service is high-risk and calls POST /service/:service_id/purge_all. Confirm the service ID and use the admin key. fastly_update_user_token is high-risk and persists a replacement token in Vault; provide exactly one of userId or accountId, plus tenantId, fastlyToken, and the admin key.

All responses contain JSON text shaped as { "ok": true, "status": 200, "data": {} }; failures set MCP isError and return { "ok": false, "status": 4xx, "error": "..." }. Secret-looking fields are redacted by default.

Configuration

Copy .env.example to .env. Set POSTGRES_*, VAULT_ADDR, VAULT_TOKEN or Vault Agent settings, and MCP_ADMIN_AUTH_KEY. TARGET_SERVICE_BASE_URL defaults to https://api.fastly.com. Use MCP_TRANSPORT_MODE=stdio, http, or both.

Run local dependencies with docker compose up -d postgres vault, then initialize Vault according to vault-production/README.md. Start the server with npm start, or use npm run start:http for HTTP. The HTTP endpoint defaults to http://127.0.0.1:3000/mcp and requires a bearer token.

External Services Mode

Use docker-compose.external.yml when Fastly MCP connects to external Vault and Postgres services. Set POSTGRES_HOST, VAULT_ADDR, and the corresponding credentials before starting the app-only Compose service.

Inventory and tests

npm run inventory:generate fetches Fastly's API reference index, or a JSON OpenAPI document supplied by FASTLY_OPENAPI_URL, and writes artifacts/fastly-openapi-endpoints.json. The artifact is committed and CI fails when generation changes it.

npm test runs the Fastly client, MCP authorization, persistence-supporting infrastructure, HTTP, and Vault tests. GitHub Actions runs inventory generation before the test job.

MCP client registration

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

Development notes

The Fastly API uses TLS 1.2 or later and applies separate read, write, and purge limits. Avoid concurrent writes to the same service. Never log or commit fastlyToken values. This project is released under the MIT License; see LICENSE.

Available Tools

12 tools
fastly_get_configA

Read-only: retrieve one tenant/user or tenant/account configuration key from Postgres. Never stores secrets.

Inputs: key (required), tenantId (required), userId, accountId.

fastly_list_servicesA

Read-only: list services visible to the supplied Fastly user token. Follow with fastly_list_versions or service_api_request.

Inputs: fastlyToken (required).

fastly_list_versionsA

Read-only: list versions for a Fastly service. Requires serviceId and a user token.

Inputs: serviceId (required), fastlyToken (required).

fastly_purge_serviceA

High-risk mutation: purge all cached content for a Fastly service. Confirm serviceId and require MCP_ADMIN_AUTH_KEY when configured.

Inputs: serviceId (required), fastlyToken (required), authorizationKey.

fastly_set_configA

Mutating: persist non-secret tenant/user or tenant/account configuration in Postgres. Reject tokens and secrets; requires the admin key when configured.

Inputs: key (required), tenantId (required), value, userId, +2 more.

fastly_update_user_tokenA

High-risk mutation: persist or rotate one tenant/user or tenant/account Fastly token in Vault. Never use for configuration; provide scope and admin authorization.

Inputs: tenantId (required), fastlyToken (required), userId, accountId, +1 more.

service_api_requestD

Generic target service HTTP API call. Supports all available endpoints while enforcing host/auth safeguards.

Inputs: path (required), method (required), fastlyToken (required), body, +3 more.

service_connection_infoB

Return MCP server and target service connection details.

Inputs: no named parameters.

service_health_checkA

Read-only: validate a user-scoped Fastly token with GET /tokens/self. Requires a Fastly token.

Inputs: fastlyToken (required).

service_list_endpointsB

List documented/implemented target service HTTP endpoints exposed by this MCP server.

Inputs: no named parameters.

service_query_suggestionC

Discover MCP tool schemas and get query/tool recommendations for a workflow intent.

Inputs: path, intent, method, operationType, +2 more.

service_scope_infoC

Return app/tenant/principal scoping metadata used by Postgres config and Vault token index paths.

Inputs: tenantId (required), userId, accountId.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 12 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose. Config get/set, service introspection, and Fastly-specific operations (list services, versions, purge, token update) are all unambiguously separated. Even similar-sounding tools like fastly_get_config and service_scope_info have distinct descriptions (config retrieval vs. scoping metadata).

    Naming Consistency4/5

    Names follow a verb_noun pattern within two clear prefix groups: 'fastly_' for Fastly-specific actions (fastly_list_services, fastly_purge_service) and 'service_' for service-level introspection (service_list_endpoints, service_health_check). While not a single uniform prefix, the grouping is logical and internally consistent, so the pattern is predictable after seeing a few examples.

    Tool Count5/5

    12 tools is well-scoped for a Fastly management MCP. The set covers config, token management, service listing, version listing, purge, health checks, and generic API access without being bloated. Each tool serves a clear purpose, and the count is appropriate for the domain.

    Completeness4/5

    The tool surface covers core workflows: config get/set, token rotation, service listing, version listing, purge, health checks, and endpoint discovery. While it lacks explicit create/delete service operations, the generic service_api_request fills that gap by allowing arbitrary API calls. Minor gaps exist (e.g., no dedicated service version creation), but agents can work around them via the generic endpoint.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers