hedgedoc-mcp

hedgedoc-mcp

MCP server for interacting with self-hosted HedgeDoc 1.x, enabling AI agents to create, read, update, and manage notes via session-cookie authentication with automatic re-login.

Category
访问服务器

README

hedgedoc-mcp

An MCP server that lets AI agents — Claude Code, Codex, Hermes, or any MCP-compatible client — read and write notes on a self-hosted HedgeDoc 1.x instance.

HedgeDoc 1.x has no API token system, so this server handles the real auth model (session cookies from email/password login) and exposes it as a clean, agent-friendly toolset.


Why this exists

HedgeDoc is a great self-hosted, open-source, collaborative markdown editor. But if you want an AI agent to write notes to it programmatically, you hit a wall immediately: HedgeDoc 1.x has no API tokens. Every write endpoint (POST /new, etc.) requires an authenticated browser-style session, tracked via an Express connect.sid cookie.

This project does the unglamorous work of handling that correctly — login, cookie storage, automatic re-authentication on expiry — and wraps it in an MCP server so any agent can just call hedgedoc_create_note and not think about any of it.

Features

  • 🔐 Handles HedgeDoc 1.x's real auth model (session cookies, not tokens)
  • 🔁 Auto re-login on session expiry — no manual cookie refresh needed
  • 🛠️ 6 MCP tools: create, read, update, info, whoami, history
  • 🐍 Standalone Python client (hedgedoc_mcp.client.HedgeDocClient) usable outside MCP too
  • Fully tested — mocked HTTP, no live server required to run the test suite
  • 📦 Works with any MCP client: Claude Code, Codex, Hermes, Cursor, custom clients

Quick start

1. Install

With uv (recommended — no venv management needed):

# Run directly without installing (uvx downloads + caches automatically)
uvx hedgedoc-mcp

# Or install as a persistent tool
uv tool install hedgedoc-mcp

Not yet on PyPI? Run straight from GitHub instead — same zero-install experience:

uvx --from git+https://github.com/mrsunglasses-experiments/hedgedoc-mcp hedgedoc-mcp

Use this exact form in the agent config examples below (as args) until the package is published.

With pip:

pip install hedgedoc-mcp

From source:

git clone https://github.com/mrsunglasses-experiments/hedgedoc-mcp.git
cd hedgedoc-mcp
uv pip install -e .          # or: pip install -e .

2. Get a session cookie

HedgeDoc 1.x has no API tokens, so you authenticate once via the login endpoint and reuse the resulting session cookie:

hedgedoc-mcp-login --url https://md.example.com \
  --email you@example.com --password 'your-password' \
  --write-env .env

This prints (and optionally saves) HEDGEDOC_SESSION_COOKIE=....

Alternatively, set HEDGEDOC_EMAIL + HEDGEDOC_PASSWORD directly and the server will log in automatically on first use, re-authenticating whenever the session expires — no manual refresh needed.

3. Configure environment variables

export HEDGEDOC_URL=https://md.example.com
export HEDGEDOC_SESSION_COOKIE=s%3A...          # from step 2, OR:
export HEDGEDOC_EMAIL=you@example.com            # for auto re-login
export HEDGEDOC_PASSWORD=your-password

At minimum you need HEDGEDOC_URL plus either the cookie or the email+password pair. Setting both is recommended — the cookie is used as a fast path, and email/password is the automatic fallback whenever it expires.

4. Wire it into your agent

<details> <summary><b>Claude Code</b></summary>

claude mcp add hedgedoc -- uvx hedgedoc-mcp

Or add to .claude/mcp.json:

{
  "mcpServers": {
    "hedgedoc": {
      "command": "uvx",
      "args": ["hedgedoc-mcp"],
      "env": {
        "HEDGEDOC_URL": "https://md.example.com",
        "HEDGEDOC_EMAIL": "you@example.com",
        "HEDGEDOC_PASSWORD": "your-password"
      }
    }
  }
}

</details>

<details> <summary><b>Codex CLI</b></summary>

Add to ~/.codex/config.toml:

[mcp_servers.hedgedoc]
command = "uvx"
args = ["hedgedoc-mcp"]
env = { HEDGEDOC_URL = "https://md.example.com", HEDGEDOC_EMAIL = "you@example.com", HEDGEDOC_PASSWORD = "your-password" }

</details>

<details> <summary><b>Hermes</b></summary>

Add an MCP server entry in your Hermes config with command: uvx, args: [hedgedoc-mcp], and the same environment variables. See the Hermes MCP docs for the exact config location on your install.

</details>

<details> <summary><b>Any other MCP client</b></summary>

This is a standard stdio MCP server. Point your client at uvx hedgedoc-mcp (or the installed hedgedoc-mcp executable) with the environment variables above set, and it will discover the 6 tools automatically via the standard MCP list_tools handshake. Using uvx means the client never needs a separate install step — uv downloads and caches the package on first run.

</details>

Available tools

Tool Description
hedgedoc_create_note Create a new note (optionally with a custom URL alias). Returns the note ID and URL.
hedgedoc_read_note Fetch a note's raw markdown content by ID or alias.
hedgedoc_update_note Overwrite an existing note's content (alias-based notes only — see Limitations).
hedgedoc_note_info Get a note's title, description, view count, and timestamps.
hedgedoc_whoami Verify the session is valid and show the logged-in user.
hedgedoc_list_history List the logged-in user's recently viewed/pinned notes.

Using the Python client directly

You don't need MCP to use this — the underlying client is a normal Python class:

from hedgedoc_mcp.client import HedgeDocClient

client = HedgeDocClient("https://md.example.com")
client.login(email="you@example.com", password="your-password")

result = client.create_note("# Research notes\n\nSome findings...")
print(result.url)

content = client.read_note(result.note_id)
info = client.note_info(result.note_id)

Known limitations

HedgeDoc 1.x's HTTP API is genuinely limited compared to newer forks — see docs/LIMITATIONS.md for the full rundown, including:

  • No API tokens (session-cookie auth only)
  • No generic "update note by ID" endpoint (alias-based notes only)
  • No delete endpoint over HTTP

These are constraints of the HedgeDoc 1.x server itself, not this client — the docs explain the workarounds this project uses and what genuinely isn't possible.

Development

git clone https://github.com/mrsunglasses-experiments/hedgedoc-mcp.git
cd hedgedoc-mcp
uv venv && source .venv/bin/activate
uv pip install -e ".[dev]"

pytest                 # run tests (fully mocked, no live server needed)
ruff check .            # lint

See docs/ARCHITECTURE.md for how the auth flow and MCP layer fit together, and CONTRIBUTING.md for contribution guidelines.

License

MIT — see LICENSE.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选