A command-line tool to convert Markdown files to WordPress Gutenberg block format.
- Convert Markdown text or files to Gutenberg blocks
- Support for various Markdown elements (headings, lists, code blocks, images, tables, etc.)
- Command-line interface with flexible input/output options
- Pretty printing and debug modes
- TypeScript implementation
- MCP (Model Context Protocol) server mode for integration with AI tools
npm install -g markwpgit clone https://github.com/benridane/markwp.git
cd markwp
npm install
npm run build
npm link# Convert Markdown text directly
markwp "# Hello World" output.html
# Convert a Markdown file
markwp -f input.md output.html
# Output to stdout
markwp -f input.md
# Pretty print the output
markwp -f input.md -p
# Enable debug mode
markwp -f input.md -d-f, --file: Treat input as file path instead of text-d, --debug: Enable debug mode-p, --pretty: Pretty print output--mcp: Run as MCP server (stdio transport)--mcp-http: Run as MCP HTTP server (streamable HTTP transport)--port <port>: Port for HTTP server (default: 3000)-h, --help: Display help information-V, --version: Display version number
markwp -f example.md -p > output.htmlmarkwp "## Heading\n\nThis is a paragraph with **bold** text." -p# Start the MCP server with stdio transport
markwp --mcp# Start the MCP HTTP server (default port 3000)
markwp --mcp-http
# Start with custom port
markwp --mcp-http --port 8080
# Start with Bearer authentication
API_TOKEN=your-secret-token markwp --mcp-httpThe servers expose two tools:
convert_markdown: Convert Markdown text to Gutenberg formatconvert_file: Convert a Markdown file to Gutenberg format
When running in MCP mode, the tool integrates with AI assistants and other MCP-compatible clients, allowing them to use MarkWP's conversion capabilities programmatically.
# Create .env file with your API token
echo "API_TOKEN=your-secret-token" > .env
# Start with Docker Compose
docker-compose up -d
# The HTTP server will be available at http://localhost:3000/mcp# Test with CLI
npx @modelcontextprotocol/inspector --cli http://localhost:3000/mcp
# Test with UI
npx @modelcontextprotocol/inspector
# Then connect to http://localhost:3000/mcp- Node.js (v16 or higher)
- TypeScript
git clone https://github.com/benridane/markwp.git
cd markwp
npm installnpm run build # Build the project
npm run dev # Run in development mode
npm start # Run the built version
npm run clean # Clean build files- Headings (H1-H6)
- Paragraphs
- Bold and italic text
- Inline code
- Code blocks with syntax highlighting
- Lists (ordered and unordered)
- Links
- Images
- Tables
- Blockquotes
- Horizontal rules
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with TypeScript and Commander.js
- Inspired by the WordPress Gutenberg block editor