npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

fastly-mcp-server

v1.0.4

Published

MCP Server for the Fastly API

Readme

Fastly MCP Server

NPM Version License: MIT Node Version

A Model Context Protocol (MCP) server implementation for the Fastly API that enables AI assistants to interact with Fastly CDN services.

Overview

This package provides an MCP server that allows AI models to interact with the Fastly API through a standardized protocol. It implements the Model Context Protocol specification, enabling AI assistants to execute operations on the Fastly CDN platform like:

  • Managing services, versions, domains, and backends
  • Configuring cache settings and VCL
  • Performing content purging
  • Working with edge dictionaries and ACLs
  • Accessing stats and metrics
  • Managing WAF and rate limiting

Why Use This?

  • Seamless AI Integration: Allow AI models to interact directly with your Fastly CDN configuration
  • Natural Language Control: Enable conversational interfaces for Fastly administration
  • Standardized Protocol: Built on MCP for consistent integration with various AI systems
  • Enhanced Capabilities: Exposes all essential Fastly operations through a unified interface

Installation

Recommendation: Bun is the preferred runtime for fastly-mcp-server due to its superior performance and startup time.

Global Installation

# With Bun (recommended)
bun add -g fastly-mcp-server

# With npm
npm install -g fastly-mcp-server

# With yarn
yarn global add fastly-mcp-server

# With pnpm
pnpm add -g fastly-mcp-server

Local Installation

# With Bun (recommended)
bun add fastly-mcp-server

# With npm
npm install fastly-mcp-server

# With yarn
yarn add fastly-mcp-server

# With pnpm
pnpm add fastly-mcp-server

Running the Server

Standalone

# Using bunx (recommended, no installation required)
bunx fastly-mcp-server@latest run

# If installed globally with Bun
fastly-mcp-server run

# Using npx (Node.js alternative)
npx fastly-mcp-server@latest run

Integration with AI Assistants

Usage with Bun (Recommended)

{
 "mcpServers": {
    "fastly api": {
      "command": "bunx",
      "args": ["fastly-mcp-server@latest", "run"],
      "env": {
        "API_KEY_APIKEYAUTH": "your-fastly-api-key"
      }
    }
 }
}

Usage with Node.js

{
 "mcpServers": {
    "fastly": {
      "command": "npx",
      "args": ["-y", "fastly-mcp-server@latest", "run"],
      "env": {
        "API_KEY_APIKEYAUTH": "your-fastly-api-key"
      }
    }
 }
}

Authentication

The server requires a Fastly API key to authenticate with the Fastly API. You can provide this in several ways:

1. Environment Variable

export API_KEY_APIKEYAUTH=your-fastly-api-key

2. .env File

Create a .env file in your project root:

API_KEY_APIKEYAUTH=your-fastly-api-key

3. In AI Assistant Configuration

As shown in the usage examples above, you can provide the API key in the environment variables section of your AI assistant's configuration.

The server will automatically set the Fastly-Key header with your API key for all requests to the Fastly API.

Obtaining a Fastly API Key

To get a Fastly API key for use with the MCP server:

  1. Log in to your Fastly account at https://manage.fastly.com
  2. Navigate to "Account" in the top right menu
  3. Select "Personal API tokens" from the sidebar
  4. Click the "Create token" button
  5. Provide a name for your token (e.g., "MCP Server")
  6. Select the appropriate scope for your needs:
    • For read-only access: Select "global:read"
    • For full access: Select "global:write"
  7. Set an expiration date if desired (or leave as "never" for permanent tokens)
  8. Click "Create" to generate your API token
  9. Copy the displayed token immediately (it will only be shown once)
  10. Use this token as the value for API_KEY_APIKEYAUTH in your configuration

Important Security Notes:

  • Store your API key securely and never commit it to version control
  • Consider using environment variables or a secure secrets manager
  • Use the most restrictive scope necessary for your application
  • Rotate API keys regularly following security best practices

Available Tools

The server provides comprehensive tools for interacting with the Fastly API:

Service Management

  • List all services
  • Get service details
  • Create new services
  • Update existing services
  • Delete services

Version Management

  • List versions
  • Clone versions
  • Activate versions

Content Delivery Configuration

  • Domain management (add, list, delete)
  • Origin configuration
  • Backend management
  • Cache settings

Cache and Purge Operations

  • Purge all content
  • Purge by URL
  • Purge by surrogate key
  • Soft purges
  • Check purge status

Security Features

  • WAF configuration and rule management
  • Rate limiting setup and configuration

Edge Logic and Data

  • Edge dictionary management
  • Dictionary item operations
  • VCL file management

Analytics

  • Service statistics
  • Realtime metrics
  • Historical stats

Using Tools with Path Parameters

Many API endpoints require path parameters such as service_id or version_id. When using these tools, you must provide these parameters in your request:

// To get service details
{
  "service_id": "3ELXhLGOuQTQvW9NR3wlWD"
}

// To list versions for a service
{
  "service_id": "3ELXhLGOuQTQvW9NR3wlWD"
}

// To activate a version
{
  "service_id": "3ELXhLGOuQTQvW9NR3wlWD",
  "version_id": "2"
}

// To purge a specific URL
{
  "url": "www.example.com/path/to/resource"
}

Common Workflows

Here are some common workflows you can implement with this MCP server:

Setting Up a New Website on Fastly

  1. Create a service
  2. Add domains
  3. Configure origin server
  4. Configure backend
  5. Activate version

Purging Cached Content

  1. Get service details
  2. Purge specific URL, surrogate key, or all content

Updating Origin Server

  1. Get current origins
  2. Clone active version
  3. Update origin
  4. Activate new version

Development

# Clone the repository
git clone https://github.com/jedisct1/fastly-openapi-schema.git
cd fastly-openapi-schema/fastly-mcp-server

# Install dependencies (with Bun, recommended)
bun install

# Or with npm
npm install

# Build the server (with Bun, recommended)
bun run build

# Or with npm
npm run build

# Run type checking (with Bun, recommended)
bun run typecheck

# Or with npm
npm run typecheck

Related Projects

License

MIT