Skip to main content
Glama
HY2MHY

obsidian-knowledge-mcp

by HY2MHY

Obsidian Knowledge MCP

A private-by-default MCP server that lets AI clients search, read, and traverse a local Obsidian vault without uploading it to an external index.

Status: public-safe prototype · Role: independent design and implementation · Origin: sanitized reconstruction of a knowledge-retrieval component built during a 2026 summer automation project.

中文说明 · Bilingual docs index · Architecture · Evaluation · Failure analysis

What it demonstrates

  • Five read-only MCP tools for discovery, evidence reading, graph navigation, and vault health.

  • Transparent ranking: exact phrase + title/heading boosts + English tokens + Chinese 2-grams.

  • Source-grounded results with vault-relative paths, headings, excerpts, scores, and pagination.

  • Local privacy boundary: no cloud index, no API key, hidden folders excluded, path traversal rejected.

  • MCP Python SDK 2.x, structured output, annotations, in-memory integration tests, and a synthetic demo vault.

Related MCP server: Obsidian MCP Server

Tools

Tool

Workflow role

obsidian_search_notes

Find relevant note sections with filters and pagination

obsidian_read_note

Read one note or an exact heading as evidence

obsidian_list_notes

Browse by folder prefix or tag

obsidian_find_backlinks

Follow Obsidian [[wikilinks]] back to related notes

obsidian_vault_stats

Inspect vault size, link count, and top tags

All tools are declared read-only and closed-world. The server never edits the vault.

Quick start

Requirements: Python 3.10+ and uv.

git clone <your-repository-url>
cd obsidian-knowledge-mcp
uv sync --extra dev
export OBSIDIAN_VAULT_PATH="/absolute/path/to/your/Obsidian Vault"
uv run obsidian-knowledge-mcp

The process uses stdio and waits for an MCP client. For an interactive inspection UI:

uv run mcp dev src/obsidian_knowledge_mcp/server.py

Run the included sample vault (English demo · 中文演示):

export OBSIDIAN_VAULT_PATH="$PWD/examples/sample_vault"
uv run mcp dev src/obsidian_knowledge_mcp/server.py

Client configuration

Use an absolute path to the repository and vault:

{
  "mcpServers": {
    "obsidian-knowledge": {
      "command": "uv",
      "args": [
        "--directory",
        "/absolute/path/to/obsidian-knowledge-mcp",
        "run",
        "obsidian-knowledge-mcp"
      ],
      "env": {
        "OBSIDIAN_VAULT_PATH": "/absolute/path/to/your/Obsidian Vault"
      }
    }
  }
}

Test and lint

uv run pytest
uv run ruff check .

The tests cover ranking, Chinese retrieval, filters, pagination, section reads, backlink resolution, hidden-folder exclusion, traversal prevention, tool discovery, and structured MCP responses.

Privacy and security

  • Keep private vaults local; do not commit them to this repository.

  • Only Markdown under OBSIDIAN_VAULT_PATH is scanned.

  • .obsidian, .git, .trash, node_modules, and attachments are excluded by default.

  • Returned paths are vault-relative, not absolute.

  • The project contains only synthetic sample notes. It does not contain employer data, chat exports, credentials, or production identifiers.

Current limitations

  • Ranking is lexical, not embedding-based; distant paraphrases may need query reformulation.

  • Wiki-link resolution does not implement every Obsidian alias or duplicate-title edge case.

  • The index is rebuilt per tool call in v0.1; a watched incremental cache is a future optimization.

  • The server trusts the local OS user who launches it. It is not a multi-tenant remote service.

Project map

src/obsidian_knowledge_mcp/  search engine and MCP adapter
tests/                       unit and in-memory MCP integration tests
examples/sample_vault/       synthetic, reproducible demo data
eval/                        stable evaluation questions
docs/                        architecture, case, PRD, evaluation, failures

License

MIT. See LICENSE.

Available Tools

5 tools
obsidian_list_notesList Obsidian notesA
Read-only

Browse note titles and paths with optional folder and tag filters.

Use when you know the folder or tag but not the exact note name. Results are sorted by path and paginated; continue with next_offset when has_more is true.

ParametersJSON Schema
NameRequiredDescriptionDefault
tagNoOptional tag filter.
limitNoMaximum notes to return.
offsetNoPagination offset.
prefixNoOptional vault-relative folder prefix.
response_formatNomarkdown

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description discloses sorting ('sorted by path') and pagination ('continue with next_offset when has_more is true'), which is not present in the annotations. With readOnlyHint=true already carrying the safety profile, the added behavioral details exceed the minimum required.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is three compact sentences with no filler: purpose first, usage condition second, behavioral mechanics third. Every sentence earns its place and the key selection signal is front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With readOnly annotations, an output schema, and 80% schema coverage, the description adds exactly the missing context: when to use the tool and how pagination works. Nothing an agent needs to choose and invoke this tool correctly is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 80%, so the schema already documents tag, limit, offset, and prefix. The description adds conceptual mapping by mentioning 'folder and tag filters' and the pagination flow, but it does not add syntax or format details, so the schema-heavy baseline of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with 'Browse note titles and paths', a specific verb and resource, and specifies optional 'folder and tag filters'. This clearly differentiates it from siblings like obsidian_read_note (content retrieval) and obsidian_search_notes (search by content) by targeting browsing over exact lookup.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

'Use when you know the folder or tag but not the exact note name' provides an explicit triggering condition. It stops short of naming alternative tools or explicit when-not-to-use cases, but the stated condition gives enough context for an agent to select this over exact-lookup or search siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

obsidian_read_noteRead an Obsidian noteA
Read-only

Read one note or one heading after discovering its path.

Paths are resolved inside the configured vault, and traversal outside it is rejected. Use an exact heading to keep long notes concise. Returns content, tags, truncation state, and source path.

ParametersJSON Schema
NameRequiredDescriptionDefault
headingNoOptional exact heading to read.
max_charsNoMaximum returned characters.
relative_pathYesVault-relative Markdown path.

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already mark the operation read-only and closed-world; the description adds a concrete security behavior (path traversal outside the vault is rejected) and enumerates the return fields (content, tags, truncation state, source path). This goes beyond the structured annotations and helps the agent predict side effects and output.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Four short sentences, each with a distinct job: what it reads, where paths resolve, how to keep results concise, and what is returned. There is no filler or repetition.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a read tool with no output schema, the description covers the essential invocation details: required path, optional heading and max_chars, return contents, and vault confinement. It doesn't describe error cases or the exact shape of truncation state, but those are not necessary for correct invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema already documents all three parameters with 100% coverage, so the baseline is 3. The description adds minor usage nuance around exact headings and truncation, but no new parameter semantics beyond what the schema describes.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('Read') and resource ('one note or one heading') and frames the prerequisite ('after discovering its path'), which clearly separates it from sibling discovery tools. It also names the main return payload components, leaving no ambiguity about the tool's function.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It explicitly instructs that the tool is for reading a note after its path has been discovered, implying search/list are the preceding steps. The tip to use an exact heading for long notes provides condition-specific guidance. It does not explicitly name alternatives or when not to use, but the context is clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

obsidian_search_notesSearch Obsidian notesA
Read-only

Search Markdown notes using deterministic phrase, token, and Chinese 2-gram ranking.

Use this first for topical discovery or paraphrased questions. Results include vault-relative paths, headings, excerpts, tags, scores, and pagination metadata. The tool is local and read-only. If results are broad, add prefix or tag; if has_more is true, request next_offset.

ParametersJSON Schema
NameRequiredDescriptionDefault
tagNoOptional tag, with or without #.
limitNoMaximum chunks to return.
queryYesTopic, phrase, or question to search for.
offsetNoPagination offset.
prefixNoOptional vault-relative folder prefix.
response_formatNomarkdown

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.7/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond the readOnlyHint annotation, the description adds substantial behavioral detail: the tool is 'local and read-only,' uses a deterministic ranking algorithm, and returns paths, headings, excerpts, tags, scores, and pagination metadata. It also explains paging behavior via 'has_more' and 'next_offset', which annotations do not cover.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is compact and front-loaded: it opens with the core capability, then gives when-to-use guidance, then result contents, then refinement/pagination advice. Every sentence contributes actionable information with no filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity, the 83% schema coverage, and the existence of an output schema, the description covers the essential operational context: selection, scoping, return fields, pagination, and safety. The agent has enough to invoke it correctly without guessing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 83%, so the baseline is 3, but the description adds operational meaning beyond the schema: it tells the agent to use 'prefix' or 'tag' to narrow broad results and explains the pagination contract between 'has_more' and 'next_offset'. This is useful coupling information the schema alone does not provide.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource: 'Search Markdown notes' using deterministic phrase, token, and Chinese 2-gram ranking. It differentiates from siblings by explicitly framing itself as the tool to 'Use this first for topical discovery or paraphrased questions.'

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It clearly tells the agent when to use the tool ('Use this first for topical discovery or paraphrased questions') and how to refine broad results ('add prefix or tag'). It does not explicitly name sibling alternatives or state when to avoid this tool, but the guidance is strong enough for an agent to select it correctly.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

obsidian_vault_statsSummarize Obsidian vaultA
Read-only

Return a compact health snapshot of the configured vault.

The response includes note count, wikilink count, distinct tag count, and top tags. Use it to understand vault size before browsing; do not use it for note content retrieval.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The annotations already declare readOnlyHint=true and openWorldHint=false, so the read-only safety profile is covered. The description adds useful behavioral context by defining the response as a 'compact health snapshot' and enumerating what it returns, plus scoping it to 'the configured vault.' No contradictions or hidden side effects are indicated.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two tight sentences: the first states the operation and output fields, the second gives usage guidance and an exclusions. Every sentence earns its place with no redundant wording or restating of the title.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a zero-parameter, read-only statistics tool with no output schema, the description is complete. It explains what the tool returns, when to use it, and what not to use it for, making the tool fully callable without inspecting sibling tools or schemas.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

There are zero parameters and schema description coverage is 100%, so the schema carries no burden. The baseline for zero-param tools is 4, and the description appropriately does not invent parameter-related detail. It could have explained the meaning of 'top tags' limits, but that is not required given the simple scope.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb and resource: 'Return a compact health snapshot of the configured vault.' It lists concrete output fields (note count, wikilink count, distinct tag count, top tags) and explicitly distinguishes itself from content-retrieval tools, which is enough to differentiate it from siblings like obsidian_read_note or obsidian_search_notes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives explicit usage context: 'Use it to understand vault size before browsing' and a clear exclusion: 'do not use it for note content retrieval.' However, it does not name the sibling alternatives that should be used for content retrieval, so the guidance stops short of the most explicit 5-level standard.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

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

  1. 5 tool updatesv0.1.0
    • First observedobsidian_find_backlinks
    • First observedobsidian_list_notes
    • First observedobsidian_read_note
    • First observedobsidian_search_notes
    • First observedobsidian_vault_stats

TDQS

A4.4/5.0

Scored across 5 tools

Disambiguation5/5

Each tool serves a clearly distinct purpose: reading a specific note, searching content, browsing by folder/tag, finding backlinks, and viewing vault stats. There is no meaningful overlap between tools, and the descriptions reinforce when to use each one.

Naming Consistency4/5

Tool names follow a consistent snake_case pattern with the common `obsidian_` prefix, using clear action-noun combinations like `read_note`, `search_notes`, and `list_notes`. `vault_stats` is the only name that deviates from the verb-object pattern, but the convention remains predictable overall.

Tool Count5/5

Five tools is a well-scoped set for an Obsidian knowledge retrieval server. Each tool adds a distinct capability without redundancy, and the count is neither too thin nor bloated for the domain.

Completeness5/5

For a read-only knowledge retrieval surface, the tool set covers discovery, browsing, targeted reading, relationship exploration via backlinks, and vault-level stats. Search and list together handle navigation, while backlinks cover knowledge graph traversal; no obvious retrieval workflow is missing.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    Not graded
    maintenance
    Enables AI assistants to read, write, search, and navigate Obsidian vault notes with support for CRUD operations, full-text search, graph navigation, daily notes, and frontmatter management.
    2,547 npm
    -
  • A
    license
    A
    quality
    D
    maintenance
    Enables AI assistants to search, read, and traverse Markdown note vaults (Obsidian-compatible) with full-text search, backlinks, knowledge graphs, and a persistent memory system for cross-session context.
    16
    8 npm
    2
    MIT
  • -
    license
    Not graded
    quality
    Not graded
    maintenance
    Provides AI agents with comprehensive access to Obsidian vaults, enabling reading, writing, searching, tagging, linking, canvas manipulation, and semantic search through 41 tools.
    -