Skip to main content
Glama
Smart Connections MCP Server

Smart Connections MCP Server

by bookbran

Smart Connections MCP Server

A Model Context Protocol (MCP) server that provides semantic search and knowledge graph capabilities for Obsidian vaults using Smart Connections embeddings.

Fork note: this is a fork maintained by A Portland Career for its second-brain pilot kit, based on the original smart-connections-mcp by Daniel Glickman (MIT). It adds true semantic search_notes (embeds the query with the vault's model instead of literal keyword matching); see "Query embedding" below. Original copyright and MIT license preserved in LICENSE.

Overview

This MCP server allows Claude (and other MCP clients) to:

  • Search semantically through your Obsidian notes using pre-computed embeddings

  • Find similar notes based on content similarity

  • Build connection graphs showing how notes are related

  • Query by embedding vectors for advanced use cases

  • Access note content with block-level granularity

Related MCP server: Smart Connections MCP Server

Features

Uses the embeddings generated by Obsidian's Smart Connections plugin to perform fast, accurate semantic searches across your entire vault.

πŸ•ΈοΈ Connection Graphs

Builds multi-level connection graphs showing how notes are related through semantic similarity, helping discover hidden relationships in your knowledge base.

πŸ“Š Vector Similarity

Direct access to embedding-based similarity calculations using cosine similarity on 384-dimensional vectors (TaylorAI/bge-micro-v2 model).

πŸ“ Content Access

Retrieve full note content or specific sections/blocks with intelligent extraction based on Smart Connections block mappings.

Installation

Prerequisites

  • Node.js 18 or higher

  • An Obsidian vault with Smart Connections plugin installed and embeddings generated

  • Claude Desktop (or another MCP client)

Setup

  1. Clone the repository:

    git clone https://github.com/bookbran/smart-connections-mcp.git
    cd smart-connections-mcp
  2. Install dependencies:

    npm install
  3. Build the TypeScript project:

    npm run build
  4. Configure Claude Desktop:

    Edit your Claude Desktop configuration file:

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

    • Windows: %APPDATA%\Claude\claude_desktop_config.json

    Add the following to the mcpServers section:

    {
      "mcpServers": {
        "smart-connections": {
          "command": "node",
          "args": [
            "/ABSOLUTE/PATH/TO/smart-connections-mcp/dist/index.js"
          ],
          "env": {
            "SMART_VAULT_PATH": "/ABSOLUTE/PATH/TO/YOUR/OBSIDIAN/VAULT"
          }
        }
      }
    }

    Important: Replace the paths with your actual paths:

    • Update the args path to point to your built index.js file

    • Update SMART_VAULT_PATH to your Obsidian vault path

  5. Restart Claude Desktop

    The MCP server will automatically start when Claude Desktop launches.

Available Tools

1. get_similar_notes

Find notes semantically similar to a given note.

Parameters:

  • note_path (string, required): Path to the note (e.g., "Note.md" or "Folder/Note.md")

  • threshold (number, optional): Similarity threshold 0-1, default 0.5

  • limit (number, optional): Maximum results, default 10

Example:

{
  "note_path": "MyNote.md",
  "threshold": 0.7,
  "limit": 5
}

Returns:

[
  {
    "path": "RelatedNote.md",
    "similarity": 0.85,
    "blocks": ["#Overview", "#Key Points", "#Details"]
  }
]

2. get_connection_graph

Build a multi-level connection graph showing how notes are semantically connected.

Parameters:

  • note_path (string, required): Starting note path

  • depth (number, optional): Graph depth (levels), default 2

  • threshold (number, optional): Similarity threshold 0-1, default 0.6

  • max_per_level (number, optional): Max connections per level, default 5

Example:

{
  "note_path": "MyNote.md",
  "depth": 2,
  "threshold": 0.7
}

Returns:

{
  "path": "MyNote.md",
  "depth": 0,
  "similarity": 1.0,
  "connections": [
    {
      "path": "RelatedNote.md",
      "depth": 1,
      "similarity": 0.82,
      "connections": [...]
    }
  ]
}

3. search_notes

Semantic search by text query. Embeds the query with the same model used for the vault's note embeddings (bge-micro-v2) and ranks notes by cosine similarity, so it matches by meaning rather than exact words. Falls back to a multi-term keyword search if the embedding model can't be loaded (e.g. fully offline before the model has ever been cached).

First-query note: the query-embedding model is downloaded from the Hugging Face hub on the first search_notes call of a server session (needs network once, ~30s), then cached under node_modules/@huggingface/transformers/.cache so every later call is offline and fast (~4ms). See "Query embedding" under Technical Details.

Parameters:

  • query (string, required): Search query text

  • limit (number, optional): Maximum results, default 10

  • threshold (number, optional): Similarity threshold 0-1, default 0.4 (typical relevant matches score ~0.4-0.75; lower to widen recall)

Example:

{
  "query": "project management",
  "limit": 5
}

4. get_embedding_neighbors

Find nearest neighbors for a given embedding vector (advanced use).

Parameters:

  • embedding_vector (number[], required): 384-dimensional vector

  • k (number, optional): Number of neighbors, default 10

  • threshold (number, optional): Similarity threshold 0-1, default 0.5

5. get_note_content

Retrieve full note content with optional block extraction.

Parameters:

  • note_path (string, required): Path to the note

  • include_blocks (string[], optional): Specific block headings to extract

Example:

{
  "note_path": "MyNote.md",
  "include_blocks": ["#Introduction", "#Main Points"]
}

Returns:

{
  "content": "# Full note content...",
  "blocks": {
    "#Introduction": "Content of this section...",
    "#Main Points": "Content of this section..."
  }
}

6. get_stats

Get statistics about the knowledge base.

Parameters: None

Returns:

{
  "totalNotes": 137,
  "totalBlocks": 1842,
  "embeddingDimension": 384,
  "modelKey": "TaylorAI/bge-micro-v2"
}

Usage Examples

Once configured, you can ask Claude to use these tools naturally:

  • "Find notes similar to my project planning document"

  • "Show me a connection graph starting from my main research note"

  • "Search my notes for information about [your topic]"

  • "What's in my note about [topic]?"

  • "Give me stats about my knowledge base"

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      Claude Desktop                         β”‚
β”‚                    (MCP Client)                             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                          β”‚
                          β”‚ MCP Protocol (stdio)
                          β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              Smart Connections MCP Server                   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  index.ts (MCP Server + Tool Handlers)             β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                   β”‚                                         β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  search-engine.ts (Semantic Search Logic)          β”‚   β”‚
β”‚  β”‚  - getSimilarNotes()                               β”‚   β”‚
β”‚  β”‚  - getConnectionGraph()                            β”‚   β”‚
β”‚  β”‚  - searchByQuery()                                 β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                   β”‚                                         β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  smart-connections-loader.ts (Data Access)         β”‚   β”‚
β”‚  β”‚  - Load .smart-env/smart_env.json                  β”‚   β”‚
β”‚  β”‚  - Load .smart-env/multi/*.ajson embeddings        β”‚   β”‚
β”‚  β”‚  - Read note content from vault                    β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                   β”‚                                         β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  embedding-utils.ts (Vector Math)                  β”‚   β”‚
β”‚  β”‚  - cosineSimilarity()                              β”‚   β”‚
β”‚  β”‚  - findNearestNeighbors()                          β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                          β”‚
                          β”‚ File System Access
                          β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚            Obsidian Vault + .smart-env/                     β”‚
β”‚  - smart_env.json (config)                                  β”‚
β”‚  - multi/*.ajson (embeddings for 137 notes)                 β”‚
β”‚  - *.md (markdown note files)                               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Technical Details

Embedding Model

  • Model: TaylorAI/bge-micro-v2

  • Dimensions: 384

  • Similarity Metric: Cosine similarity

Query embedding (search_notes)

get_similar_notes / get_connection_graph compare notes against each other using the vectors Smart Connections already stored, so they need no model at runtime. search_notes is different: it must turn an arbitrary text query into a vector to compare against those stored vectors. It does this with @huggingface/transformers (transformers.js), loading the same model the vault is configured for (read from smart_env.json, e.g. TaylorAI/bge-micro-v2) so the query and note vectors live in the same space.

  • The model repo is tried in order: the vault's configured model_key, then SC_EMBED_MODEL (env override), then TaylorAI/bge-micro-v2, then Xenova/bge-micro-v2.

  • ONNX weights download from the Hugging Face hub on first use and are cached under node_modules/@huggingface/transformers/.cache. First search_notes call: ~30s; subsequent calls: ~4ms, offline.

  • If no model can be loaded (offline with an empty cache), search_notes transparently falls back to a multi-term keyword search so it still returns useful results.

  • Override the model with the SC_EMBED_MODEL env var if your vault uses a different embedding model. It must be a bge-micro-v2-family model, or the query vectors won't match the stored note vectors.

Data Format

The server reads from Obsidian's Smart Connections .smart-env/ directory:

  • smart_env.json: Configuration and model settings

  • multi/*.ajson: Per-note embeddings and block mappings

Performance

  • Load time: ~2-5 seconds for 137 notes

  • Search: Near-instant (<50ms) using pre-computed embeddings

  • Memory: ~20-30MB for embeddings + note index

Development

Build

npm run build

Watch Mode

npm run watch

Run Locally

export SMART_VAULT_PATH="/path/to/your/vault"
npm run dev

Project Structure

smart-connections-mcp/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ index.ts                    # MCP server & tool handlers
β”‚   β”œβ”€β”€ search-engine.ts            # Semantic search logic
β”‚   β”œβ”€β”€ smart-connections-loader.ts # Data loading
β”‚   β”œβ”€β”€ embedding-utils.ts          # Vector math utilities
β”‚   └── types.ts                    # TypeScript type definitions
β”œβ”€β”€ dist/                           # Compiled JavaScript (generated)
β”œβ”€β”€ package.json
β”œβ”€β”€ tsconfig.json
└── README.md

Troubleshooting

"Smart Connections directory not found"

  • Ensure your vault has the Smart Connections plugin installed

  • Verify embeddings have been generated (check .smart-env/multi/ directory)

  • Check that SMART_VAULT_PATH points to the correct vault

"Configuration file not found"

  • Run Smart Connections in Obsidian at least once to generate configuration

  • Check for .smart-env/smart_env.json in your vault

"No embeddings found for note"

  • Some notes may not have embeddings if they're too short (< 200 chars)

  • Re-run Smart Connections embedding generation in Obsidian

Server not appearing in Claude Desktop

  • Verify the configuration file syntax (JSON must be valid)

  • Check the file paths are absolute paths, not relative

  • Restart Claude Desktop completely

  • Check Claude Desktop logs for error messages

License

MIT

Author

Acknowledgments

Available Tools

10 tools
check_search_healthA

Positive control for retrieval. Asks the index for notes that are known to be there, by their own titles, and reports whether they come back. Use this at session start, before trusting any empty search result, and any time a vault has been quiet or moved between machines. Returns alive (false means every empty result from this server is untrustworthy), verdict (a plain-language line written to be read aloud), mode, coverage, and the individual probes. A retrieval tool that can return nothing must be able to prove it can still see.

Inputs: canary_path.

check_vault_integrityA

Find wikilinks that point at notes which do not exist. Git proves two machines agree on what is COMMITTED; it is silent about a note written outside the vault folder or written on another machine and never committed, and both fail the same silent way, as a link that resolves to nothing. Results are ranked by how many DISTINCT notes reference each missing target, because one note pointing at an unwritten note is an ordinary forward reference while six pointing at the same target means the vault treats it as real and it is either a concept that never got a home note or a note this machine cannot see. Run at session start alongside check_search_health.

Inputs: min_references.

get_connection_graphA

Build a multi-level connection graph starting from a note, showing how notes are semantically connected.

Inputs: note_path (required), depth, threshold, max_per_level.

get_embedding_neighborsB

Find nearest neighbors for a given embedding vector. Useful for custom similarity searches.

Inputs: embedding_vector (required), k, threshold.

get_note_contentA

Retrieve the full content of a note, optionally with specific blocks/sections extracted.

Inputs: note_path (required), include_blocks.

get_similar_notesB

Find notes semantically similar to a given note using embeddings. Returns paths, similarity scores, and available blocks.

Inputs: note_path (required), limit, threshold.

get_statsA

Get statistics about the Smart Connections knowledge base (total notes, blocks, embedding model, etc.).

Inputs: no named parameters.

search_notesA

Semantic search over the vault. Returns an envelope, not a bare array: mode names the engine that answered ("semantic" is real, "keyword" means the embedding model failed to load and results will miss anything phrased differently), coverage says how many notes were actually searched out of the vault total, results holds the matches, and warning appears whenever the answer should not be read at face value. An empty results with mode "semantic" and full coverage means the vault really has nothing closer; an empty results with mode "keyword" or nonzero coverage.unsearchable means the tool was partly blind and you must not report it as an absence. Typical relevant matches score ~0.4-0.75; lower the threshold to widen recall.

Inputs: query (required), limit, threshold.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 10 tools

    Disambiguation4/5

    Most tools are clearly distinct by resource and action, but get_similar_notes, search_notes, and get_embedding_neighbors all touch semantic retrieval and could cause misselection. The descriptions do a good job separating note-based, query-based, and vector-based retrieval, so only one or two tools are genuinely confusable.

    Naming Consistency5/5

    Every tool follows a consistent snake_case verb_noun pattern: get_* for retrieval, search_notes for querying, resolve_link for resolution, and check_* for diagnostics. The naming is predictable and makes the toolset easy to navigate.

    Tool Count5/5

    Ten tools is well-scoped for a read-only vault intelligence server. Each tool earns its place by covering a distinct retrieval, linking, analysis, or health-check function without unnecessary duplication.

    Completeness4/5

    The toolset covers the core domain well: semantic search, similar notes, backlinks, connection graphs, note content, wikilink resolution, and retrieval health. Minor gaps exist around explicit vault browsing/list-all-notes or index rebuilding, but agents can complete normal workflows without dead ends.

    Maintenance

    ActivityStale
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables semantic search and knowledge graph exploration of Obsidian vaults using Smart Connections embeddings. Provides intelligent note discovery, similarity search, and connection mapping through natural language queries.
      89 npm
      59
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables Claude to perform semantic search across your Obsidian vault using Smart Connections vector database. Provides meaning-based search, related note discovery, and context retrieval for RAG queries instead of basic keyword matching.
      11
      -
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables semantic search and retrieval over an Obsidian vault using local or API-based embeddings, allowing AI assistants to find notes by meaning, get related content, and pull context during conversations.
      16
      MIT