███╗ ███╗ █████╗ ██████╗ ██╗ ██╗██████╗ ██████╗ ██╗ ██╗███╗ ██╗
████╗ ████║██╔══██╗██╔══██╗██║ ██╔╝██╔══██╗██╔═══██╗██║ ██║████╗ ██║
██╔████╔██║███████║██████╔╝█████╔╝ ██║ ██║██║ ██║██║ █╗ ██║██╔██╗ ██║
██║╚██╔╝██║██╔══██║██╔══██╗██╔═██╗ ██║ ██║██║ ██║██║███╗██║██║╚██╗██║
██║ ╚═╝ ██║██║ ██║██║ ██║██║ ██╗██████╔╝╚██████╔╝╚███╔███╔╝██║ ╚████║
╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═════╝ ╚═════╝ ╚══╝╚══╝ ╚═╝ ╚═══╝
██╗███╗ ██╗ ████████╗██╗ ██╗███████╗
██║████╗ ██║ ╚══██╔══╝██║ ██║██╔════╝
██║██╔██╗ ██║ ██║ ███████║█████╗
██║██║╚██╗██║ ██║ ██╔══██║██╔══╝
██║██║ ╚████║ ██║ ██║ ██║███████╗
╚═╝╚═╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝╚══════╝
███╗ ███╗██╗██████╗ ██████╗ ██╗ ███████╗
████╗ ████║██║██╔══██╗██╔══██╗██║ ██╔════╝
██╔████╔██║██║██║ ██║██║ ██║██║ █████╗
██║╚██╔╝██║██║██║ ██║██║ ██║██║ ██╔══╝
██║ ╚═╝ ██║██║██████╔╝██████╔╝███████╗███████╗
╚═╝ ╚═╝╚═╝╚═════╝ ╚═════╝ ╚══════╝╚══════╝
A local proxy that converts websites and APIs to clean Markdown.
Try it in 2 minutes with Docker. Convert HTML pages, JSON APIs, and dynamic sites. Get token counts for LLM budgeting.
By Rick Crawford | MIT License
Quick install to current directory:
curl -fsSL "https://github.com/rickcrawford/markdowninthemiddle/releases/latest/download/install.sh" | bashOr download manually from GitHub Releases.
cd docker && docker compose up -d
curl -x http://localhost:8080 https://example.comgo build -o mitm .
./mitm
curl -x http://localhost:8080 https://example.comDone! Your proxy is running on http://localhost:8080
HTML pages → Clean Markdown JSON APIs → Formatted Markdown (with custom templates) JavaScript sites → Renders first, then converts (optional) Token counting → Estimate LLM costs before processing
# Convert a GitHub user profile
curl -x http://localhost:8080 https://api.github.com/users/octocat
# Get token count for cost estimation
curl -x http://localhost:8080 https://example.com -sD - | grep X-Token-Count
# Use with Claude Desktop (MCP mode)
./mitm mcp --transport chromedp
# Add to Claude settings, then ask Claude to fetch and summarize URLs
# Save all conversions to files
./mitm --output-dir ./markdown- 📄 HTML to Markdown - All HTML automatically converted
- 📋 JSON to Markdown - Custom Mustache templates for API responses
- 🤖 Claude Integration - MCP tools for Claude Desktop
- 🔄 JavaScript Rendering - Headless Chrome for dynamic sites
- 💬 Token Counting - TikToken counts for cost estimation
- 🔐 HTTPS & MITM - Self-signed certificates included
- 💾 Caching - RFC 7234 compliant local caching
- 🔍 URL Filtering - Regex-based domain restrictions
Private API Documentation Convert internal API responses to clean markdown for Claude or other LLMs without exposing raw JSON or sending data through third-party services.
Local LLM Development Run locally with private documents and internal services. No internet dependency, no data leakage. Perfect for offline LLM workflows.
Claude Desktop Integration Add MCP tools so Claude Desktop can fetch, convert, and analyze URLs locally with full markdown formatting and token counting.
Web Content for LLM Context Convert website content to markdown before feeding it to language models. Save token budgets with accurate token counting.
Internal Network Crawling Access internal documentation, staging sites, and self-signed HTTPS endpoints without going through public proxies.
Multi-Format Content Processing Handle HTML pages, JSON APIs, and dynamic JavaScript-rendered sites all through one local proxy interface.
| Guide | For |
|---|---|
| CONFIGURATION.md | All command-line options |
| JSON_CONVERSION.md | Using Mustache templates for APIs |
| MCP_SERVER.md | Claude Desktop integration |
| TROUBLESHOOTING.md | Common issues |
| DOCKER.md | Docker deployment |
Built with Go, inspired by Cloudflare's Markdown for Agents. Unlike cloud-based markdown conversion services or web scraping libraries, Markdown in the Middle is a local HTTPS proxy that runs on your machine. It converts HTML pages and JSON APIs to clean markdown with token counting, enabling secure processing of private content.
- 🏢 Internal networks and private services
- 🔒 Staging/testing environments with self-signed certificates
- 🤖 Local LLM deployments and offline AI workflows
- 🔌 Private APIs and proprietary content without external dependencies
- 🛡️ Organizations with data privacy and security requirements
Rick Crawford — GitHub | Website
Building tools for AI and APIs.
MIT - See LICENSE for details