Skip to main content
Glama

MarkScribe

npm version License: MIT Node.js

A convention-aware markdown MCP server for AI assistants. Point it at a directory of markdown files and it gives the AI read, write, search, wikilink, and validation tools, enforcing your conventions through user-defined YAML schemas rather than hard-coded vault assumptions.

Works with Obsidian vaults, Foam workspaces, Logseq graphs, digital gardens, documentation repos, or any plain markdown directory. Nothing about the format is assumed. If your directory has its own rules — required frontmatter, hub notes, filename patterns, link constraints — you express them as schemas and MarkScribe enforces them.

The distinction matters: conventions are enforced, not assumed. A schema-less directory still gets the full read/write/search/link toolkit; a schema-driven directory additionally gets structural validation, convention-aware note creation, and lint feedback on every file.

What It Does

Read, write, search. 24 tools for AI assistants to operate on markdown: atomic read/write/move/delete, batch reads, frontmatter-aware patching, and full-text BM25 search across body and frontmatter.

Wikilink graph. Backlinks, broken link detection, orphan finding, and plain-text mention discovery. The graph rebuilds on every call, so there is no stale index or cache to invalidate.

Schema validation. User-defined YAML note and folder schemas. Note schemas validate frontmatter fields and content rules; folder schemas classify directories, assign note schemas by role, and enforce structural constraints. _conventions.md files scope schemas to subtrees so the same directory can host multiple conventions.

Path security. .obsidian/, .git/, node_modules/, .DS_Store, and Thumbs.db are always blocked. User config can extend the blocklist, never shrink it. Atomic writes everywhere, so a crashed process never leaves a torn file.

Lite mode. --lite trims the tool surface from 24 to 12, keeping schema validation, the wikilink graph, and directory meta. Note CRUD, frontmatter editing, and search drop out, since harnesses like Claude Code already ship native file tools for those.

Related MCP server: LifeOS MCP Server

Quick Start

Prerequisites

  • Node.js v18+

  • A directory of markdown files

Install

npm install -g markscribe

Or run directly via npx, no install step. The MCP config below shows both.

Configure Your MCP Client

Add the following to your MCP client config. Works with Claude Code, Claude Desktop, Cursor, or any MCP-compatible client.

Zero-install via npx (recommended):

{
  "mcpServers": {
    "markscribe": {
      "command": "npx",
      "args": ["-y", "markscribe", "--root", "/path/to/your/notes"]
    }
  }
}

Or install globally:

{
  "mcpServers": {
    "markscribe": {
      "command": "markscribe",
      "args": ["--root", "/path/to/your/notes"]
    }
  }
}

--root is the directory MarkScribe will serve. To load your own schemas, add "--schemas-dir", "/path/to/schemas". Otherwise ~/.markscribe/schemas/ is used.

Verify

Ask your AI assistant to call get_stats. If it returns a note count and recent files, you're connected.

CLI flags

Flag

Default

Description

--root <path>

Current working directory

Root directory to serve

--schemas-dir <path>

~/.markscribe/schemas/

Directory to load schema YAML files from

--log-level <level>

info

Log level (debug, info, warn, error, fatal)

--lite

off

Trim the tool surface to lint, validation, and link-graph only

Lite mode

If your AI client already has native file read/write/search (like the Claude Code harness does), the note CRUD, frontmatter, and discovery tools are duplicative. --lite exposes only what MarkScribe uniquely provides — convention enforcement and wikilink analysis — and leaves file manipulation to the harness.

markscribe --lite --root /path/to/your/notes

Kept (12): lint_note, validate_folder, validate_area, validate_all, list_schemas, get_backlinks, find_broken_links, find_orphans, find_unlinked_mentions, find_bidirectional_mentions, get_stats, switch_directory.

Cut (12): read_note, write_note, patch_note, delete_note, move_note, read_multiple_notes, create_note, get_frontmatter, update_frontmatter, manage_tags, search_notes, list_directory.

The flag is a startup decision — restart the server to toggle it. Default behavior is unchanged for clients that don't pass --lite.

Per-directory config

Place a .markscribe/config.yaml in your root directory:

paths:
  blocked:
    - private/
    - drafts/
  allowed_extensions:
    - .md
    - .markdown
    - .txt
search:
  max_results: 50
  excerpt_chars: 40

The built-in security blocklist (.obsidian/, .git/, node_modules/, .DS_Store, Thumbs.db) is always enforced on top of user config.

Schemas (the short version)

Schemas are YAML files defining conventions for notes and folders. Note schemas validate frontmatter and content; folder schemas classify directories and assign note schemas by role.

Note schema. Validates frontmatter fields and content rules:

name: blog-post
description: Blog post with required metadata
type: note
frontmatter:
  fields:
    title: { type: string, required: true }
    tags: { type: list, required: true }
content:
  rules:
    - name: has-outgoing-link
      check: hasPattern
      pattern: "\\[\\[.+?\\]\\]"

Folder schema. Enforces structural rules on directories:

name: project-folder
description: Project folder with hub note
type: folder
noteSchemas:
  default: blog-post
  hub: project-hub
classification:
  supplemental: [assets, templates]
  skip: [archive]
hub:
  detection:
    - pattern: "_{{folderName}}"
  required: true

Notes opt into a schema via note_schema: <name> in frontmatter, or inherit one from a _conventions.md file higher in the tree. The convention cascade resolves schema on a per-note basis.

Full schema reference, all field types, all check types, and the cascade resolution order: docs/schemas.md.

Tools

Tool

Description

list_directory

List files and subdirectories

get_stats

Note count, total size, recent files

switch_directory

Change the active root directory

read_note

Read a note with parsed frontmatter

write_note

Create or update a note

patch_note

String replacement within a note

delete_note

Delete a note (with confirmation)

move_note

Move/rename with optional link updates

read_multiple_notes

Batch read up to 10 notes

create_note

Convention-aware note creation

get_frontmatter

Read YAML frontmatter only

update_frontmatter

Merge or replace frontmatter fields

manage_tags

Add, remove, or list tags

search_notes

Full-text BM25 search

lint_note

Validate a note against its schema

validate_folder

Classify and validate a folder

validate_area

Recursive subtree validation

validate_all

Full directory tree validation

list_schemas

List all loaded schemas

get_backlinks

Find notes linking to a note

find_broken_links

Find wikilinks to non-existent notes

find_orphans

Find notes with no incoming links

find_unlinked_mentions

Find plain-text mentions that should be wikilinks

find_bidirectional_mentions

Two-direction mention sweep for batch new-note workflows

Compatible viewers

MarkScribe works with any tool that reads markdown files:

  • Obsidian: PKM app with graph view and community plugins

  • Foam: VS Code extension for linked notes

  • Logseq: outliner with bidirectional links

  • Any text editor or static site generator

Architecture

MarkScribe is stateless at runtime. There are no persistent indexes, caches, or file watchers; search and the link graph rebuild on every call, so results are always correct and never stale. Services (file, frontmatter, search, schema engine, link graph) are constructed via buildServices() and injected through a mutable ServiceContainer, which lets switch_directory rebuild the full service stack at runtime without re-registering tools. All file writes go through atomicWrite (write-to-temp-then-rename) so a crashed process never leaves a torn file. Convention knowledge is schema-driven: the server hard-codes no directory assumptions, only the inviolable path-security defaults.

Development

# Build
npm run build

# Test (vitest)
npm test
npm run test:watch
npm run test:coverage

# Lint and format
npm run lint
npm run lint:fix
npm run format
npm run format:check

# Type check
npx tsc --noEmit

Stdio transport: stdout is reserved for JSON-RPC, all human/debug output goes to stderr. Run tests after changes to services (src/services/) or the schema engine.

Acknowledgements

Built with Claude Code.

License

MIT

Available Tools

24 tools
create_noteA

Creates a new note with convention-aware defaults. Pass { path, content } and optionally frontmatter (overrides), noteSchema (explicit schema name). Resolves the applicable schema, applies its frontmatter template, merges overrides, writes the note, and lints it. Returns { root, path, frontmatter, lintResult }. Fails if the note already exists.

delete_noteA

Deletes a note. Pass { path, confirmPath } where both must match exactly. Returns { root, path, success }. This is irreversible.

find_bidirectional_mentionsA

Two-direction mention sweep for batch new-note operations. Pass { newNotes, terms?, scope? }. Returns { root, scope, existing_to_new[], new_to_existing[] }. existing_to_new lists plain-text mentions of new-note titles found inside existing notes. new_to_existing lists plain-text mentions of free terms found inside the new notes. If a free term equals a new-note stem, the title classification wins.

find_orphansA

Finds notes with no incoming wikilinks. Optional { scope } path prefix. Returns { root, scope, orphans[] } (array of relative paths).

find_unlinked_mentionsA

Finds plain-text occurrences of a note's title that are not wikilinked. Pass { path }. Returns { root, path, mentions[] } with sourcePath, mentionText, line, column.

get_frontmatterA

Returns { root, path, frontmatter } for a note. Reads only the YAML frontmatter block, not the body.

get_statsA

Returns { root, noteCount, totalBytes, recentFiles[] }. No arguments needed. Use this to verify connectivity and get an overview of the active directory.

lint_noteB

Validates a note against its resolved schema. Pass { path }. Returns { root, path, pass, schema, checks[] }. Each check has name, pass, detail. Returns schema: null if no schema matches.

list_directoryA

Returns { root, path, entries[] }. Each entry has name, type (file|directory), and relative path. Omit path or pass "" to list the root. Blocked paths (.obsidian, .git, node_modules) are excluded automatically.

list_schemasA

Lists all loaded schemas. No arguments. Returns { root, schemas[] } where each schema has name, description, type (note|folder), and type-specific details.

manage_tagsA

Add, remove, or list tags on a note. Pass { path, operation, tags? } where operation is add|remove|list. Handles both YAML tags arrays and inline #tags. Returns { root, path, tags, added?, removed? }.

move_noteA

Moves or renames a note. Pass { oldPath, newPath }. Optional: overwrite (boolean), updateLinks (boolean, propagates [[wikilink]] renames). Returns { root, oldPath, newPath } and optionally linksUpdated.

patch_noteA

Replaces a string within a note. Pass { path, oldString, newString } and optionally replaceAll (boolean). Returns { root, path, replacements }. Read the note first to confirm the exact string.

read_multiple_notesA

Batch-reads up to 10 notes. Pass { paths: string[] }. Returns { root, results[] } where each result has path, note (or null), and optional error.

read_noteA

Returns { root, path, frontmatter, content }. Pass a relative path. Use list_directory first if unsure of the path.

search_notesA

Full-text BM25 search. Pass { query } and optionally scope (path prefix), searchContent (default true), searchFrontmatter (default false), limit. Returns { root, results[] } sorted by relevance, each with path, score, excerpt.

switch_directoryA

Accepts { path } (absolute path). Rebuilds all services for the new root directory. Returns { root, switched: true } on success. Call get_stats after switching to verify.

update_frontmatterA

Sets and/or removes frontmatter keys. Pass { path, fields?, remove?, merge? }. fields sets key-value pairs (null is a real value, pass-through to schema validation). remove is a list of keys to delete. merge (default true) merges with existing frontmatter; false replaces all fields. Returns { root, path, frontmatter }.

validate_allA

Validates the entire directory tree using the convention cascade. Optional verbose (default false) — when false, the response includes only folders/notes with actionable results. Returns { root, summaryText, pass, conventionSources, folders, summary }. Discovers _conventions.md notes and resolves folder schemas.

validate_areaA

Recursively validates a subtree. Pass { path }. Returns { root, summaryText, path, pass, folders, summary }. Use for checking a section of the directory.

validate_folderA

Classifies and validates a folder. Pass { path }. Returns { root, summary, path, pass, folderType, schema, notes, structural }. Folder types: packet, superfolder, supplemental, unclassified.

write_noteA

Writes content to a note. Pass { path, content } and optionally frontmatter (object) and mode (overwrite|append|prepend, default overwrite). Returns { root, path, message }. Creates parent directories automatically.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.1/5.0

    Scored across 24 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose with detailed descriptions that eliminate ambiguity. For example, create_note and write_note both write notes but are differentiated by creation-only vs. overwrite/append/prepend modes. Similarly, the validation tools operate at different scopes (note, folder, area, all).

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern in snake_case (e.g., create_note, find_orphans, validate_all). No mixing of conventions like camelCase, and the pattern is predictable across all tools.

    Tool Count5/5

    With 24 tools, the set covers a comprehensive range of operations for a note-taking system without feeling excessive. Each tool has a clear role, from basic CRUD to advanced link analysis and validation, justifying the count.

    Completeness5/5

    The tool surface covers the full lifecycle of note management: creation, reading, updating, deletion, moving, patching, frontmatter manipulation, linting, validation, search, tag management, link analysis, and directory navigation. No obvious gaps for the stated purpose.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      F
      maintenance
      An MCP server for managing LifeOS Obsidian vaults, enabling AI assistants to create, read, and search notes with YAML compliance and organizational standards.
      1
      GPL 3.0
    • A
      license
      A
      quality
      C
      maintenance
      A filesystem-based MCP server for Obsidian vaults that enables LLMs to browse, search, read, write, and edit Markdown notes directly on disk without requiring Obsidian to be running.
      6
      837 npm
      1
      CeCILL-B Free Software Agreement