Skip to main content
Glama

Markdown-Anything

It makes the open web AI-native. No browser needed. No API keys. No Docker.

Navigable, interactive, prompt-injection-safe Markdown (IMDF v1.0) for AI agents — with clickable links (@a1..@aN), pagination (@next), typed forms (@f1..@fM), stateful navigation, a site-harness hub (md-hub), and a zero-dependency MCP server (md-anything mcp). Inspired by HKUDS/CLI-Anything.


Side-by-Side: Raw HTML vs. IMDF v1.0

Even on Hacker News — already one of the lightest HTML pages on the web — md-anything cuts payload size by 80.5% (5.1× smaller) while adding hash-tagged prompt-injection boundaries and 31 deterministic clickable actions (@a1..@a30, @next):

curl -sL https://news.ycombinator.com | wc -c
# 32,618 bytes (raw HTML tables & boilerplate)

md-anything open https://news.ycombinator.com | wc -c
#  6,374 bytes (IMDF v1.0 Markdown + YAML frontmatter + 31 actions)

Metric

Raw HTML (curl)

md-anything (IMDF v1.0)

Payload size (HN front page)

32,618 bytes

6,374 bytes (-80.5%)

Prompt-injection trust boundary

None

SHA-256 hash-tagged wrapper

Navigation affordances

Raw DOM / <a href> scraping

Deterministic @a1..@aN, @next, @f1..@fM

Structured JSON mode

Manual HTML parsing

Built-in --json (body, actions, forms, warnings)


Related MCP server: searxNcrawl

Key Features

  • IMDF v1.0 (docs/SPEC.md):

    • Trusted YAML frontmatter (format: imdf/1.0, url, title, tier, harness, status, fetched_at, content_hash, action_count, warnings).

    • Hash-tagged prompt-injection trust boundaries (<!-- BEGIN UNTRUSTED WEB CONTENT (sha256:...) --> / <!-- END UNTRUSTED WEB CONTENT (sha256:...) -->), zero-width/bidi stripping, hidden CSS/ARIA & boilerplate removal, and spoofed boundary redaction.

    • Deterministic inline + tabular action affordances (@a1..@aN, @next, @f1..@fM) and --json output across all commands.

  • 3-Tier Resolution Engine (docs/ARCHITECTURE.md):

    • Tier 1 — Native: Sends Accept: text/markdown, text/plain;q=0.8, text/html;q=0.7 and natively ingests text/markdown, /llms.txt, and /webagents.md.

    • Tier 2 — Site Harnesses: Built-in structured harnesses for github, hackernews, wikipedia, and search (DuckDuckGo with /l/?uddg= redirect unwrapping), with automatic fallback to Tier 3 on API error or rate limit.

    • Tier 3 — Generic HTML-to-IMDF: Zero-dependency pure-Python html.parser converter supporting headings, lists, code blocks, blockquotes, tables, images, links, pagination hints, and forms, plus optional Playwright JS rendering (--render-js).

  • Agent-Readiness Discovery (md-anything discover <url>): Probes Accept: text/markdown, /llms.txt, /webagents.md, and HarnessRegistry.

  • Stateful Navigation, CLI & REPL: Persistent JSON session history (open, click, submit, actions, back, forward, search, repl).

  • Markdown-Hub (md-hub): Browse, search, inspect, and scaffold new <site>/site-harness/ bundles.

  • Optional FastAPI Gateway (md-anything serve): HTTP API for /health, /harnesses, /md, /discover, and /session/{open,click,submit}.


Installation

Core installation has zero required third-party dependencies (Python 3.10+ stdlib only).

Option A: Global Install with pipx (Recommended)

Works cleanly on macOS and Linux without modifying system Python:

pipx install git+https://github.com/Vibherpunk/Markdown-Anything.git

To upgrade later:

pipx install --force git+https://github.com/Vibherpunk/Markdown-Anything.git

Option B: Install from Source (Virtual Environment)

git clone https://github.com/Vibherpunk/Markdown-Anything.git
cd Markdown-Anything
python3 -m venv .venv
source .venv/bin/activate
pip install -e .

Optional Extras

# Optional FastAPI HTTP gateway (md-anything serve)
pip install -e ".[server]"

# Optional Playwright JS rendering (--render-js)
pip install -e ".[js]"
playwright install chromium

Quick Start

CLI & Stateful Navigation

# Open a URL (auto-selects Tier 1 -> Tier 2 -> Tier 3)
md-anything open https://github.com/Vibherpunk/Markdown-Anything

# Inspect clickable actions and forms
md-anything actions

# Click a link or pagination affordance
md-anything click @a1

# Submit a form with required-field validation
md-anything submit @f1 q="agent markdown"

# Navigate history
md-anything back
md-anything forward

# Web, GitHub, or Wikipedia search
md-anything search "IMDF markdown"
md-anything search "markdown" --site wikipedia

# Probe agent readiness of any site
md-anything discover https://example.com --json

# Launch the stateful interactive REPL
md-anything repl

Markdown-Hub (md-hub)

md-hub list
md-hub search github
md-hub info hackernews --json
md-hub scaffold docs.python.org --out ./harnesses

Native MCP Server (Claude Desktop, Cursor, Windsurf, Claude Code)

Zero-dependency JSON-RPC 2.0 MCP server over stdio exposing open_url, click_action, submit_form, list_actions, go_back, go_forward, search_web, and discover_url.

  1. Find your installed md-anything path:

    which md-anything
  2. Add it to your AI client's MCP config file (replace /path/to/md-anything with the output of which md-anything):

    • Claude Desktop (macOS): ~/Library/Application Support/Claude/claude_desktop_config.json

    • Cursor: ~/.cursor/mcp.json

    • Claude Code (one-liner): claude mcp add markdown-anything $(which md-anything) mcp

{
  "mcpServers": {
    "markdown-anything": {
      "command": "/path/to/md-anything",
      "args": ["mcp"]
    }
  }
}
  1. Restart your AI app (it launches md-anything mcp automatically in the background). To verify the server directly in a terminal:

printf '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}\n{"jsonrpc":"2.0","id":2,"method":"tools/list"}\n' | md-anything mcp

Native LLM Tool Schemas (OpenAI & Anthropic)

Drop Markdown-Anything directly into any Python agent loop without a terminal:

from markdown_anything import ToolDispatcher, get_openai_tools, get_anthropic_tools

tools = get_openai_tools()      # or get_anthropic_tools()
dispatcher = ToolDispatcher()

# When your model emits a tool call:
result = dispatcher.call("open_url", {"url": "https://news.ycombinator.com"})

Optional FastAPI HTTP Gateway

md-anything serve --host 127.0.0.1 --port 8000

Endpoints:

  • GET /health

  • GET /harnesses

  • GET /md?url=...&tier=auto&format=markdown|json

  • GET /discover?url=...

  • POST /session/open

  • POST /session/click

  • POST /session/submit


Agent Skills

Pre-built agent skill guides live under skills/:


Running Tests

PYTHONPATH=src python3 -m unittest discover -s tests -v

License

MIT License — see LICENSE for details.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables AI agents to search the web through configured providers and crawl pages or entire sites into clean, deduplicated Markdown or JSON, including authenticated crawls.
      -
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables AI agents to search the web through configured providers and crawl single pages or entire sites into clean, deduplicated Markdown or JSON, including authenticated pages.
      -
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables AI agents to search the web through configured providers and crawl pages or whole sites into clean, deduplicated Markdown or JSON, including authenticated crawls.
      -