Astro Mcp

io.github.morinokami由 GitHub 账号 morinokami 发布v0.4.2更新于 Oct 24, 2026

MCP server to support Astro project development

已验证STDIO仅桌面知识与记忆开发者工具

概览

AI 生成的概览

让助手获取 Astro 项目的运行时与文档上下文,包括配置、路由、服务器地址、集成信息和文档搜索。

可以做什么
astro-mcp 是一个 Astro 集成,会暴露一个用于 Astro 项目开发的 MCP 服务器。它的工具可以读取 Astro 配置,列出路由及其入口文件、动态参数和预渲染状态,报告正在运行的开发服务器地址与端口,列出并描述 Astro 集成,搜索 Astro 文档,以及获取 Astro 相关包的更新日志。它还提供 Vite 工具,用于读取 Vite 配置以及某个模块的导入图和编译结果。
适用场景
适合在 Astro 项目内工作时使用,让助手基于实时项目状态而非仅磁盘文件进行判断,例如检查路由、查看开发服务器地址,或查询 Astro 文档与集成信息。
运行要求
需要本地 Astro 项目并安装 astro-mcp 集成(npx astro add astro-mcp,或手动 npm install 并在配置中加入)。MCP 服务器由运行中的 Astro 开发服务器在本地 SSE 端点提供,并会创建编辑器或工具的配置文件用于连接。需要 Node.js 和 npm。
安装前请注意
README 说明该包为实验性且不稳定,并建议谨慎使用。该集成会在 Astro 服务器启动时自动写入或更新编辑器或工具的 MCP 配置文件。工具会读取项目配置、路由和模块图数据;未声明需要凭据或涉及付款。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Astro Mcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

astro-mcp

MCP server to support Astro project development, inspired by antfu's nuxt-mcp.

[!IMPORTANT] This package is experimental and unstable. Proceed with caution when using it.

astro-mcp aims to help models understand your Astro project better, by providing them with information that cannot be easily accessed just by looking at the project files, such as:

  • Runtime information about the Astro server
  • Up-to-date Astro docs content
  • Information about the Astro integrations you are using

Installation

In your Astro project directory, run the following command:

sh
npx astro add astro-mcp

Manual installation

First, install the astro-mcp package:

sh
npm install astro-mcp

Then, add the astro-mcp integration to your Astro config:

ts
import { defineConfig } from "astro/config";
import mcp from "astro-mcp";
export default defineConfig({  integrations: [mcp()],});

Usage

After installing the integration, the MCP server will be available at http://localhost:4321/__mcp/sse. To connect, create an empty configuration file in the appropriate location for your editor or tool:

Editor/ToolConfiguration File
VSCode.vscode/mcp.json
Cursor.cursor/mcp.json
Windsurf~/.codeium/windsurf/mcp_config.json
Claude Code.mcp.json

astro-mcp will automatically update the file when the Astro server starts.

Extending the MCP server

astro-mcp provides a hook called mcp:setup that other integrations can use to extend the MCP server. This is useful if you want to add custom tools to the MCP server.

ts
export default function createExampleIntegration(): AstroIntegration {  return {    name: "example-integration",    hooks: {      "mcp:setup": async ({ mcp }) => {        mcp.tool("add", { a: z.number(), b: z.number() }, async ({ a, b }) => ({          content: [{ type: "text", text: String(a + b) }],        }));      },    },  };}

Tools

  • get-astro-config: Get the Astro config object containing comprehensive project settings including file paths (root, src, public, output directories), site URL, build options, server settings, enabled integrations, markdown processing configuration, image handling, Vite plugins, security settings, and experimental features
    • Parameters: None
  • list-astro-routes: List detailed routing information from your Astro project, including all routes with their file entrypoints, URL patterns, dynamic parameters, pre-rendering status, and route types. Optionally filter by type to focus on specific route categories
    • Parameters:
      • type (string, optional): redirect, page, endpoint, or fallback
  • get-astro-server-address: Get the current network address, IP protocol family, and port number of the running Astro development server
    • Parameters: None
  • list-astro-integrations: List all Astro integrations available in the ecosystem
    • Parameters: None
  • get-astro-integration: Get detailed metadata about a specific Astro integration, including its name, description, categories, repository links, npm information, related website links, official status, and download statistics
    • Parameters:
      • name (string): The name of the Astro integration to get information about
  • search-astro-docs: Search the Astro documentation for specific topics, concepts, or features. Returns relevant documentation snippets that match your query
    • Parameters:
      • query (string): The query to search for
  • get-astro-changes: Get the changelog of the Astro-related packages
    • Parameters:
      • packageName (string): The name of the Astro-related package to get the changelog for

Tools from vite-plugin-mcp

  • get-vite-config: Get the Vite config digest, including the root, resolve, plugins, and environment names
    • Parameters: None
  • get-vite-module-info: Get graph information of a module, including importers, imported modules, and compiled result
    • Parameters:
      • filepath (string): The absolute filepath of the module

来源:README.md,提交 ba9592f

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.4.2最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分