Skip to main content
Glama
obsidian-mysql-mcp

obsidian-mysql-mcp

by TomJiang123

obsidian-mysql-mcp

tests Python License: MIT

Obsidian remains the editable source of Markdown. MySQL stores a searchable index, document revisions, sync changes, and write audit records. Codex and DSH connect to the same stdio MCP server.

Bidirectional synchronization is available through the explicit sync CLI. Writes from the MCP server itself remain restricted to inbox/; ordinary notes under wiki/, raw/, and 我/ remain Obsidian-owned.

Requirements

  • Python 3.10+

  • A MySQL 8 server and an account allowed to create the configured database

  • An Obsidian vault containing Markdown files

The MySQL password is never written to config.local.toml or committed to Git. On Windows it is stored in Credential Manager; the OBSIDIAN_MYSQL_PASSWORD environment variable remains as an explicit override.

Related MCP server: Datacron

Install

git clone https://github.com/TomJiang123/obsidian-mysql-mcp.git
cd obsidian-mysql-mcp
python -m pip install -e ".[dev]"

Configure

Create config.local.toml from config.example.toml, or launch the GUI:

$env:PYTHONPATH = "src"
python -m obsidian_mysql_mcp.gui

Store the password once, then the GUI and every MCP client can read it without an exported variable:

$env:PYTHONPATH = "src"
python -m obsidian_mysql_mcp password set
python -m obsidian_mysql_mcp password show

password set prompts twice and writes to Windows Credential Manager under obsidian-mysql-mcp:mysql-password. password clear removes it, and a stored password can be inspected through Credential Manager itself. Password lookup is skipped when OBSIDIAN_MYSQL_PASSWORD is already set, and can be disabled per config with [mysql] credential_target = false.

The GUI can test the connection, save non-secret settings, scan the vault, and show status.

Index

$env:PYTHONPATH = "src"
python -m obsidian_mysql_mcp index --full
python -m obsidian_mysql_mcp status
python -m obsidian_mysql_mcp search "matrix"

MCP

Start the stdio server:

$env:PYTHONPATH = "src"
python -m obsidian_mysql_mcp.mcp_server

The GUI starts the optional local HTTP transport at http://127.0.0.1:8765/mcp. It binds to loopback only. Keep stdio for clients that launch the MCP process themselves.

Exposed tools:

  • obsidian_search(query, limit)

  • obsidian_read(path, max_chars)

  • obsidian_status()

  • obsidian_append(filename, content, title)

Client examples are in docs/codex-config.example.toml and docs/dsh-cordis.example.yml. Keep the real password out of client profiles and source control. On Windows, store it in Credential Manager with password set; the child process inherits the same Windows account and resolves the credential itself. Export OBSIDIAN_MYSQL_PASSWORD only for clients running under another account or on a non-Windows host.

The append tool accepts vault-relative names but always stores the result under inbox/. Path traversal is rejected.

Bidirectional sync

C-stage sync lives behind an explicit CLI command:

$env:PYTHONPATH = "src"
python -m obsidian_mysql_mcp sync
python -m obsidian_mysql_mcp sync --apply

The first command is a dry run. --apply permits the authorized sync engine to publish MySQL changes to Markdown, but the MCP server itself remains inbox/-only. Divergent edits, ambiguous renames, and deletes that require a manual decision create rows in sync_conflicts and change neither content source.

index establishes the common baseline for every scanned note, including files whose content was already indexed. Run an index pass once after upgrading an existing A-stage database before using sync.

Test

$env:PYTHONPATH = "src"
python -m pytest -q

The live MySQL 8 suite is opt-in and creates then drops one uniquely named database per test:

$env:PYTHONPATH = "src"
$env:OBSIDIAN_MYSQL_E2E = "1"
$env:OBSIDIAN_MYSQL_E2E_HOST = "127.0.0.1"
$env:OBSIDIAN_MYSQL_E2E_PORT = "3306"
$env:OBSIDIAN_MYSQL_E2E_USER = "root"
$env:OBSIDIAN_MYSQL_E2E_PASSWORD = "<your password>"
python -m pytest tests/test_mysql_e2e.py -q

Windows EXE

Install the build extra and run the local build script:

python -m pip install -e ".[build]"
.\build.ps1

The GUI executable is written to dist\ObsidianMySQLMCP\ObsidianMySQLMCP.exe. It is a management panel: it configures the vault and MySQL, scans the index, and starts a loopback MCP HTTP service. Codex/DSH can alternatively launch the Python module over stdio.

The generated executable is a local build artifact and is not committed. When the panel starts the MCP child, its output is written next to the executable as mcp-server.log.

The scanner and indexer tests use MemoryRepository; a live MySQL check needs a valid local account.

Data model

  • documents: current searchable Markdown and stable document IDs

  • sync_changes: create, update, rename, and delete events

  • write_audit: records writes made through MCP

  • app_meta: persisted scan status

  • sync_baselines: common content hash and path after a completed sync

  • sync_conflicts: unresolved sync decisions

  • sync_apply_journal: interrupted Markdown replacement recovery records

The schema already contains revision, content_hash, writer_owner, deleted_at, and sync_changes; C-stage sync adds the three tables above.

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      A
      maintenance
      A generic Markdown vault MCP server with FTS5 full-text search, semantic vector search, frontmatter-aware indexing, incremental reindexing, and non-markdown attachment support that exposes search, read, write, and edit tools.
      48
      775 PyPI
      42
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Local MCP server for querying and maintaining a Markdown vault. Provides full-text search, backlinks, note retrieval, and optional confined write tools, without sending the whole vault to the client context.
      22
      26 PyPI
      1
      Apache 2.0
    • A
      license
      A
      quality
      C
      maintenance
      Local MCP server that automates an open Obsidian vault through Obsidian's official CLI, offering tools for note creation/update, search, tasks, daily notes, and organization. It uses MCP over STDIO, requires no cloud services, and provides safety/audit features for autonomous writes.
      10
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables MCP clients to read, write, search, and manage notes, canvases, kanban boards, and other Obsidian vault content over a network, without requiring the Obsidian desktop app.
      33
      MIT