Skip to main content

Turn a Markdown file into a local MCP server, with zero dependencies.

Project description

mdMCP

Turn a Markdown file into a local MCP server, with zero dependencies.

pip install mdmcp

Quickstart

1. Write a tool file:

## Tool: health_check
Check if a URL is reachable.
### Parameters
- url (string, required): URL to check
### Execute
\```bash
STATUS=$(curl -sf -o /dev/null -w '%{http_code}' -m 5 "$MDMCP_URL")
echo "HTTP $STATUS"
\```

2. Serve it:

mdmcp serve tools.md

3. Connect to Claude Code:

{
  "mcpServers": {
    "my-tools": {
      "command": "mdmcp",
      "args": ["serve", "tools.md"]
    }
  }
}

That's it. Your Markdown is now an MCP server.

How it works

  • ## Tool: name defines a tool
  • ### Parameters defines input schema (envvar-based, no string interpolation)
  • ### Execute contains a bash script inside a fenced code block
  • Parameters are passed as $MDMCP_<NAME> environment variables

Commands

mdmcp list tools.md              # List available tools
mdmcp run tools.md tool_name '{}'  # Run a tool once
mdmcp serve tools.md             # Start MCP stdio server

Security

  • Minimal env: only PATH, HOME, USER, SHELL, LANG, TERM are inherited. API keys and tokens are NOT exposed to tool scripts.
  • No string interpolation: parameters are passed as environment variables, not injected into shell code.
  • Required param validation: missing required parameters return an error before execution.
  • Timeout + process cleanup: 30s timeout with process group kill to prevent zombies.

Tips

  • Always quote "$MDMCP_VAR" in bash to prevent word splitting
  • Use ${MDMCP_VAR:-default} for optional params with bash-side defaults
  • You can use python3 -c inside bash for complex logic (see examples/data-tools.md)
  • Use set -eu at the top of scripts for safer execution

Examples

See the examples/ directory:

  • ops-tools.md — disk usage, port check, git log, docker status, health check
  • dev-tools.md — find TODOs, run linter, check port (from Codex dogfood)
  • data-tools.md — CSV summary, JSON inspect, file diff (from Gemini dogfood)

Known limitations

  • Execute blocks only support ``` fences (not ~~~)
  • Parameter names must be \w+ (no spaces or special chars)
  • Nested ``` inside heredocs will confuse the parser
  • All parameter values are strings in bash; cast manually if needed

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

markdown_mcp_server-0.1.0.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

markdown_mcp_server-0.1.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file markdown_mcp_server-0.1.0.tar.gz.

File metadata

  • Download URL: markdown_mcp_server-0.1.0.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for markdown_mcp_server-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3f4a80b567616a2d4880cb7885905113195abdf3304dda0759056c86b78bc5b1
MD5 896d370446b18bce7b6f3edd89bf3e8e
BLAKE2b-256 9339ae38cf4eb80d8e3164acc21a850fafa89a464001b38a047ebc1ea65af8f8

See more details on using hashes here.

File details

Details for the file markdown_mcp_server-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for markdown_mcp_server-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1be912375131cb1e8dcd15f786bda14765e3635c20ca20053b9491dfa386a598
MD5 9bd2b487586c634d9992442c5fa8acc3
BLAKE2b-256 80dcbabca14b5518178d649f72304cf409d8e2c913bd8f8d4c09abc6eaf86bfb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page