Built for AI
Connect the SWD MCP server
The SWD Editor Model Context Protocol server lets an AI assistant make, read, and sign Sealed Web Documents for you. Connect it once, then just ask, in plain language, and it handles the files. It runs entirely on your machine, with no cloud and no sign-in.
What it does
Once connected, your assistant can seal a folder or a live web page into one .swd.html, read and verify any document you point it at, and sign documents with a key you hold. It wraps the same engine the swd command line uses, so a document built or signed over MCP is byte-identical to one built by hand: same seal, no drift.
Before you start
- Node.js 18 or newer on your machine.
- The SWD repo checked out locally (run npm install once for the two runtime dependencies). The server lives at mcp/swd-mcp.js inside it.
- An MCP-capable AI client: Claude Desktop, Claude Code, Cursor, VS Code, or another.
- Optional: for swd_snapshot (capturing a live URL), Chrome or Chromium plus puppeteer-core, the same optional dependency the CLI's snapshot command uses.
Everywhere below, replace /absolute/path/to/swd with the real path to your checked-out repo. All paths passed to the tools must be absolute.
Claude Desktop
Add the server to your claude_desktop_config.json, then restart Claude Desktop. You'll see SWD in the tools list.
{
"mcpServers": {
"swd": {
"command": "node",
"args": ["/absolute/path/to/swd/mcp/swd-mcp.js"]
}
}
}
Claude Code
From your terminal:
claude mcp add swd -- node /absolute/path/to/swd/mcp/swd-mcp.js
Cursor
Add to .cursor/mcp.json in your project (or the global config):
{
"mcpServers": {
"swd": {
"command": "node",
"args": ["/absolute/path/to/swd/mcp/swd-mcp.js"]
}
}
}
VS Code
Add to .vscode/mcp.json:
{
"servers": {
"swd": {
"command": "node",
"args": ["/absolute/path/to/swd/mcp/swd-mcp.js"]
}
}
}
Other MCP clients
Any client that speaks the Model Context Protocol can use it. Spawn the server over stdio and speak line-delimited JSON-RPC 2.0 on its stdin/stdout. It implements initialize, tools/list, tools/call, and ping; logs go to stderr.
node /absolute/path/to/swd/mcp/swd-mcp.js
The tools
Nine tools, grouped by what they do:
| Tool | Kind | What it does |
|---|---|---|
| swd_pack | Make | Seal a website folder into one offline, tamper-evident .swd.html. Optionally encrypt (password) and sign (key) inline. Reports any external references that would be dead inside the seal. |
| swd_snapshot | Make | Capture a live URL in a headless browser and seal it. Guarded against private/LAN/metadata URLs by default. |
| swd_verify | Read | Check a document's seal is intact and report signature status. |
| swd_inspect | Read | Read a document's metadata and file list, without extracting it. |
| swd_read_file | Read | Read one file's text from inside a document, without unpacking. |
| swd_unpack | Read | Extract a document's contents to a folder (refuses encrypted docs). |
| swd_keygen | Sign | Generate an Ed25519 signing key file. |
| swd_sign | Sign | Sign a document with a local key file (countersign, without changing it). |
| swd_pubkey | Sign | Export the public half of a key file, safe to share. |
Honest limits
These are baked into the tool descriptions so the assistant can't overclaim. They're a trust feature, not fine print.
- No network at runtime. Sealed documents never touch the network when opened. If a page you pack references a remote script or font, that piece is dead inside the seal, and swd_pack / swd_snapshot tell you exactly which references those are so you can bundle them locally.
- A signature proves integrity and which key signed, never who holds the key. The signer label is self-asserted. The assistant signs only with a key file you point it at; it can't invent an identity.
- Encryption strength is entirely the password. An encrypted document can't be read or unpacked without it, and a weak password can be brute-forced offline.
- Every write is checked: absolute paths only, correct extension, and no silent overwrite (you pass overwrite: true on purpose).
Example prompts
- "Seal the folder /home/me/mysite into a SWD and tell me if anything won't work offline."
- "Snapshot example.com/report into a sealed document."
- "Generate a signing key at /home/me/keys/mine.json, then pack /home/me/report into a signed, encrypted SWD."
- "What's inside proposal.swd.html? Summarize it and check the signature."
Troubleshooting
- The tools don't show up. Restart the client after editing its config, and check the path to swd-mcp.js is absolute and correct.
- "Cannot find module." Run npm install in the SWD repo once, so the two runtime dependencies are present.
- Snapshot fails. swd_snapshot needs Chrome/Chromium (set CHROME_PATH or have one installed) and puppeteer-core. The other eight tools don't.
- "Node not found." Install Node.js 18 or newer and make sure node is on your PATH.