fastly_api
Access Fastly's CDN API endpoints to manage services, domains, caching, and performance. Automates authentication and simplifies API calls with custom paths, methods, and parameters for streamlined CDN configuration.
Instructions
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:
- When making multiple API calls, summarize the results between calls. The user doesn't see raw API responses.
- Base URL is automatically added - just provide the path (e.g. '/service').
- Authentication is handled automatically - no need to include API keys or know API keys.
- 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)
- Always check status codes in responses. Status 200-299 indicates success.
- 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:
- Create a new service using the API: POST /service with {"name": "My Site", "type": "wasm"}
- Initialize a local Compute project using the Fastly CLI
- Build the project using the appropriate build tools
- Deploy using the Fastly CLI with the service ID from step 1
COMMON PITFALLS TO AVOID:
- DO NOT use --name flag with fastly compute init (use interactive mode or -d -y flags instead)
- PowerShell requires semicolons (;) not ampersands (&&) for command chaining
- Fastly compute build creates the package archive AFTER you've built the Wasm binary
- Build is a TWO-STEP process: first compile to Wasm, then create the package archive
- Deploy command needs -d flag to avoid hanging on interactive prompts
- NEVER attempt to extract or use the user's API key directly - auth is handled by MCP
- To create a service from scratch, you must use API calls for configuration and CLI for local build
- Check current directory paths carefully before running commands
- 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.
Input Schema
Name | Required | Description | Default |
---|---|---|---|
body | No | Request body for POST/PUT requests (optional). Will be JSON-encoded automatically. | |
method | Yes | HTTP method (GET, POST, PUT, DELETE) | |
params | No | URL parameters to add to the request (optional). For filtering, pagination, etc. | |
path | Yes | API path (e.g., '/service' or '/service/{service_id}/purge_all'). Don't include base URL. |