Share agent-generated Markdown as links — GitHub gists or self-hosted, via MCP
claude mcp add sharedoc-mcp -- npx -y sharedoc-mcp{
"mcpServers": {
"sharedoc-mcp": {
"command": "npx",
"args": ["-y", "sharedoc-mcp"],
"env": {
"SHAREDOC_PUBLIC_URL": "<sharedoc_public_url>"
}
}
}
}SHAREDOC_PUBLIC_URLMCP Servers overview
# sharedoc-mcp
> **Agent-generated Markdown → a link you can hand to anyone. GitHub gists today, your own server tomorrow.**
English | [繁體中文](./README.zh-TW.md)
[](https://www.npmjs.com/package/sharedoc-mcp)
[](https://github.com/AugustusW/sharedoc-mcp/releases)
[](LICENSE)
[](https://nodejs.org/)
[](https://modelcontextprotocol.io/)
[](https://claude.com/claude-code)
[](https://developers.openai.com/codex/)
An [MCP](https://modelcontextprotocol.io/) stdio server — works in [Claude Code](https://claude.com/claude-code), Codex CLI, and any MCP client — that gives your agent **8 tools to publish, update, search, and revoke shareable documents**. Two pluggable backends behind one interface: **gist** (zero setup, rides your logged-in `gh` CLI) and **selfhost** (SQLite on your machine, passwords, enforced expiry).
> When a backend can't honor a parameter (e.g. `password` on gist), it returns a clear error instead of silently ignoring it.
## Why?
AI agents produce Markdown constantly — reports, research digests, meeting notes. Getting that to another human usually means copy-pasting walls of text into a chat window.
```text
Without sharedoc-mcp With sharedoc-mcp
──────────────────── ─────────────────
copy a wall of text into chat "share this as a doc"
paste again for each person one link for everyone
content lives in chat scroll revoke / extend / append later
"can you password it?" …no selfhost backend: bcrypt + expiry
```
## Features
- ✓ 8 MCP tools: create / append / extend / reset password / rename / revoke / delete / search
- ✓ `sharedoc-mcp serve` daemon mode — selfhost links keep working after your MCP client closes
- ✓ Content search: find old share links by what's in them, not just the title
- ✓ `GET /healthz` — identity-aware health probe for external monitoring / restart automation
- ✓ Two backends, one interface — switch with a single env var, tool schemas stay identical
- ✓ **Gist backend** (default): secret gists via your logged-in `gh` CLI — no tokens to manage, nothing new to host
- ✓ **Selfhost backend**: docs stay on your machine (SQLite via built-in `node:sqlite` — zero native modules)
- ✓ Server-verified passwords (bcrypt) with rate-limited attempts — 5/minute, HTTP 429, counters persisted in SQLite so a restart can't reset them (selfhost)
- ✓ Enforced expiry (410) and revoke with a 7-day content-purge grace (selfhost); lazy expiry cleanup (gist)
- ✓ Markdown rendered through `marked` + `sanitize-html` — scripts, event handlers, and `javascript:` URLs in shared content are stripped
- ✓ Viewer binds **127.0.0.1 only**, answers with a strict security-header set (CSP `default-src 'none'`, nosniff, DENY framing, no-referrer, no-store) — exposure is a tunnel you control (recipes below)
- ✓ Local index for `search_shared_docs` + create dedup (identical unprotected retries within 5 min return the same URL; a retry that adds a password/expiry always creates a new doc)
- ✓ Two MCP clients can share one data dir: SQLite WAL + busy timeout, graceful port sharing
- ✓ 70 offline tests; `npm test` passes on a clean checkout
## Install
Requires Node.js ≥ 22.13.0. Gist backend additionally needs [GitHub CLI](https://cli.github.com) logged in (`gh auth login`).
**Option A — Claude Code (one line):**
```bash
claude mcp add sharedoc --scope user -- npx -y sharedoc-mcp@^2
```
**Option B — Codex CLI** (`~/.codex/config.toml`):
```toml
[mcp_servers.sharedoc]
command = "npx"
args = ["-y", "sharedoc-mcp@^2"]
```
**Option C — any other MCP client:** run `npx -y sharedoc-mcp@^2` as a stdio server.
> **Why `@^2`?** A bare `npx -y sharedoc-mcp` resolves the **latest published version** on every cold start — a future 3.0 could change behavior (or remove a tool) under you without warning. `@^2` follows 2.x fixes but never crosses a breaking major; pin an exact version (`@2.1.0`) if you want zero drift.
## Pick your backend
| | 🅰 `gist` (default) | 🅱 `selfhost` |
|---|---|---|
| Setup | none — uses your logged-in `gh` CLI | none extra — data stays on your machine |
| Doc lives on | GitHub (secret gist) | your machine (SQLite) |
| Link reachable | anywhere, immediately | localhost — add a tunnel to share externally |
| Password | ✗ (the secret URL is the protection) | ✓ server-verified (bcrypt), rate-limited |
| Expiry | lazy — expired gists deleted on next use | enforced — expired links return 410 |
| Revoke | gist deleted immediately, irreversibly | immediate 410, content purged after 7-day grace |
### Gist quickstart
Ask your agent to "share this as a doc" — it calls `create_shared_doc` and returns a secret gist URL. Secret gists are not listed publicly and the URL is unguessable, but **anyone who has the link can read it** — that's the whole security model of this backend. Need passwords? Use `selfhost`.
A local index (`~/.config/sharedoc-mcp/index.json`) tracks what you've shared, powering search and expiry cleanup. Expiry here is *lazy*: expired gists are deleted the next time any tool runs, not at the exact expiry moment.
### Selfhost quickstart
```bash
claude mcp add sharedoc --scope user --env SHAREDOC_BACKEND=selfhost -- npx -y sharedoc-mcp@^2
```
Docs live in SQLite at `~/.local/share/sharedoc-mcp/`; a viewer serves them at `http://127.0.0.1:8377`. To share beyond your machine, put a tunnel in front and set `SHAREDOC_PUBLIC_URL`:
> **Links that outlive your editor:** in MCP mode the viewer dies with the MCP client — close Claude Code and selfhost links stop answering until the next session (data is safe in SQLite). Run the standalone daemon to keep links alive around the clock:
>
> ```bash
> npx -y sharedoc-mcp@^2 serve # viewer only, same DB — keep it running via launchd/systemd/tmux (Windows: Task Scheduler or NSSM)
> ```
>
> MCP clients detect the daemon already owns the port and simply use it.
>
> **When to set this up:** the moment you first hand a link to someone else — do it together
> with your tunnel (both should be long-running, e.g. under launchd/systemd). Until then the
> MCP-mode viewer is enough, and gist-backend users never need it.
| Recipe | Fits you if | Setup |
|---|---|---|
| **Tailscale private** (recommended) | recipients are your own devices / people you can invite to your tailnet | `tailscale serve --bg 8377` → `https://<machine>.<tailnet>.ts.net`, reachable **only inside your tailnet** — nothing is exposed to the public internet |
| **Tailscale Funnel** | share with anyone, no domain | `tailscale funnel 8377` → same stable URL, but public |
| **Cloudflare named tunnel** | you own a domain | domain on Cloudflare, `cloudflared tunnel create` + route a hostname to `http://127.0.0.1:8377` |
| **cloudflared quick tunnel** | one-off sharing | `cloudflared tunnel --url http://127.0.0.1:8377` → random URL, changes every restart |
#### Own a domain? Cloudflare named tunnel, step by step
A branded, stable share URL like `https://docs.example.com/docs/<uuid>` — TLS handled by Cloudflare, works from behind NAT:
```bash
# one-time setup (domain already added to Cloudflare — the free plan is enough)
cloudflared tunnel login
cloudflared tunnel create sharedoc
cloudflared tunnel route dns sharedoc docs.example.com
```
`~/.cloudflared/config.yml`:
```yaml
tunnel: sharedoc
credentials-file: ~/.cloudflared/<tunnel-id>.json
ingress:
- hostname: docs.example.com
service: http://127.0.0.1:8377
- service: http_status:404
```
Run `cloudflared tunnel run sharedoc` (or install it as a service for always-on), and register the MCP server with the public URL:
```bash
claude mcp add sharedoc --scope user \
--env SHAREDOC_BACKEND=selfhost \
--env SHAREDOC_PUBLIC_URL=https://docs.example.com \
-- npx -y sharedoc-mcp
```
Extras this unlocks: Cloudflare's DDoS protection comes free; you can layer WAF rules, or put [Cloudflare Access](https://www.cloudflare.com/zero-trust/products/access/) (SSO) in front of everything except the share paths — an "SSO inside, password-protected shares outside" split.
**Alternative — always-on without a home machine:** run sharedoc-mcp on a VPS (where your agent also runs) and point nginx/caddy at `127.0.0.1:8377` with your domain and auto-TLS; no tunnel needed.
Environment variables:
| Variable | Default | Meaning |
|---|---|---|
| `SHAREDOC_BACKEND` | `gist` | `gist` or `selfhost` |
| `SHAREDOC_PORT` | `8377` | viewer port (selfhost) |
| `SHAREDOC_PUBLIC_URL` | `http://127.0.0.1:<port>` | URL prefix in share links — set to your tunnel hostname |
| `SHAREDOC_DATA_DIR` | `~/.local/share/sharedoc-mcp` | SQLite location (selfhost) |
| `SHAREDOC_INDEX_PATH` | `~/.config/sharedoc-mcp/index.json` | local index (gist) |
| `MCP_CALLER` | — | default author attribution for created docs |
## The 8 tools
| Tool | Does |
|---|---|
| `create_shared_doc` | title + Markdown (+ optional password / `expires_in_hours` / author) → share URL |
| `append_to_shared_doc` | append Markdown (not idempotent — a retry appends twice) |
| `extend_shared_doc` | extend expiry by N hours |
| `reset_shared_doc_password` | set / change / remove (null) the password (selfhost only) |
| `update_shared_doc_title` | rename |
| `revoke_shared_doc` | kill the link, keep the record (see backend table for semantics) |
| `delete_shared_doc` | kill the link AND erase the record — irreversible; requires `confirm: true` (agents should get explicit user approval first) |
| `search_shared_docs` | no args = list newest links; tWhat people ask about sharedoc-mcp
What is AugustusW/sharedoc-mcp?
+
AugustusW/sharedoc-mcp is mcp servers for the Claude AI ecosystem. Share agent-generated Markdown as links — GitHub gists or self-hosted, via MCP It has 10 GitHub stars and was last updated today.
How do I install sharedoc-mcp?
+
You can install sharedoc-mcp by cloning the repository (https://github.com/AugustusW/sharedoc-mcp) or following the README instructions on GitHub. ClaudeWave also provides quick install blocks on this page.
Is AugustusW/sharedoc-mcp safe to use?
+
AugustusW/sharedoc-mcp has not been audited yet by our security agent. Review the original repository on GitHub before using it in production.
Who maintains AugustusW/sharedoc-mcp?
+
AugustusW/sharedoc-mcp is maintained by AugustusW. The last recorded GitHub activity is from today, with 0 open issues.
Are there alternatives to sharedoc-mcp?
+
Yes. On ClaudeWave you can browse similar mcp servers at /categories/mcp, sorted by popularity or recent activity.
Deploy sharedoc-mcp to your cloud
Ship this repo to production in minutes. Each platform spins up its own environment with editable env vars.
Maintain this repo? Add a badge to your README
Drop the badge into your GitHub README to show it's tracked on ClaudeWave. Each badge links back to this page and reflects the live Trust Score.
[](https://claudewave.com/repo/augustusw-sharedoc-mcp)<a href="https://claudewave.com/repo/augustusw-sharedoc-mcp"><img src="https://claudewave.com/api/badge/augustusw-sharedoc-mcp" alt="Featured on ClaudeWave: AugustusW/sharedoc-mcp" width="320" height="64" /></a>More MCP Servers
Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.
User-friendly AI Interface (Supports Ollama, OpenAI API, ...)
An open-source AI agent that brings the power of Gemini directly into your terminal.
The fastest path to AI-powered full stack observability, even for lean teams.
Real-time global intelligence dashboard. AI-powered news aggregation, geopolitical monitoring, and infrastructure tracking in a unified situational awareness interface
🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl!