Notion MCP
A secure, open-source Model Context Protocol server for connecting AI agents and apps to Notion. It enables search, read, create, and append operations on Notion pages with audit logging and risk-based security.
README
Notion MCP
A secure, open-source Model Context Protocol server for connecting AI agents and apps to Notion.
We built this because the existing hosted/default Notion MCP flow was down or unreliable when we needed it. Instead of waiting on a black-box integration, this project gives teams a simple Notion bridge they can own, run locally, deploy privately, customize, and audit.
Notion MCP is designed to work with any app or team setup:
- No agent architecture yet: use it as a clean local Notion MCP server for search, read, create, and append workflows.
- Intermediate agent setup: connect it to Codex, Claude Desktop, Cursor, or your own assistant as a safe documentation bridge.
- Advanced multi-agent architecture: use it as the Notion knowledge layer behind a lead agent, task agents, product agents, release agents, or app-specific orchestration.
The goal is easy, useful, accommodating infrastructure: Notion stays your source of truth, and agents only get the tools you intentionally expose.
What It Does
V1 includes:
- Search Notion pages.
- Retrieve Notion page metadata, blocks, and readable plain text.
- Create new Notion pages under a configured root page.
- Append content to existing Notion pages.
- List configured apps/projects.
- Retrieve lightweight app/project context.
- Log decisions to Notion.
- Generate simple Codex-ready prompts from project context.
- Audit-log every tool call.
- Enforce risk levels for every tool.
V1 intentionally does not include destructive tools, production-control tools, billing actions, auth changes, email sending, deployments, or unrestricted app control.
Architecture
AI Client or Agent
|
| calls approved MCP tools
v
Notion MCP
|
| uses a scoped Notion integration token
v
Notion Workspace or Page Tree
For more advanced teams, you can add app connectors behind the same permission model:
Lead Agent
|
v
Notion MCP / App Gateway
|
|-------------------------------
| | | |
Notion App API CI Tool Support Tool
The important rule: agents should call approved MCP tools, not receive unrestricted direct access to every system.
Quick Start
npm install
npm run build
cp .env.example .env
Create a Notion integration at:
https://www.notion.com/my-integrations
Then:
- Copy the integration secret into
NOTION_TOKEN. - Open the Notion page you want this server to access.
- Use Notion's page menu to connect/share the page with your integration.
- Copy the page ID into
NOTION_ROOT_PAGE_ID.
.env:
NOTION_TOKEN=
NOTION_ROOT_PAGE_ID=
SUPABASE_URL=
SUPABASE_SERVICE_ROLE_KEY=
MCP_GATEWAY_API_KEY=
OPENAI_API_KEY=
NODE_ENV=development
AUDIT_LOG_FILE=.audit/tool-calls.jsonl
Only NOTION_TOKEN and NOTION_ROOT_PAGE_ID are required for the core Notion tools. Supabase is optional.
Run Locally
Development:
npm run dev
Built server:
npm run build
npm start
Stdio wrapper for MCP clients:
./scripts/run-mcp.sh
The wrapper loads .env from the repo so you do not need to copy secrets into global client config files.
Connect To Codex
./scripts/register-codex-mcp.sh notion_mcp
codex mcp list
Restart Codex or open a fresh session after registration.
Equivalent config:
[mcp_servers.notion_mcp]
command = "/absolute/path/to/notion-mcp/scripts/run-mcp.sh"
args = []
cwd = "/absolute/path/to/notion-mcp"
startup_timeout_sec = 120
Connect To Other MCP Clients
Generic MCP client config:
{
"mcpServers": {
"notion-mcp": {
"command": "/absolute/path/to/notion-mcp/scripts/run-mcp.sh",
"args": []
}
}
}
This works best for desktop/local agent clients. Hosted deployments can be added later with HTTP transport, auth, and tenancy controls.
Tools
notion_search
Search the connected Notion workspace/page tree.
{ "query": "launch checklist" }
Returns:
{
"results": [
{
"title": "Launch Checklist",
"pageId": "notion-page-id",
"type": "page",
"url": "https://notion.so/...",
"lastEditedTime": "timestamp",
"summary": "Notion page titled \"Launch Checklist\"."
}
]
}
notion_get_page
Retrieve a Notion page and block content.
{ "pageId": "notion-page-id" }
Returns pageId, title, url, raw blocks, and extracted plainText.
notion_create_page
Create a new page under NOTION_ROOT_PAGE_ID or a provided parent page.
{
"title": "New Project Decision",
"content": "Content to add to the page",
"parentPageId": "optional-page-id"
}
Create-only. It does not overwrite existing pages.
notion_append_to_page
Append content to an existing page.
{
"pageId": "notion-page-id",
"content": "New decision or note to append"
}
Append-only. It does not delete or replace page content.
project_list_apps
Returns project/app names configured in src/tools/projectTools.ts.
project_get_context
{ "projectName": "Example App" }
Use this to give agents a lightweight local context map before they search deeper in Notion.
mission_log_decision
{
"projectName": "Example App",
"decisionTitle": "Use MCP as the documentation bridge",
"decisionDetails": "Agents can write safe append-only documentation through MCP.",
"category": "architecture"
}
codex_generate_prompt
{
"projectName": "Example App",
"goal": "Implement the next safe documentation workflow",
"constraints": ["Use existing app architecture", "Prioritize safe implementation"]
}
Security Model
Every tool has a risk level.
Executable in V1:
read: search, retrieve, list context.safe_write: create or append documentation without deleting or replacing content.
Prepared but blocked in V1:
operational: non-destructive live app operations.restricted: destructive, sensitive, financial, production, auth, access, or security-changing actions.
Human approval should be required before any future tool can:
- Delete content.
- Change user access.
- Change billing or license state.
- Lock users out.
- Send external emails.
- Modify production settings.
- Trigger production deployments.
- Change security policies.
- Change secrets, API keys, or auth settings.
Recommended security practices:
- Use a dedicated Notion integration token for each deployment.
- Share only the specific Notion pages/databases the server needs.
- Keep
.envout of git. - Rotate tokens if they are exposed.
- Prefer local/file audit logs for prototypes and Supabase/Postgres audit logs for teams.
- Add new tools behind explicit schemas, risk levels, and tests.
Audit Logging
Every tool call is logged with:
idtimestamptoolNameriskLevelinputSummarysuccesserrorMessagerequestingAgentprojectNamenotionPageIddurationMs
If Supabase is configured, logs are inserted into tool_calls. Otherwise logs are written to .audit/tool-calls.jsonl.
Optional Supabase table:
create table if not exists tool_calls (
id uuid primary key,
timestamp timestamptz not null,
tool_name text not null,
risk_level text not null,
input_summary text not null,
success boolean not null,
error_message text,
requesting_agent text,
project_name text,
notion_page_id text,
duration_ms integer not null
);
Works With Any App Maturity Level
No app architecture:
- Use Notion MCP as your first bridge between AI and project docs.
- Keep decisions, prompts, checklists, notes, and roadmaps in Notion.
Intermediate app architecture:
- Configure your projects in
src/tools/projectTools.ts. - Use
mission_log_decisionandcodex_generate_promptto keep implementation work tied to Notion context.
Advanced agent architecture:
- Add connector folders under
src/connectors/. - Keep app-specific APIs behind approved tools.
- Require human approval for operational and restricted actions.
- Use audit logs to review what each agent did.
Customize
Edit:
src/tools/projectTools.ts
to define your own apps/projects.
Add future connectors under:
src/connectors/
When adding a new tool:
- Define a Zod input schema.
- Assign a risk level.
- Wrap execution with
runLoggedTool. - Keep restricted actions blocked unless you add an explicit human approval workflow.
- Add focused tests.
Test
npm test
npm run typecheck
npm run build
Manual tests:
- Run
notion_searchwith a known query. - Run
notion_get_pagewith a valid page ID. - Run
notion_create_pagewithoutparentPageIdand confirm it appears underNOTION_ROOT_PAGE_ID. - Run
notion_append_to_pageand confirm existing page content is preserved. - Remove Supabase env vars and confirm
.audit/tool-calls.jsonlreceives entries. - Remove
NOTION_TOKENand confirm Notion tools fail with a clear missing environment error. - Use an invalid Notion page ID and confirm the tool fails and logs the failure.
- Confirm operational/restricted risk levels throw in tests.
Deployment Notes
V1 is a local stdio MCP server. That is the simplest and safest first shape for personal agents, desktop clients, and local developer workflows.
For hosted use, add:
- HTTP or Streamable HTTP transport.
- API key or OAuth auth.
- Per-tenant Notion tokens.
- Rate limiting.
- Centralized audit logging.
- Deployment-specific secret management.
Do not deploy a public shared instance with one global Notion token. Each user/team should bring their own Notion integration and credentials.
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。