FastlyMCP

by Arodoid
Verified

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
FASTLY_API_KEYYesYour Fastly API key

Schema

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

Tools

Functions exposed to the LLM to take actions

NameDescription
fastly_api

Make requests to the Fastly API. Allows accessing all endpoints of the Fastly API with custom paths, methods and parameters.

IMPORTANT USAGE NOTES FOR LLMs:

  1. When making multiple API calls, summarize the results between calls. The user doesn't see raw API responses.
  2. Base URL is automatically added - just provide the path (e.g. '/service').
  3. Authentication is handled automatically - no need to include API keys or know API keys.
  4. Common paths:
    • List services: GET /service
    • Get service details: GET /service/{service_id}
    • Get domains: GET /service/{service_id}/version/{version}/domain
    • Get backends: GET /service/{service_id}/version/{version}/backend
    • Purge cache: POST /service/{service_id}/purge_all
    • Get stats: GET /stats (with params: service_id, from, to)
  5. Always check status codes in responses. Status 200-299 indicates success.
  6. Include simple explanations of what you're doing and what the results mean before and after each API call.

Creating Fastly Compute@Edge Sites

To create a Compute@Edge site, you can use a combination of API calls and terminal commands. The API handles service creation and configuration, while terminal commands handle the local build and deployment process.

Follow these general steps:

  1. Create a new service using the API: POST /service with {"name": "My Site", "type": "wasm"}
  2. Initialize a local Compute project using the Fastly CLI
  3. Build the project using the appropriate build tools
  4. Deploy using the Fastly CLI with the service ID from step 1

COMMON PITFALLS TO AVOID:

  1. DO NOT use --name flag with fastly compute init (use interactive mode or -d -y flags instead)
  2. PowerShell requires semicolons (;) not ampersands (&&) for command chaining
  3. Fastly compute build creates the package archive AFTER you've built the Wasm binary
  4. Build is a TWO-STEP process: first compile to Wasm, then create the package archive
  5. Deploy command needs -d flag to avoid hanging on interactive prompts
  6. NEVER attempt to extract or use the user's API key directly - auth is handled by MCP
  7. To create a service from scratch, you must use API calls for configuration and CLI for local build
  8. Check current directory paths carefully before running commands
  9. Full URL paths aren't needed in API calls - just use the path portion (e.g. '/service')

See the full guide for detailed instructions on handling common errors and PowerShell-specific commands.

fastly_cli

Execute Fastly CLI commands securely without exposing API keys.

This tool allows you to run Fastly CLI commands while the MCP server handles authentication automatically. The LLM never sees or needs to handle the API key directly.

USAGE EXAMPLES:

  1. Initialize a Compute project: fastly_cli('compute init --language javascript -d -y')
  2. Build a package: fastly_cli('compute build')
  3. Deploy a service: fastly_cli('compute deploy --service-id SERVICE_ID -d -y')

COMMON COMMANDS:

  • compute init: Initialize a new Compute project
  • compute build: Build a Compute package
  • compute deploy: Deploy a Compute package
  • compute publish: Build and deploy in one step
  • whoami: Check authentication status

SECURITY NOTE: Authentication is handled automatically. Never attempt to pass API keys in commands.

ID: g9p5qpvwas