Get the FREE Ultimate OpenClaw Setup Guide →

astro

a content website, a content-based MCP server, a b̶r̶e̶a̶k̶t̶h̶r̶o̶u̶g̶h̶ i̶n̶t̶e̶r̶n̶e̶t̶ c̶o̶m̶m̶u̶n̶i̶c̶a̶t̶i̶o̶n̶s̶ d̶e̶v̶i̶c̶e̶…are you getting it?

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio jem-computer-astro-mcp npx -y astro-mcp

How to use

This MCP server exposes content from Astro content collections via the MCP (Model Context Protocol) interface. It ships with an astro_content tool that lets you query exported Astro content by collection, filter by paths, and control how much content is returned (including full markdown content or just metadata). Use the server to power AI assistants or other tools that need structured access to your site’s content without exposing your entire site directly. The workflow is: Astro exports its content collections to a JSON bundle during build, the MCP server reads that bundle, and the astro_content tool serves filtered results at runtime. You can customize what gets exported and how entries are transformed in the plugin configuration, enabling type-safe schemas and efficient queries.

To use the server, first install the plugin in your project, configure which collections to export, and ensure the export path is set (default is .astro-mcp). Start the MCP server (via your chosen runtime, for example using the example mcp-server.js as shown in the repo sample). Once running, you can perform queries like getting all posts in a collection, filtering by specific entry paths, and optionally including or excluding full markdown content. The tool outputs a structured response including success status, the collection queried, an array of entries with ids, slugs, metadata, and optional content/excerpts, plus a total count.

How to install

Prerequisites:

  • Node.js (recommended v16+ or per project requirement)
  • npm or bun (as preferred package manager)

Install the MCP plugin:

npm install astro-mcp

or with bun

bun add astro-mcp

Configuration steps:

  1. Add the Astro MCP integration to your Astro config to export your content collections (blog, docs, etc.).
  2. Build your project to emit the .astro-mcp collections.json file as described in the README.
  3. Create an MCP server file (e.g., mcp-server.js) that imports the MCPServer and astro_content tool from the astro-mcp package, and starts the server (examples in the README show how to setup and run).

Run the server:

# If using the example setup from the README
node mcp-server.js

Alternatively, you can start via npx using the configuration provided by mcp_config (see the package's guidance):

# Example runtime start (via MCP tooling)
npx -y astro-mcp

Additional notes

Tips and common issues:

  • Ensure your Astro build exports (.astro-mcp/collections.json) are generated before starting the MCP server, otherwise the tool will have no data to serve.
  • If you change exported collections or schema, re-run the Astro build and reload the MCP server to pick up updates.
  • The astro_content tool supports filtering by collection and path patterns, plus a limit to cap results; use includeContent to fetch full markdown when needed.
  • For production deployments, consider caching strategies and running with a stable export directory to avoid frequent rebuilds.
  • Environment variables can be used to control logging levels or to point the server to a specific export path if you don’t use the default.

Environment variables (placeholders you can set):

  • MCP_EXPORT_PATH: path to the exported JSON data (default: .astro-mcp)
  • MCP_LOG_LEVEL: debug|info|warn|error

Configuration options to consider:

  • collections: which Astro content collections to export
  • exportPath: directory where collections.json is written
  • includeContent: whether to include full markdown content in queries
  • transform: a function to transform each entry before export

Related MCP Servers

Sponsor this space

Reach thousands of developers