magic-notion-mcp
v1.0.1
Published
Local-first Notion sync + retrieval MCP server powered by magic-retrieval.
Readme
magic-notion-mcp
Local-first Notion sync + search MCP server powered by magic-retrieval from npm.
What it does
- syncs pages and data sources visible to one or more Notion integrations into a local embedded index
- stores retrieval state in local SQLite + LanceDB via
magic-retrieval - persists local sync state so it can do incremental polling without webhooks
- lets you search indexed Notion documents through CLI or MCP
- lets you read the locally indexed representation of a page or data source by id
- supports direct live reads from the Notion API through MCP
- defaults to strict
read-onlyMCP mode; write tools are only exposed inread-write - runs periodic background sync and periodic full reconciliation to detect edits, additions, and removals automatically
Install
npm install magic-notion-mcpQuick setup
- Create config:
npx -y magic-notion-mcp init-config- Fill in
~/.config/magic-notion-mcp/.env:
NOTION_API_KEYfor a single token, orNOTION_API_KEYS/NOTION_CREDENTIALS_JSONfor multiple workspaces- optional
OPENAI_API_KEY
- Check config:
npx -y magic-notion-mcp doctor- Inspect resolved workspaces:
npx -y magic-notion-mcp workspaces- Run a sync:
npx -y magic-notion-mcp sync- Search the local index:
npx -y magic-notion-mcp search --query "project roadmap"- Inspect overall sync health:
npx -y magic-notion-mcp sync-statusConfiguration
Main settings:
DB_PATH— SQLite path used bymagic-retrievalLANCEDB_PATH— local LanceDB directoryNOTION_API_KEY— backwards-compatible single tokenNOTION_API_KEYS— comma/newline-separated list of tokens for syncing multiple workspacesNOTION_CREDENTIALS_JSON— JSON array of strings or{ id, label, token }objects for multi-token setupNOTION_MCP_MODE—read-only(default) orread-writeNOTION_MCP_BACKGROUND_SYNC—trueby default; runs sync asynchronously when the MCP server startsNOTION_SYNC_STATE_PATH— local durable state file used for incremental sync and statusNOTION_SYNC_POLL_INTERVAL_MS— polling interval for background incremental syncNOTION_FULL_RESYNC_INTERVAL_MS— reconciliation interval for full scans that detect removals and heal driftNOTION_SYNC_CONCURRENCY— bounded parallelism for page content hydration during syncOPENAI_API_KEY— optional; without it search still works lexicallyNOTION_SYNC_PAGE_LIMIT— optional cap for sync runsread-onlymeans write tools are not registered at all. They do not appear in MCP tool discovery.read-writeenables a controlled set of page creation and update tools.
The sync model is:
- background polling for incremental change detection
- persistent local sync state to remember what was already indexed
- periodic full reconciliation to catch deletions/lost access and repair drift
- no webhooks required
read-onlymeans write tools are not registered at all. They do not appear in MCP tool discovery.read-writeenables a controlled set of page creation and update tools.
CLI commands
npx -y magic-notion-mcp doctornpx -y magic-notion-mcp workspacesnpx -y magic-notion-mcp sync-statusnpx -y magic-notion-mcp syncnpx -y magic-notion-mcp sync --mode incrementalnpx -y magic-notion-mcp sync --mode fullnpx -y magic-notion-mcp search --query "..."npx -y magic-notion-mcp search --query "..." --object-type pagenpx -y magic-notion-mcp page --id <document-id>
Important behavior
syncrebuilds the local search corpus from all pages and data sources visible to the configured integrations- on MCP startup, sync begins in the background by default so tools become available immediately while the index refresh is still running
- normal background runs are incremental and use
lastSuccessfulSyncAtcursors to pick up changed objects quickly - periodic full reconciliation runs rescan the workspace, detect removals, and rebuild the full active corpus when needed
sync-status/notion_sync_statusreport whether sync is running, percentage progress, whether the index is believed current, and whether it has been recently fully verified- duplicate visibility across multiple tokens is deduplicated by Notion object id
searchandpageoperate on the local index- after an initial sync, local search/page lookup continue to work even if you only want to query the stored index
- if
OPENAI_API_KEYis missing, the package still works with lexical retrieval only - multiple tokens broaden coverage, but they still only see content explicitly shared to each integration in Notion
MCP
{
"command": "npx",
"args": ["-y", "magic-notion-mcp-mcp"]
}Read-only MCP tools
notion_searchnotion_documentnotion_workspacesnotion_syncnotion_sync_statusnotion_live_pagenotion_data_source
Additional read-write MCP tools
Enabled only when NOTION_MCP_MODE=read-write:
notion_create_pagenotion_update_page_propertiesnotion_update_page_markdown
