automad-mcp-server-golang

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2026 License: MIT

README ΒΆ

Automad MCP Server

Go MCP SDK

An MCP (Model Context Protocol) server that exposes the Automad CMS documentation, the official Automad Theme Starter Kit repository, and Docker-based Automad instance management to AI assistants. Implemented using the official Go SDK for MCP.

Features

πŸ”§ Docs Tools
Tool Description
search_docs Full-text search across all Automad documentation pages
get_page Fetch the full content of a single documentation page as text
list_pages List all documentation pages, optionally filtered by category
🧩 Starter Kit Tools

Live access to automadcms/automad-theme-starter-kit β€” the "Source of Truth" for real theme files instead of guessed file names. Details, examples, and typical prompts are available in SKILL.md.

Tool Description
list_files List all files/folders in the repository recursively as a tree
get_file_content Read the content of a file (.php, .json, .md, .txt, .css, .js)
get_template_snippet Retrieve curated, frequently used files (page component, pagination, list grid, theme.json, etc.) with explanations
search_code Search cached code for text, e.g., Automad template syntax (@{ }, <@ @>) or theme.json keys
get_file_url Generate Raw and GitHub URLs for any repository file without fetching its content (existence verification may fetch the repository tree)
🐳 Instance Tools

Create and remotely control real Automad sites running in Docker (official automad/automad:v2 image) β€” for end-to-end testing instead of just reading about behavior. Requires Docker installed and running. Details, examples, and typical prompts are available in SKILL.md.

Tool Description
create_automad_instance Create and start a new Automad instance (auto-assigns a free port if none given)
list_automad_instances List every instance managed by this server, with status and port
get_automad_instance Get full status/detail for a single instance
set_automad_instance_state Start, stop, or restart an instance
remove_automad_instance Stop and remove an instance, optionally deleting its data
get_automad_instance_logs Fetch recent container logs (e.g. the auto-generated dashboard credentials)
run_automad_console_command Run one of Automad's own console commands (cache:clear, cache:purge, user:create, update) inside an instance

Every container these tools create is labeled managed-by=automad-mcp-server. Lifecycle tools resolve only label-matched containers and then operate on the verified container ID, so unrelated containers with similar names are not affected.

πŸ“¦ Resources
URI Description
automad://docs/sitemap Full documentation structure as JSON
πŸ’¬ Prompts
Prompt Description
explain_concept Explain an Automad concept using the official documentation
theme_development Guided theme development assistance with documentation context

Installation

Prerequisites
  • Go 1.26+
Install with Go
go install github.com/cabroe/automad-mcp-server-golang/cmd/automad-mcp-server@latest

The binary is installed as automad-mcp-server in $(go env GOPATH)/bin (or GOBIN, when configured). Ensure that directory is on your PATH.

@latest resolves the newest published semantic-version tag. Until the first release tag exists, install the current main branch with @main.

Build from source
git clone https://github.com/cabroe/automad-mcp-server-golang
cd automad-mcp-server-golang
make build
# or directly:
go build -o automad-mcp-server ./cmd/automad-mcp-server
For AI Agents (Claude Code, Cursor Agent, etc.)

Installation instructions, tool references with examples, and typical prompts for AI agents are documented in SKILL.md.

Configuration

Claude Desktop

Add the following to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "automad-docs": {
      "command": "/absolute/path/to/automad-mcp-server"
    }
  }
}
Optional: Increase GitHub Rate Limit

The Starter Kit tools access the GitHub REST API unauthenticated (limited to 60 requests/hour). If needed, set a GITHUB_TOKEN (Read-only, public repos) to increase the limit to 5000 requests/hour:

{
  "mcpServers": {
    "automad-docs": {
      "command": "/absolute/path/to/automad-mcp-server",
      "env": { "GITHUB_TOKEN": "ghp_..." }
    }
  }
}
Optional: Instance Tool Settings

The instance tools work out of the box (Docker required) but can be configured via environment variables:

Variable Default Purpose
AUTOMAD_INSTANCES_DIR ~/.automad-mcp-server/instances Base directory for instance data (each instance gets its own subdirectory)
AUTOMAD_DOCKER_IMAGE automad/automad:v2 Automad v2-compatible image used for new instances; per-call overrides must match this value
AUTOMAD_STARTER_KIT_REF master Simple Git branch or tag without /; slash-containing refs are rejected to keep generated file URLs unambiguous

The server shells out to the docker CLI, so it also honors standard Docker environment variables like DOCKER_HOST/DOCKER_CONTEXT if you want to point it at a remote Docker daemon.

Cursor

In .cursor/mcp.json or globally in ~/.cursor/mcp.json:

{
  "mcpServers": {
    "automad-docs": {
      "command": "/absolute/path/to/automad-mcp-server",
      "args": []
    }
  }
}
VS Code (with Copilot / MCP Extension)
{
  "mcp": {
    "servers": {
      "automad-docs": {
        "type": "stdio",
        "command": "/absolute/path/to/automad-mcp-server"
      }
    }
  }
}

Usage

Testing with MCP Inspector
# Starts the interactive inspector in the browser
npx @modelcontextprotocol/inspector go run ./cmd/automad-mcp-server

Note: The server communicates using the standardized MCP protocol via stdio (not raw JSON-RPC). Always use the MCP Inspector or integrate the server directly into your MCP client (Claude, Cursor, etc.) for testing.

Project Structure

automad-mcp-server-golang/
β”œβ”€β”€ cmd/automad-mcp-server/
β”‚   └── main.go                 # Installable command entry point
β”œβ”€β”€ SKILL.md                    # Documentation + examples for the Starter Kit tools
β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ docs/
β”‚   β”‚   β”œβ”€β”€ cache.go            # In-memory cache with TTL
β”‚   β”‚   β”œβ”€β”€ fetcher.go          # HTTP client for automad.org
β”‚   β”‚   β”œβ”€β”€ parser.go           # HTML β†’ structured text
β”‚   β”‚   β”œβ”€β”€ service.go          # Coordinator: GetPage, Search, ListPages, WarmCache
β”‚   β”‚   └── sitemap.go          # All known sitemap URLs
β”‚   β”œβ”€β”€ starterkit/
β”‚   β”‚   β”œβ”€β”€ client.go           # GitHub API client (Trees + Contents), rate-limit tracking
β”‚   β”‚   β”œβ”€β”€ cache.go            # In-memory cache with TTL (Tree + files)
β”‚   β”‚   β”œβ”€β”€ fallback.go         # Embedded fallback content for API downtime
β”‚   β”‚   β”œβ”€β”€ search.go           # Search helpers for search_code
β”‚   β”‚   β”œβ”€β”€ snippets.go         # Registry for get_template_snippet
β”‚   β”‚   β”œβ”€β”€ tree.go             # Tree rendering for list_files
β”‚   β”‚   β”œβ”€β”€ service.go          # Coordinator: ListFiles, GetFileContent, SearchCode, WarmFiles
β”‚   β”‚   └── types.go            # Tree/TreeEntry, error types
β”‚   β”œβ”€β”€ instances/
β”‚   β”‚   β”œβ”€β”€ docker.go           # docker CLI wrapper (os/exec, no shell)
β”‚   β”‚   β”œβ”€β”€ parse.go            # Parses `docker ps` output into Instance values
β”‚   β”‚   β”œβ”€β”€ validate.go         # Name and console-command validation
β”‚   β”‚   β”œβ”€β”€ errors.go           # NotFoundError, AlreadyExistsError
β”‚   β”‚   β”œβ”€β”€ service.go          # Coordinator: Create, List, Get, SetState, Remove, Logs, RunConsoleCommand
β”‚   β”‚   └── types.go            # Instance
β”‚   └── server/
β”‚       β”œβ”€β”€ tools.go              # MCP tool handlers (Docs)
β”‚       β”œβ”€β”€ starterkit_tools.go   # MCP tool handlers (Starter Kit)
β”‚       β”œβ”€β”€ instance_tools.go     # MCP tool handlers (Instances)
β”‚       β”œβ”€β”€ resources.go          # MCP resource handlers
β”‚       └── prompts.go            # MCP prompt handlers
β”œβ”€β”€ Makefile
└── README.md

Development

# Run tests
make test

# Run the complete local quality gate
make check

# Build a versioned binary
make build VERSION=1.0.0

# Start directly
make run

Technical Details

  • Transport: stdio (Standard MCP transport)
  • Cache TTL: 1 hour (configurable in docs/service.go or starterkit/starterkit.go)
  • Documentation Strategy: Live-fetch from automad.org with in-memory cache
  • Starter Kit Strategy: Live access to the GitHub REST API (Git Trees API for list_files, Contents API for get_file_content) with in-memory caching, rate limit tracking (X-RateLimit-* headers), and embedded fallbacks for curated snippet files during API downtime
  • Cache Warmup: Concurrently warms sitemap pages and supported Starter Kit files (max 5 parallel, 2 min timeout) on startup so search_docs/search_code can perform full-text searches from the beginning. Concurrent cache misses for the same page/file are deduplicated.
  • Instance Strategy: Shells out to the docker CLI (no Docker SDK dependency) with argument slices only β€” never an interpolated shell string. Every container is labeled managed-by=automad-mcp-server, and every lifecycle call re-verifies that label before acting, so the server can never affect a container it didn't create. create_automad_instance waits for Automad's first-run installation to create the console before returning. run_automad_console_command is restricted to Automad's four documented console subcommands rather than arbitrary shell execution. Availability of Docker itself is checked lazily per call, so its absence never affects the docs/Starter Kit tools
  • MCP SDK: Official Go SDK v1.7.0

License

MIT

Directories ΒΆ

Path Synopsis
cmd
automad-mcp-server command
automad-mcp-server is an MCP server that exposes the Automad CMS documentation, the official Automad Theme Starter Kit repository, and Docker-based Automad instance management to AI assistants via the Model Context Protocol.
automad-mcp-server is an MCP server that exposes the Automad CMS documentation, the official Automad Theme Starter Kit repository, and Docker-based Automad instance management to AI assistants via the Model Context Protocol.
internal
docs
Package docs provides types and logic to fetch, parse, and cache pages from the Automad documentation website (https://automad.org).
Package docs provides types and logic to fetch, parse, and cache pages from the Automad documentation website (https://automad.org).
instances
Package instances lets MCP tools create and remotely control Docker containers running Automad CMS (https://automad.org), using the official automad/automad Docker image.
Package instances lets MCP tools create and remotely control Docker containers running Automad CMS (https://automad.org), using the official automad/automad Docker image.
server
instance_tools.go registers MCP tools to create and remotely control Docker containers running Automad CMS, using the official automad/automad Docker image.
instance_tools.go registers MCP tools to create and remotely control Docker containers running Automad CMS, using the official automad/automad Docker image.
starterkit
Package starterkit gives MCP tools read access to the official Automad Theme Starter Kit repository on GitHub (automadcms/automad-theme-starter-kit).
Package starterkit gives MCP tools read access to the official Automad Theme Starter Kit repository on GitHub (automadcms/automad-theme-starter-kit).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL