Migrate any WordPress site to Astro fully automated via Claude Code.
WP Astro MCP
Migrate any WordPress site to Astro — from a single blog to a network of 12 sites with 6,000+ posts. Fully automated via Claude Code.
WP Astro MCP is a Model Context Protocol server that turns WordPress sites into production-ready Astro projects. It connects to your WordPress REST API, extracts everything (posts, pages, CPTs, SEO, ACF, menus, media), converts HTML to clean Markdown, scaffolds a complete Astro project, and pushes to GitHub — all through conversational commands in Claude Code.
Why This Exists
Migrating WordPress to Astro involves dozens of tedious steps: fetching content via API, cleaning up page builder markup, resolving shortcodes, building frontmatter, setting up content collections, handling media URLs, generating redirects, deploying. Each site has its own plugins, page builders, and content patterns.
This MCP server handles all of it. Tell Claude to migrate your site, and it orchestrates 55 specialized tools to get it done.
Quick Start
1. Install
git clone https://github.com/vapvarun/wp-astro-mcp.git
cd wp-astro-mcp
npm install
npm run build
2. Add to Claude Code
Add to your MCP config (~/.claude.json or project .mcp.json):
{
"mcpServers": {
"wp-astro-mcp": {
"command": "node",
"args": ["/path/to/wp-astro-mcp/dist/index.js"]
}
}
}
3. Generate a WordPress Application Password
Go to your WordPress admin → Users → Profile → Application Passwords. Enter a name, click "Add New", and copy the password.
4. Start Migrating
In Claude Code, just say:
Add my WordPress site example.com with username admin
and app password "xxxx xxxx xxxx xxxx xxxx xxxx"
Claude will register the site, auto-detect its capabilities (SEO plugin, page builder, ACF, post types), and guide you through the migration.
How It Works
WordPress Site WP Astro MCP Astro Project
┌─────────────┐ REST API ┌──────────────┐ Files ┌─────────────┐
│ Posts │────────────────►│ Extract │───────────────►│ content/ │
│ Pages │ │ Transform │ │ blog/ │
│ CPTs │ │ Scaffold │ │ pages/ │
│ Media │ │ Write │ │ layouts/ │
│ SEO │ │ │ │ pages/ │
│ ACF │ │ SQLite state │ │ astro.config│
│ Menus │ │ for resume │ │ package.json│
└─────────────┘ └──────────────┘ └─────────────┘
│ │
│ GitHub API │
▼ ▼
┌──────────────┐ ┌─────────────┐
│ git init │ │ Vercel │
│ create repo │──────────────│ Netlify │
│ push │ │ Cloudflare │
└──────────────┘ └─────────────┘
The Conversion Pipeline
Every post goes through a 13-step conversion:
- Sanitize — DOMPurify removes XSS vectors while preserving content
- Resolve shortcodes — 20+ built-in handlers (gallery, video, WPBakery, Divi, CF7) + custom per-site rules
- Clean page builders — Strip Elementor/WPBakery/Divi wrapper divs, keep content
- Process Gutenberg — Remove block comments (``), preserve content
- Normalize HTML — Decode entities, remove empty paragraphs, clean inline styles
- Convert to Markdown — Turndown with 12 WordPress-specific rules (captions, galleries, code blocks, embeds)
- Rewrite links — Internal WordPress URLs → Astro paths using URL map
- Rewrite media — Swap domains for media URLs (e.g.,
example.com→app.example.com) - Clean artifacts — Remove conversion leftovers, fix double-encoded entities
- Process embeds — YouTube/Vime
Configuration
{"mcpServers": {"wp-astro-mcp": {"command": "node", "args": ["/path/to/wp-astro-mcp/dist/index.js"]}}}