MCP Examples

Learn how to leverage MCP-enabled code assistants for common Azion Platform tasks.


Deploy a static site

Use natural language to get step-by-step deployment guidance.

Example conversation

Request

You: "I have a static website with HTML, CSS, and JavaScript files.
Help me deploy it to Azion."

Response

The assistant will:

  1. Use deploy_azion_static_site tool to retrieve deployment guide
  2. Provide step-by-step instructions
  3. Guide you through:
    • Project initialization with azion init
    • Configuration setup
    • Build process with azion build
    • Deployment with azion deploy
  4. Share the production URL after deployment

What happens behind the scenes

  1. MCP server searches deployment documentation
  2. Returns context-aware guidance based on your project type
  3. Provides commands specific to static site deployment

Create analytics queries

Generate GraphQL queries for Real-Time Metrics without memorizing the schema.

Example: Traffic analysis

Request

You: "Create a GraphQL query to show my application's traffic
from the last 7 days, grouped by edge location."

Response

query TrafficByLocation {
httpMetrics(
filter: {
tsRange: {begin: "2025-01-02T00:00:00", end: "2025-01-09T00:00:00"}
}
groupBy: [edgeLocation]
orderBy: [requestsCount_DESC]
) {
edgeLocation
requestsCount
dataTransferredIn
dataTransferredOut
bandwidthMbps
}
}

Example: Cache performance

Request

You: "Generate a query to analyze cache hit rates for my images."
Response
query CachePerformance {
httpMetrics(
filter: {
tsRange: {begin: "2025-01-08T00:00:00", end: "2025-01-09T00:00:00"}
requestUri: {like: "%.jpg%|%.png%|%.webp%"}
}
groupBy: [cacheStatus]
) {
cacheStatus
requestsCount
dataTransferredOut
averageRequestTime
}
}

Configure Rules Engine

Create complex Rules Engine configurations using natural language descriptions.

Example: Security headers

Request

You: "Create Rules Engine rules to add security headers including
HSTS, X-Frame-Options, and CSP for my application."

Response

{
"rules": [
{
"name": "Security Headers",
"criteria": [
{
"conditional": "if",
"variable": "${uri}",
"operator": "starts_with",
"value": "/"
}
],
"behaviors": [
{
"name": "add_response_header",
"target": "Strict-Transport-Security",
"value": "max-age=31536000; includeSubDomains"
},
{
"name": "add_response_header",
"target": "X-Frame-Options",
"value": "DENY"
},
{
"name": "add_response_header",
"target": "Content-Security-Policy",
"value": "default-src 'self'"
}
]
}
]
}

Example: Cache optimization

Request

You: "Configure Rules Engine to cache static assets for 1 year
and API responses for 5 minutes."

Response

{
"rules": [
{
"name": "Static Assets Cache",
"criteria": [
{
"conditional": "if",
"variable": "${uri}",
"operator": "matches",
"value": "\\.(jpg|jpeg|png|gif|css|js|woff2?)$"
}
],
"behaviors": [
{
"name": "set_cache_policy",
"target": "31536000",
"browser_cache": true,
"cdn_cache": true
}
]
},
{
"name": "API Cache",
"criteria": [
{
"conditional": "if",
"variable": "${uri}",
"operator": "starts_with",
"value": "/api/"
}
],
"behaviors": [
{
"name": "set_cache_policy",
"target": "300",
"browser_cache": false,
"cdn_cache": true
}
]
}
]
}

Search documentation

Get instant answers about Azion Platform features and capabilities.

Common queries

QueryTool UsedResult
”How do I configure DDoS protection?”search_azion_docs_and_siteDDoS Protection setup guide
”Show me Next.js deployment examples”search_azion_code_samplesNext.js templates and samples
”What CLI commands manage edge functions?”search_azion_cli_commandsFunctions-related CLI commands
”How to create Terraform resources?”search_azion_terraformTerraform provider examples

Troubleshooting deployments

Get help diagnosing and fixing deployment issues.

Example workflow

Request

You: "My deployment is failing with error 503. How can I debug this?"

Response

  1. Check deployment logs:

    Terminal window
    azion logs --type edge --tail
  2. Verify origin configuration:

    • The assistant searches for origin troubleshooting docs
    • Provides checklist of common origin issues
  3. Test origin connectivity:

    Terminal window
    curl -I https://your-origin.com
  4. Review Rules Engine:

    • Checks for redirect loops
    • Validates cache configurations
  5. Monitor Real-Time Metrics:

    • Generates GraphQL query for error analysis

Framework-specific deployments

Get tailored guidance for your specific framework.

Supported frameworks

The MCP server provides specialized guidance for:

  • Next.js: SSR/SSG configuration, API routes, middleware
  • React: SPA deployment, routing configuration
  • Vue.js: Build optimization, history mode setup
  • Angular: Production builds, service workers
  • Astro: Static and SSR modes, integrations
  • Remix: Edge deployment, data loading
  • SvelteKit: Adapter configuration, endpoints

Example: Next.js with ISR

You: "Deploy my Next.js app with Incremental Static Regeneration"

The assistant will:

  1. Check for Next.js in your project
  2. Configure azion.config.js for ISR support
  3. Set up proper cache policies
  4. Deploy with optimized settings
  5. Provide monitoring queries for ISR performance

Advanced workflows

Multi-environment deployment

You: "Set up staging and production environments for my app"

The assistant helps:

  • Create separate edge applications
  • Configure environment variables
  • Set up deployment pipelines
  • Implement proper domain routing

Performance optimization

You: "Optimize my site's Core Web Vitals scores"

The assistant provides:

  • Image optimization strategies
  • Cache configuration recommendations
  • Rules Engine for resource hints
  • GraphQL queries to monitor improvements

Tips for effective use

  1. Be specific: Provide context about your project type and requirements
  2. Iterative refinement: Start simple and add complexity gradually
  3. Combine tools: Use multiple MCP tools together for comprehensive solutions
  4. Learn patterns: Save successful configurations for reuse

Next steps