{"id":50953022,"url":"https://github.com/psenger/obsidian-markdown-lint-mcp-server","last_synced_at":"2026-06-18T03:34:01.080Z","repository":{"id":363261086,"uuid":"1262524783","full_name":"psenger/obsidian-markdown-lint-mcp-server","owner":"psenger","description":"Stdio MCP server for Claude Code that lints Markdown, validates front matter against JSON Schema, and renders Mermaid diagrams to SVG, all inside Docker.","archived":false,"fork":false,"pushed_at":"2026-06-15T23:55:40.000Z","size":528,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-18T03:33:56.577Z","etag":null,"topics":["claude","claude-code","docker","front-matter","json-schema","markdown","markdownlint","mcp","mermaid","model-context-protocol","obsidian","stdio","svg","typescript"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/psenger.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-08T04:23:05.000Z","updated_at":"2026-06-08T23:16:53.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/psenger/obsidian-markdown-lint-mcp-server","commit_stats":null,"previous_names":["psenger/obsidian-markdown-lint-mcp-server"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/psenger/obsidian-markdown-lint-mcp-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psenger%2Fobsidian-markdown-lint-mcp-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psenger%2Fobsidian-markdown-lint-mcp-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psenger%2Fobsidian-markdown-lint-mcp-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psenger%2Fobsidian-markdown-lint-mcp-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/psenger","download_url":"https://codeload.github.com/psenger/obsidian-markdown-lint-mcp-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psenger%2Fobsidian-markdown-lint-mcp-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34475375,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-18T02:00:06.871Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["claude","claude-code","docker","front-matter","json-schema","markdown","markdownlint","mcp","mermaid","model-context-protocol","obsidian","stdio","svg","typescript"],"created_at":"2026-06-18T03:34:00.399Z","updated_at":"2026-06-18T03:34:01.072Z","avatar_url":"https://github.com/psenger.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# obsidian-markdown-lint-mcp-server\n\n**An MCP server that lints, validates, and renders your Obsidian vault markdown — all inside Docker.**\n\n[![Node.js](https://img.shields.io/badge/node-%3E%3D20-brightgreen)](https://nodejs.org) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-1.29-blue)](https://github.com/modelcontextprotocol/typescript-sdk) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)\n\n[Tools](#tools) • [Quick Start](#quick-start) • [Configuration](#configuration) • [Schemas](#front-matter-schemas) • [Development](#development)\n\n\u003c/div\u003e\n\n---\n\nRun markdown linting, front matter validation, and Mermaid-to-SVG rendering as MCP tools callable from Claude Code. Docker isolates Chromium and Node.js from your host machine. The server is stateless — it processes content you send and returns results; Claude Code handles all disk I/O.\n\nThis is a **stdio MCP server**: Claude Code launches it as a subprocess (`docker run -i --rm`) and talks to it over stdin/stdout. There is no port and no long-running container — the container starts when a session opens and is removed when it ends.\n\n## Why Docker\n\nMermaid rendering requires a Chromium browser (via Puppeteer). Running that, plus dozens of Node.js dependencies, directly on your laptop is a valid security concern. This server packages everything inside a container. Your vault never mounts into it; content travels as strings.\n\n## Tools\n\n| Tool | What it does |\n|-------|----|\n| `lint_markdown` | Runs markdownlint on content, returns errors and a corrected version |\n| `validate_front_matter` | Validates YAML front matter against a JSON Schema you pass in |\n| `render_mermaid_diagrams` | Renders all ` ```mermaid ``` ` blocks to SVG, replaces them with GitHub image links, embeds the original Mermaid source as base64 in each SVG's `\u003cmetadata\u003e` |\n| `extract_mermaid_from_svg` | Reads a rendered SVG and returns the original Mermaid source as a code block, ready to edit |\n\nThe render/extract pair supports a full edit cycle: render → view SVG in Obsidian → extract → edit source → re-render.\n\n## Quick start\n\n**Prerequisites:** Docker Desktop, Node.js ≥ 20, Claude Code.\n\n```bash\ngit clone \u003crepo\u003e\ncd obsidian-markdown-lint-mcp-server\nnpm install\nnpm run build              # compile TypeScript → dist/\ndocker build -t obsidian-markdown-lint-mcp .   # or: docker compose build\n```\n\nRegister the server with Claude Code. Claude Code runs `docker run -i --rm` itself, per session — you do **not** start a container yourself.\n\n**Per-project (recommended for a vault)** — run this from your vault root; it writes a committable `.mcp.json`:\n\n```bash\nclaude mcp add obsidian-markdown-lint -s project -- docker run -i --rm obsidian-markdown-lint-mcp\n```\n\nThe resulting `.mcp.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"obsidian-markdown-lint\": {\n      \"command\": \"docker\",\n      \"args\": [\"run\", \"-i\", \"--rm\", \"obsidian-markdown-lint-mcp\"]\n    }\n  }\n}\n```\n\n**Global** — make it available in every project (`-s user` writes to `~/.claude.json`):\n\n```bash\nclaude mcp add obsidian-markdown-lint -s user -- docker run -i --rm obsidian-markdown-lint-mcp\n```\n\nVerify with `claude mcp list` (should show `obsidian-markdown-lint` → `connected`), then start a **new** Claude Code session — tools are discovered at session start. The four tools are now available.\n\n\u003e The `-i` flag is required: it keeps the container's stdin open for the JSON-RPC stream. Without it the container gets EOF and exits immediately. Do **not** use `docker compose up` for this server — it is a stdio subprocess, not a long-running HTTP service.\n\n### Hardening (optional)\n\nThe server needs no network, no writable root filesystem, and little memory, so you can lock the container down. `--network none` and `--security-opt no-new-privileges` are always safe (the image skips the Puppeteer download and renders offline):\n\n```bash\nclaude mcp add obsidian-markdown-lint -s project -- docker run -i --rm --network none --security-opt no-new-privileges --memory 2g obsidian-markdown-lint-mcp\n```\n\nFor stricter isolation, add a read-only root with a writable temp dir and drop all Linux capabilities. Chromium renders into `/tmp` because the server launches it with `--disable-dev-shm-usage`, so the `--tmpfs /tmp` is required. Verify a Mermaid render still succeeds under these flags before relying on them, since Chromium's writable paths vary by version:\n\n```bash\ndocker run -i --rm --network none --security-opt no-new-privileges --read-only --tmpfs /tmp --cap-drop ALL --memory 2g obsidian-markdown-lint-mcp\n```\n\n## Configuration\n\n### Vault layout\n\nThe server reads nothing from disk directly. Claude Code reads your vault files and passes content as strings. Place these config files at your vault root:\n\n```\nvault/\n  .markdownlint.json     ← linting rules (optional; defaults to markdownlint defaults)\n  .schemas/\n    _shared.json         ← shared field definitions (reference; not loaded at runtime)\n    article.json\n    how-to.json\n    technical.json\n    deep-research.json\n    strategy.json\n    meeting.json\n    brainstorming.json\n```\n\nPre-built schemas for all seven note types are included in this repo's `.schemas/` directory. Copy them to your vault root. The seven type schemas are self-contained, so `validate_front_matter` only needs the one matching the document's `type`; `_shared.json` is the source the type schemas are built from and is kept for maintenance.\n\n### CLAUDE.md for your vault\n\nAdd a `CLAUDE.md` to your vault project that tells Claude how to use the server. Minimum viable example:\n\n```markdown\n## MCP: obsidian-markdown-lint-mcp-server\n\nVault attachments directory: attachments\nSchemas directory: .schemas/\nLinting config: .markdownlint.json\n\nWhen asked to \"process a vault file\":\n1. Read the file\n2. Read .markdownlint.json and call lint_markdown\n3. Read the type field from front matter, read .schemas/{type}.json, call validate_front_matter\n4. Call render_mermaid_diagrams with attachments_dir=\"attachments\" and the document title\n5. Write the modified_content back to the file\n6. Write each SVG from the svgs array to its path field (decoded from base64)\n\nSVG files contain the original Mermaid source base64-encoded in \u003cmetadata\u003e.\nTo edit a diagram: call extract_mermaid_from_svg with the SVG content,\nedit the returned mermaid_block, then re-run render_mermaid_diagrams.\n```\n\n### Mermaid front matter options\n\nControl rendering per-document:\n\n```yaml\nmermaid_theme: dark          # default | dark | neutral | forest  (default: default)\nmermaid_background: white    # any CSS color or \"transparent\"     (default: white)\n```\n\nAfter rendering, the server adds `mermaid_svg_source: base64-embedded` to the front matter so Claude knows SVGs in this document contain extractable source.\n\n## Front matter schemas\n\nSeven note types are supported. Each schema lives at `.schemas/{type}.json`.\n\n| Type | Extra required fields |\n|---|---|\n| `article` | core only |\n| `how-to` | core only |\n| `technical` | `system`, `component` |\n| `deep-research` | `sources` (array, min 1) |\n| `strategy` | `related`, `prepared_for`, `quarter` |\n| `meeting` | `meeting_date`, `attendees` (array, min 1) |\n| `brainstorming` | core only |\n\nCore required fields on every type: `type`, `title`, `author`, `category`, `tags`, `description`, `summary`, `status`, `version`, `date_created`, `date_updated`.\n\nThe `type` field is the discriminator. Claude reads it from the front matter to select the right schema file before calling `validate_front_matter`.\n\n## How SVG embedding works\n\nEach rendered SVG contains the original Mermaid source, base64-encoded, inside the SVG's `\u003cmetadata\u003e` element:\n\n```xml\n\u003cmetadata\u003e\n  \u003cmermaid:source xmlns:mermaid=\"http://mermaid.js.org/\" encoding=\"base64\"\u003e\n    Zmxvd2NoYXJ0IExSCiAgICBBIC0tPiBCCg==\n  \u003c/mermaid:source\u003e\n\u003c/metadata\u003e\n```\n\nBase64 avoids all whitespace normalization issues — Mermaid is whitespace-sensitive and attribute-value normalization in XML would corrupt indentation. The `extract_mermaid_from_svg` tool decodes this and returns a ready-to-use ` ```mermaid ``` ` block.\n\n## SVG output paths\n\nDiagrams render to `{attachments_dir}/{document-title-slug}/{diagram-type}-{n}.svg`.\n\nFor a document titled \"System Architecture\" with `attachments_dir = \"attachments\"` and two flowchart blocks, you get:\n\n```\nattachments/system-architecture/flowchart-1.svg\nattachments/system-architecture/flowchart-2.svg\n```\n\nThe markdown is updated to:\n\n```markdown\n![flowchart diagram 1](attachments/system-architecture/flowchart-1.svg)\n```\n\nStandard GitHub-flavored markdown — renders in Obsidian, GitHub, and any standard markdown viewer.\n\n## Testing\n\nThree layers, all runnable from the repo without building the Docker image:\n\n```bash\nnpm test          # 52 Jest unit tests (ESM), enforced coverage thresholds\nnpm run eval      # tool-correctness evals against the compiled functions\nnpm run snapshot  # end-to-end fixture snapshots (requires a real Chromium)\n```\n\n**Unit tests** (`tests/unit/`) call the tool functions directly. Coverage is gated (90% lines/functions/statements, 85% branches); `src/server.ts` and `src/create-server.ts` are excluded as pure wiring and are covered separately through an in-memory MCP transport. Mermaid rendering is tested with an injected browser/renderer, so no Chromium is needed here. Use `npm run test:coverage` for the lcov/HTML report.\n\n**Evals** (`tests/evals/`) check tool correctness against the compiled functions (no Docker). Output is JSON with `summary.passed`, `summary.failed`, and a `results` array; exit code is `1` if any eval fails. The suite covers all four tools: lint detection, schema validation (pass and fail cases), Mermaid rendering with a mock browser, and SVG round-trip extraction. In Claude Code, say *\"run evals\"* or *\"evaluate the tools\"* and it runs `npm run eval` and reports the results.\n\n**Snapshots** (`tests/snapshot/`) prove that each input under `test-obsidian-vault/original/` reproduces its committed `test-obsidian-vault/snap-shot/` output through the real tool pipeline. Unlike the evals, `test-1` launches Puppeteer for an actual render, so this needs a real Chromium and is kept out of `npm test`. SVG geometry is not byte-compared (it varies by Mermaid, Chromium, and font version); the deterministic projection is, namely the modified markdown, the file layout, and the embedded Mermaid source. Output is JSON; exits non-zero on any failure.\n\n## JSON Schema format\n\nEach file in `.schemas/` is a self-contained [JSON Schema draft-07](https://json-schema.org/) object. `validate_front_matter` parses the document's YAML front matter and validates the resulting object against the schema you pass in. A trimmed view of `.schemas/article.json`:\n\n```json\n{\n  \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n  \"title\": \"Article\",\n  \"type\": \"object\",\n  \"required\": [\"type\",\"title\",\"author\",\"category\",\"tags\",\"description\",\"summary\",\"status\",\"version\",\"date_created\",\"date_updated\"],\n  \"properties\": {\n    \"type\":         { \"const\": \"article\" },\n    \"title\":        { \"type\": \"string\", \"minLength\": 1 },\n    \"category\":     { \"type\": \"string\", \"enum\": [\"Software Development\", \"Security\", \"DevOps\", \"...\"] },\n    \"tags\":         { \"type\": \"array\", \"items\": { \"type\": \"string\", \"pattern\": \"^[a-z0-9][a-z0-9_\\\\-/]*$\" }, \"minItems\": 4, \"maxItems\": 12 },\n    \"status\":       { \"type\": \"string\", \"enum\": [\"published\", \"draft\", \"in-progress\"] },\n    \"version\":      { \"type\": \"string\", \"pattern\": \"^\\\\d+\\\\.\\\\d+\\\\.\\\\d+$\" },\n    \"date_created\": { \"type\": \"string\", \"format\": \"date\" }\n  },\n  \"additionalProperties\": false\n}\n```\n\nSee `.schemas/article.json` for the complete schema, including the optional fields it also permits (`aliases`, `subtitle`, `source`, `sources`, `reviewers`, `signoff`, `mermaid_theme`, `mermaid_background`, `mermaid_svg_source`). Every schema sets `additionalProperties: false`, so any front matter key not declared in the schema is a validation error; add a key to the schema before using it in notes.\n\n**Important:** Date fields must be quoted strings in YAML (`date_created: \"2026-01-01\"`) because YAML auto-converts unquoted `YYYY-MM-DD` values to JavaScript `Date` objects, which fail the `type: string` check.\n\nThe per-type required fields are listed in [Front matter schemas](#front-matter-schemas) above.\n\n## Development\n\n```bash\nnpm install\nnpm run build       # compile TypeScript → dist/\n```\n\nTypeScript source is in `src/`. After changing code, rebuild the image so the next Claude Code session picks it up:\n\n```bash\nnpm run build \u0026\u0026 docker build -t obsidian-markdown-lint-mcp .   # or: docker compose build\n```\n\nThen start a new Claude Code session (stdio tools are loaded at session start).\n\nTo smoke-test the container by hand without Claude Code, drive it over stdio:\n\n```bash\ndocker compose run --rm obsidian-markdown-lint-mcp\n# then paste a JSON-RPC line, e.g. an initialize request, and read the reply\n```\n\n## Project structure\n\n```\nsrc/\n  server.ts             stdio entry point (StdioServerTransport bootstrap)\n  create-server.ts      builds the McpServer and registers the 4 tools\n  tools/\n    lint.ts             lint_markdown implementation\n    validate.ts         validate_front_matter implementation\n    mermaid.ts          render_mermaid_diagrams + extract_mermaid_from_svg\n  lib/\n    frontmatter.ts      gray-matter parse/update helpers\n    svg-metadata.ts     base64 embed/extract helpers\n.schemas/               JSON Schema files for all 7 note types\nDockerfile              stdio server image (Chromium for Mermaid)\ndocker-compose.yml      build/tag helper (not `up` — see comments)\n```\n\n## License\n\n[MIT](LICENSE) © 2026 Philip Senger\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\n**Lint, validate, and render your Obsidian vault markdown without touching your host system.**\n\n[Report a bug](../../issues) • [Request a feature](../../issues)\n\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsenger%2Fobsidian-markdown-lint-mcp-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpsenger%2Fobsidian-markdown-lint-mcp-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsenger%2Fobsidian-markdown-lint-mcp-server/lists"}