Notion MCP 服务器添加福利群:解决AI开发者的「MCP实战痛点」一个用于 Notion 集成的模型上下文协议服务器,允许 Claude 和其他大型语言模型与您的 Notion 工作区进行交互。
克隆此仓库
安装依赖
npm install
配置您的 Notion API 密钥
.env 文件并将 your_notion_api_key_here 替换为您的实际 API 密钥,或者构建服务器
npm run build
运行服务器
npm start
安装 Claude for Desktop(如果尚未安装)
打开您的 Claude for Desktop 应用程序配置:
~/Library/Application Support/Claude/claude_desktop_config.json将 Notion 服务器添加到您的配置中:
{
"mcpServers": {
"notion": {
"command": "node",
"args": [
"/Users/shaheerahmad/Documents/notion-mcp-server/dist/index.js",
"--notion-api-key=YOUR_ACTUAL_API_KEY_HERE"
]
}
}
}

替换:
/Users/shaheerahmad/Documents/notion-mcp-server 为您的项目目录的完整路径YOUR_ACTUAL_API_KEY_HERE 为您的实际 Notion API 密钥重启 Claude for Desktop
一旦连接到 Claude for Desktop,您可以通过向 Claude 提问来使用服务器,例如:
Claude 将根据您的请求自动使用适当的工具。
Search for "meeting notes" in my Notion workspace
Get the content of my Notion page with ID 1aaada269d1b8003adceda69cf7bcd97
Create a new page in Notion with title "Weekly Report" and content "This week we accomplished the following tasks..."
Update my Notion page with ID 1aaada269d1b8003adceda69cf7bcd97 with content "Adding this new information to the page."
您还可以更新标题:
Update my Notion page with ID 1aaada269d1b8003adceda69cf7bcd97 with title "New Title" and content "New content to add."
Create a new database in my Notion page with ID 1aaada269d1b8003adceda69cf7bcd97 with title "Task Tracker" and properties { "Task Name": { "title": {} }, "Status": { "select": { "options": [ { "name": "Not Started", "color": "red" }, { "name": "In Progress", "color": "yellow" }, { "name": "Completed", "color": "green" } ] } }, "Priority": { "select": { "options": [ { "name": "Low", "color": "blue" }, { "name": "Medium", "color": "yellow" }, { "name": "High", "color": "red" } ] } }, "Due Date": { "date": {} } }
Query my Notion database with ID 1aaada269d1b8003adceda69cf7bcd97 with filter { "property": "Status", "select": { "equals": "Completed" } }
您还可以添加排序:
Query my Notion database with ID 1aaada269d1b8003adceda69cf7bcd97 with sort { "property": "Due Date", "direction": "ascending" }
更新现有数据库条目的属性(数据库中的页面)。
{
"tool_name": "update-database-entry",
"tool_params": {
"pageId": "page_id_of_database_entry",
"properties": {
"Status": {
"select": {
"name": "Completed"
}
},
"Priority": {
"select": {
"name": "High"
}
},
"Due Date": {
"date": {
"start": "2023-12-31"
}
}
}
}
}

properties 参数应与您的数据库中特定属性类型所期望的 Notion API 结构相匹配。不同的属性类型(文本、选择、日期等)需要不同的格式。
向现有数据库添加具有自定义属性的新行。
{
"tool_name": "create-database-row",
"tool_params": {
"databaseId": "your_database_id_here",
"properties": {
"Name": {
"title": [
{
"text": {
"content": "New Task"
}
}
]
},
"Status": {
"select": {
"name": "Not Started"
}
},
"Priority": {
"select": {
"name": "Medium"
}
},
"Due Date": {
"date": {
"start": "2023-12-15"
}
},
"Notes": {
"rich_text": [
{
"text": {
"content": "This is a new task created via the API"
}
}
]
}
}
}
}

properties 参数必须包括数据库所需的所有必需属性,并遵循每个属性类型的 Notion API 结构。
如果工具未显示,请检查 Claude for Desktop 的日志:
tail -n 20 -f ~/Library/Logs/Claude/mcp*.log

确保您的 Notion API 密钥设置正确,并且您的集成已被授予访问您想要交互的页面的权限。
如果在日志中看到 "Unexpected token" 错误,很可能是 console.log 语句干扰了 MCP 协议。此版本的服务器已更新以避免这些问题。