astro-mcp

Astro integration that exposes a running dev server's config, routes and docs to MCP clients

By Shinya Fujino (individual) TypeScript Local · Streamable HTTP Developer tools

24 popularity score ★ 61 ↓ 2.3k/wk

Connect your client

Local (once it is running)

Add in one click

Opens the app, which asks before it adds the server.

Or add it by command or config

Claude CodeTerminal
claude mcp add --transport http astro http://localhost:4321/__mcp/sse
Cursor~/.cursor/mcp.json
{
  "mcpServers": {
    "astro": {
      "url": "http://localhost:4321/__mcp/sse"
    }
  }
}
VS Code.vscode/mcp.json
{
  "servers": {
    "astro": {
      "type": "http",
      "url": "http://localhost:4321/__mcp/sse"
    }
  }
}
Codex~/.codex/config.toml
[mcp_servers.astro]
url = "http://localhost:4321/__mcp/sse"
Gemini CLITerminal
gemini mcp add --scope user --transport http astro http://localhost:4321/__mcp/sse

What it does

astro-mcp is not a standalone program: it is an Astro integration you add to a project's config. When you run the Astro dev server, it attaches an MCP endpoint to that server (by default http://localhost:4321/__mcp/sse) through antfu's vite-plugin-mcp, so an editor's assistant can ask the live project about itself instead of guessing from files.

Its tools return the resolved Astro config, the route table (optionally filtered by route type), and the dev server's address and port. Others look outward: listing and describing integrations from the astro.build catalogue, searching the Astro docs, and reading the changelog of a core Astro package. Two more tools come from vite-plugin-mcp and expose the Vite config digest and the module graph for a given file.

In 0.4.2 the integration only starts the server when Astro runs with the dev command (src/index.ts checks command === "dev"), so astro build and astro preview expose nothing. On start it writes its entry into the editor's MCP config file; an editor option (cursor, vscode or windsurf) picks one, otherwise it detects them. The changelog tool accepts a fixed list of 20 packages (astro, create-astro, @astrojs/db and the official @astrojs integrations), reads them from the main branch of withastro/astro, caches each for 12 hours in memory and returns at most 300 lines (src/tools/get-astro-changes.ts). Other integrations can add their own tools through an mcp:setup hook. Its makers mark the package as experimental and unstable.

What it needs

RuntimeNode.js

An Astro project on Astro 5.0 or later (peer dependency) with Node.js and npm. Add it with npx astro add astro-mcp, or npm install astro-mcp plus mcp() in the integrations list of astro.config. The Astro dev server (astro dev) must be running for the endpoint to exist. Your client must connect to an SSE URL. The docs, integrations and changelog tools need internet access.

Limits

Experimental and unstable, in its makers' words. Only serves while astro dev runs, not during build or preview. Speaks SSE over the dev server's port, with no stdio mode. get-astro-changes covers only its 20 built-in packages, reads the changelog on the main branch rather than your installed version, and cuts it at 300 lines. search-astro-docs depends on a Cloudflare Worker run by the author, not the official Astro docs search. The README names automatic config files for VS Code, Cursor, Windsurf and Claude Code; the editor option in the code accepts only cursor, vscode or windsurf.

Who it suits

Fits developers working on an Astro 5 project in VS Code, Cursor, Windsurf or Claude Code who want the assistant to see the resolved config, real routes and module graph of the running dev server. It runs on your machine and needs no account. It is no use outside an Astro project or without a running dev server. For a Nuxt project, antfu's nuxt-mcp-dev, which we also list, does the same job built on the same vite-plugin-mcp.

Tools 9

get-astro-config
Returns the resolved Astro config: paths, site URL, build, server, integrations, markdown, images and experimental flags.
list-astro-routes
Lists the project's routes with entry files, patterns, params and prerender status; can filter by redirect, page, endpoint or fallback.
get-astro-server-address
Reports the running dev server's address, IP family and port.
list-astro-integrations
Lists the integrations in the astro.build catalogue.
get-astro-integration
Gives catalogue details for one named integration: description, categories, links, npm data, official flag, downloads.
search-astro-docs
Searches the Astro documentation for a query and returns matching passages.
get-astro-changes
Fetches the changelog of one of 20 core Astro packages, up to 300 lines.
get-vite-config
From vite-plugin-mcp: summarises the Vite config (root, resolve, plugins, environments).
get-vite-module-info
From vite-plugin-mcp: shows a module's importers, imports and compiled output for an absolute file path.

Similar servers