一个提供与 Notion 无缝集成的模型上下文协议(MCP)服务器。此服务器使语言模型能够通过标准化工具与您的 Notion 工作区进行交互,这些工具用于搜索、阅读、创建和更新页面及数据库。
git clone https://github.com/v-3/notion-server.git
cd notion-server
npm install
# 创建 .env 文件
echo "NOTION_API_KEY=your_notion_api_key_here" > .env
# 或者直接导出
export NOTION_API_KEY=your_notion_api_key_here
npm run build
claude_desktop_config.json):{
"mcpServers": {
"notion": {
"command": "node",
"args": ["/absolute/path/to/notion-server/build/index.js"],
"env": {
"NOTION_API_KEY": "your_notion_api_key_here"
}
}
}
}
// 搜索页面
{
query: string // 搜索查询
}
// 读取页面
{
pageId: string // 要读取的页面ID
}
// 创建页面
{
title?: string, // 页面标题
content?: string, // Markdown 格式的页面内容
parentPageId: string // 父页面ID
properties?: object // 对于数据库项
}
// 更新页面
{
pageId: string, // 要更新的页面ID
content: string, // 新内容
type?: string // 内容类型
}
// 创建数据库
{
parentPageId: string,
title: string,
properties: object
}
// 查询数据库
{
databaseId: string,
filter?: object,
sort?: object
}
const result = await notion.create_page({
parentPageId: "page_id",
title: "我的页面",
content: "# 欢迎\n这是一个测试页面。"
});
const result = await notion.query_database({
databaseId: "db_id",
filter: {
property: "状态",
select: {
equals: "进行中"
}
}
});
欢迎贡献!请:
本项目采用 MIT 许可证 - 查看 LICENSE 文件获取详情。
本项目在 sweir1/notion-server 的基础上得到了显著改进,他们进行了以下更新:
要使用 sweir1 的版本,您可以克隆他们的仓库:
git clone https://github.com/sweir1/notion-server.git