Notion DB MCP Helper

Notion DB MCP Helper

Provides tools for querying and updating Notion database rows by exact property filters, avoiding semantic search for reliable row selection.

Category
访问服务器

README

Notion DB MCP Helper

Personal stdio MCP server and CLI helper for precise Notion data source queries/updates. It resolves rows by exact property filters and never relies on semantic search for mutation targets.

This project is optimized for local development and personal use:

  • Codex or Claude Code starts the MCP server locally through stdio.
  • The server reads local Notion auth from env vars or official ntn file-based auth.
  • Database/source aliases live on the client machine.
  • npx can run the server from GitHub without cloning the repo.

Why

Common Notion workflows like “update row 38” can become unreliable if an agent first uses semantic search to find a page. This helper does the safer flow:

  1. Query a specific Notion data_source_id with an exact property filter.
  2. Require exactly one matching page.
  3. Block not-found or duplicate matches.
  4. Update the exact page_id returned by the query.

Quick Start: Codex

codex mcp add notion_db -- \
  npx --yes --package github:trisetiohidayat/notion-mcp \
  notion-mcp serve

Authenticate Notion locally before starting Codex:

ntn login

or:

export NOTION_API_TOKEN='<notion-token>'
codex

Quick Start: Claude Code

claude mcp add notion_db -- \
  npx --yes --package github:trisetiohidayat/notion-mcp \
  notion-mcp serve

Authenticate Notion locally before starting Claude Code:

ntn login

or:

export NOTION_API_TOKEN='<notion-token>'
claude

Quick Links

Tools

Source Metadata Tools

Use these when you configure named Notion sources in local config.json.

  • notion_api_request
  • notion_api_paginate
  • notion_file_upload_send
  • notion_source_list
  • notion_source_schema
  • notion_source_update_schema
  • notion_source_add_property
  • notion_source_rename_property
  • notion_source_remove_property
  • notion_source_get_by_key
  • notion_source_query
  • notion_source_table
  • notion_source_count
  • notion_source_group_count
  • notion_source_query_by_property
  • notion_source_count_by_property
  • notion_source_update_by_key
  • notion_source_update_status_by_key

Generic Data Source Tools

Use these for raw data_source_id or simple aliases.

  • notion_db_schema
  • notion_db_update_schema
  • notion_db_add_property
  • notion_db_rename_property
  • notion_db_remove_property
  • notion_db_query
  • notion_db_table
  • notion_db_count
  • notion_db_group_count
  • notion_db_query_by_property
  • notion_db_count_by_property
  • notion_db_get_by_property
  • notion_db_update_page
  • notion_db_update_by_property

For agent-friendly reads, prefer the table/count tools over raw notion_db_query. They convert Notion property objects into simple JSON values, so questions like “list all No values where Status is QC” or “count rows by Status” do not require local scripts. Schema tools include select/status/multi-select option names so agents can choose valid update and filter values without guessing.

Example:

{
  "source": "task_list",
  "property_name": "Status",
  "value": "QC",
  "properties": ["No", "Task", "Status"],
  "max_results": 50
}

Schema updates are supported through MCP. To add a Notion ID/Unique ID property without a prefix:

{
  "source": "task_list",
  "name": "No",
  "type": "unique_id"
}

Use notion_source_update_schema or notion_db_update_schema when you need to pass a raw Notion schema patch for advanced property types.

Local Config

Create a client-side config file when you want aliases such as task_list:

mkdir -p ~/.config/notion-db-mcp
cat > ~/.config/notion-db-mcp/config.json <<'JSON'
{
  "data_sources": {
    "task_list": {
      "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "name": "Task List",
      "key_property": "No",
      "title_property": "Task",
      "status_property": "Status"
    }
  }
}
JSON

Because the MCP server runs locally in stdio mode, this file stays on the client machine.

For shorter config commands, install the CLI globally from GitHub:

npm install -g github:trisetiohidayat/notion-mcp

Then use:

notion-mcp config list
notion-mcp config discover
notion-mcp config add task_list '<notion-database-url-or-data-source-id>' --key No --status Status

Local UI

For visual mapping management, start the local config UI:

notion-mcp ui

By default it listens only on http://127.0.0.1:3099. Override the bind address only when you know why:

NOTION_MCP_UI_HOST=127.0.0.1 NOTION_MCP_UI_PORT=3099 notion-mcp ui

The UI manages the same client-side config file as notion-mcp config .... It can list mappings, discover accessible Notion data sources, add mappings, refresh source metadata, and remove mappings with confirmation. It does not display Notion tokens.

You can also manage this file with the built-in CLI:

npx --yes --package github:trisetiohidayat/notion-mcp notion-mcp config list
npx --yes --package github:trisetiohidayat/notion-mcp notion-mcp config discover
npx --yes --package github:trisetiohidayat/notion-mcp notion-mcp config add task_list '<notion-database-url-or-data-source-id>' --key No --status Status
npx --yes --package github:trisetiohidayat/notion-mcp notion-mcp config refresh task_list
npx --yes --package github:trisetiohidayat/notion-mcp notion-mcp config remove task_list --yes

Auth Model

The helper reads Notion bearer tokens in this order:

  1. NOTION_TOKEN
  2. NOTION_API_TOKEN
  3. NOTION_API_KEY
  4. NOTION_ACCESS_TOKEN
  5. Official ntn file-based auth, when available

If ntn login succeeds but the MCP tool returns Missing Notion token, set NOTION_API_TOKEN as a fallback.

CLI Examples

npm install
cp config.example.json config.json
export NOTION_API_TOKEN='<your-notion-token>'

./bin/db.js schema example_tasks
./bin/db.js get example_tasks No 38
./bin/db.js update example_tasks No 38 Status Done
./bin/db.js update-props example_tasks No 38 Summary="Done: verified"
./bin/notion-mcp.js config list

Safety Behavior

  • No matching row: returns a clear not-found error.
  • Multiple matching rows: returns a duplicate-match error and blocks updates.
  • Unknown property: returns a schema error.
  • Invalid select/status option: validates against schema when options are available.

Development

npm install
npm run check

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选