Skip to main content
Glama
dreyfus92

Astro Docs MCP Server

by dreyfus92

Astro Docs MCP 服务器

一个 MCP 服务器,用于向 AI 代理提供 Astro 文档访问权限。该服务器允许 AI 助手在帮助用户执行 Astro 相关任务时查找和参考 Astro 文档。

这个基于 TypeScript 的 MCP 服务器为 Astro 实现了一个文档检索系统。它通过提供以下功能演示了 MCP 的核心概念:

  • 代表 Astro 文档部分的资源,包含 URI 和元数据

  • Astro 文档搜索工具

  • 常见 Astro 问题和任务的提示

特征

资源

  • 通过astro-docs:// URI 列出并访问 Astro 文档

  • 每个文档部分都有标题、内容和类别

  • 用于简单内容访问的纯文本 MIME 类型

工具

  • search_docs - 搜索 Astro 文档

    • 将搜索查询作为必需参数

    • 返回匹配的文档部分

提示

  • explain_astro_islands - 获取 Astro Islands 建筑的详细解释

  • astro_project_setup - 建立新 Astro 项目的指南

  • astro_vs_other_frameworks - 将 Astro 与其他 Web 框架进行比较

Related MCP server: Dedalus MCP Documentation Server

项目结构

  • src/ ——MCP 服务器的源代码

    • index.ts - 主 MCP 服务器实现

    • scripts/ ——用于构建和测试的辅助脚本

      • build.js - 构建转换 TypeScript 并创建启动器脚本的脚本

      • test-client.js - 测试客户端以验证服务器功能

  • bin/ ——生成的可执行脚本

    • astro-docs-mcp - MCP 服务器的主启动脚本

  • build/ ——编译的 JavaScript 文件(生成)

要求

  • 需要 Node.js v16 或更高版本

  • 建议使用 Node.js v20+ 以获得最佳兼容性

  • 服务器使用 ES 模块语法

  • pnpm 包管理器(优于 npm)

安装

安装依赖项

安装依赖项:

pnpm install

构建服务器:

pnpm run build

对于使用自动重建的开发:

pnpm run watch

运行服务器

pnpm start
# OR directly
./bin/astro-docs-mcp

使用 Claude Desktop 进行配置

要与 Claude Desktop 一起使用,请添加服务器配置:

在 MacOS 上: ~/Library/Application Support/Claude/claude_desktop_config.json在 Windows 上: %APPDATA%/Claude/claude_desktop_config.json

重要:配置必须使用脚本的绝对路径:

{
  "mcp_servers": [
    {
      "id": "astro-docs-mcp",
      "name": "Astro Docs",
      "command": "/full/absolute/path/to/astro-mcp/bin/astro-docs-mcp",
      "type": "built-in"
    }
  ]
}

将/full/absolute/path/to/astro-mcp/替换为安装目录的实际绝对路径。

例如,如果存储库位于/Users/username/projects/astro-mcp ,则命令为:

"/Users/username/projects/astro-mcp/bin/astro-docs-mcp"

调试

由于 MCP 服务器通过 stdio 进行通信,调试起来可能比较困难。我们推荐使用MCP Inspector ,它以包脚本的形式提供:

pnpm run inspector

检查器将提供一个 URL 来访问浏览器中的调试工具。

测试

提供测试客户端来验证服务器是否正常工作:

pnpm test
# OR directly
node src/scripts/test-client.js

这将向服务器发送几个命令并显示响应。

故障排除

如果您遇到服务器问题:

  1. 路径问题:最常见的问题是配置中的路径不正确。请确保:

    • 您正在使用 claude_desktop_config.json 中脚本的绝对路径

    • 该路径指向bin/astro-docs-mcp (不是根脚本)

    • 构建目录存在并包含 index.js ( ls -la build/ )

    • 所有脚本均具有可执行权限

  2. “找不到模块”错误:如果您看到类似Cannot find module '/build/index.js'错误,请检查:

    • 您已运行构建步骤( pnpm run build )

    • 脚本正在从正确的目录运行

    • 脚本执行时使用绝对路径

  3. Node.js 版本:请确保您使用的是 Node.js v16 或更高版本。为了获得最佳效果,请使用 v20 及以上版本。

    node --version
  4. 脚本权限:确保脚本具有可执行权限:

    chmod +x bin/astro-docs-mcp src/scripts/build.js src/scripts/test-client.js
  5. JSON 输出问题:发送到标准输出 (stdout) 的调试消息会导致 Claude Desktop 出现问题,因为它只接受有效的 JSON 格式。我们的脚本可以正确地将所有调试输出重定向到标准输出 (stderr)。

与 Claude Desktop 一起使用

  1. 按照上述安装步骤安装服务器。

  2. 通过编辑配置文件来配置 Claude Desktop,使其包含脚本的绝对路径:

    {
      "mcp_servers": [
        {
          "id": "astro-docs-mcp",
          "name": "Astro Docs",
          "command": "/full/absolute/path/to/astro-mcp/bin/astro-docs-mcp",
          "type": "built-in"
        }
      ]
    }
  3. 重新启动 Claude Desktop。

  4. 您现在可以使用以下命令与 Astro 文档进行交互:

    • list ——列出可用的 Astro 文档部分

    • search <query> - 搜索 Astro 文档

    • read astro-docs:///<id> - 阅读特定文档部分

未来的增强功能

  • 从 Astro 网站获取实时文档

  • 添加更全面的文档部分

  • 实施文档版本控制支持

  • 添加常见 Astro 模式的代码示例和片段

Available Tools

1 tool
search_docsC

Search Astro documentation

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYesSearch term to find in Astro documentation

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action but reveals nothing about how the search works (e.g., scope, ranking, pagination), what the output looks like, or any constraints like rate limits or authentication needs. This leaves significant gaps for a tool with undocumented behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise at just three words, front-loading the essential action and resource without any wasted text. Every word earns its place, making it efficient and straightforward for an agent to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete for a search tool. It doesn't explain what the search returns, how results are structured, or any behavioral nuances, leaving the agent with insufficient context to use the tool effectively beyond the basic parameter.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the single parameter 'query' clearly documented as 'Search term to find in Astro documentation'. The description adds no additional parameter details beyond what the schema provides, so it meets the baseline for high schema coverage without compensating value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Search') and resource ('Astro documentation'), making it immediately understandable. However, with no sibling tools mentioned, there's no opportunity to demonstrate differentiation from alternatives, which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives, prerequisites, or contextual limitations. While the absence of sibling tools reduces the need for differentiation, it still lacks any usage instructions or exclusions, leaving the agent with minimal operational context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 1 tool updatev1.0.0
    • First observedsearch_docs

TDQS

B3.1/5.0

Scored across 1 tool

Disambiguation5/5

With only one tool, there is no possibility of confusion or overlap between tools. The single tool 'search_docs' has a clearly distinct and unambiguous purpose.

Naming Consistency5/5

The single tool name 'search_docs' follows a clear verb_noun pattern, and with only one tool, consistency is inherently perfect as there are no other names to compare against.

Tool Count2/5

A single tool for an 'Astro Docs MCP Server' feels too thin for the apparent scope. While search is a core function, documentation servers typically benefit from additional tools like browsing, filtering, or retrieving specific pages, making this count borderline inadequate.

Completeness2/5

The tool surface is severely incomplete for a documentation server. It only provides search functionality, lacking obvious gaps such as retrieving documentation pages, listing categories, or navigating content, which are essential for comprehensive agent interaction with documentation.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers