Fastly API集成
STDIO通过MCP协议连接Fastly API
通过MCP协议连接Fastly API
Fastly MCP brings the power of Fastly's API directly to your AI assistants through the Model Context Protocol (MCP).
Fastly's API-first design philosophy means:
Fastly's comprehensive API allows you to:
The AI assistant never sees your Fastly API key. It talks to a local helper (FastlyMCP) which uses the key securely.
With Fastly MCP configured, you can ask your AI assistant questions like:
What You Want To Do | Example AI Request |
---|---|
List your services | "Show me all my Fastly services" |
Get domain details | "What domains are configured for my e-commerce service?" |
Purge cache | "Purge the cache for my product service" |
Check traffic | "What's the traffic pattern for my main site over the last week?" |
View configuration | "Show me the backend servers for my API service" |
Check performance | "What's my current cache hit ratio?" |
Configure your AI assistant with:
{ "mcpServers": { "fastly": { "command": "node", "args": ["path/to/fastly-mcp.mjs"], "env": { "FASTLY_API_KEY": "your_fastly_api_key" } } } }
Task Goal | Example AI Request |
---|---|
Optimize service based on traffic | "Analyze the configuration for [service_id/name] and suggest optimizations based on its traffic profile, prioritizing low latency." |
Configure for live video | "Configure [service_id/name] for optimal live video streaming following the best practices outlined in [link_to_guide_or_doc] ." |
Find config conflicts | "Identify potential configuration conflicts in [service_id/name] compared to standard e-commerce delivery patterns." |
Optimize video chunk caching | "Optimize caching for [service_id/name] to handle 10-second video chunks efficiently, minimizing origin load." |
Enhance WAF security | "Review the WAF rules for [service_id/name] and suggest stricter settings to mitigate potential SQL injection attacks." |
Set up origin mTLS | "Set up Mutual TLS (mTLS) authentication between Fastly and the origin servers for [service_id/name] ." |
Implement A/B testing (Edge) | "Deploy a Compute@Edge function to [service_id/name] that performs A/B testing by routing 10% of users to backend [backend_name] ." |
Add dynamic image rewriting (VCL) | "Write and deploy VCL for [service_id/name] to dynamically rewrite image URLs based on the requesting device's user agent." |
Troubleshoot 5xx errors | "Analyze logs for [service_id/name] from the past 24 hours to identify the root cause of the recent spike in 5xx errors." |
This project is licensed under the MIT License - see the LICENSE file for details.