Skip to main content
Glama

Not MCP 服务器

模型上下文协议 (MCP) 服务器,提供与 Notion 的无缝集成。该服务器支持语言模型通过标准化工具与您的 Notion 工作区进行交互,用于搜索、读取、创建和更新页面及数据库。

🌟 主要特点

页面操作

  • 🔍 搜索你的 Notion 工作区

  • 📝 创建具有丰富 Markdown 内容的新页面

  • 📖 以清晰的格式阅读页面内容

  • 🔄 更新现有页面

  • 💬 添加和检索评论

  • 🧱 块级操作(更新、删除)

增强 Markdown 支持

  • 多标题级别(H1-H3)

  • 具有语言支持的代码块

  • 具有复选框状态的交互式待办事项

  • 支持多行的块引用

  • 水平分隔线

  • 带标题的图片

  • 嵌套项目符号

数据库操作

  • 创建和管理数据库

  • 添加和更新数据库项目

  • 使用过滤器和排序进行查询

  • 支持各种属性类型:

    • 标题、富文本、编号

    • 选择、多选

    • 日期、复选框

    • 还有更多!

Related MCP server: Notion MCP Server

🚀 入门

先决条件

  • Node.js(v16 或更高版本)

  • Notion API 密钥

  • MCP 兼容客户端(例如 Claude Desktop)

安装

  1. 克隆存储库:

git clone https://github.com/v-3/notion-server.git
cd notion-server
  1. 安装依赖项:

npm install
  1. 设置您的环境:

# Create .env file
echo "NOTION_API_KEY=your_notion_api_key_here" > .env

# Or export directly
export NOTION_API_KEY=your_notion_api_key_here
  1. 构建服务器:

npm run build

🔧 配置

Claude 桌面设置

  1. 更新您的 Claude Desktop 配置( 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"
            }
        }
    }
}
  1. 重新启动 Claude Desktop 以应用更改

🛠️ 可用工具

页面操作

// Search pages
{
    query: string // Search query
}

// Read page
{
    pageId: string // ID of the page to read
}

// Create page
{
    title?: string,      // Page title
    content?: string,    // Page content in markdown
    parentPageId: string // Parent page ID
    properties?: object  // For database items
}

// Update page
{
    pageId: string,   // Page ID to update
    content: string,  // New content
    type?: string    // Content type
}

数据库操作

// Create database
{
    parentPageId: string,
    title: string,
    properties: object
}

// Query database
{
    databaseId: string,
    filter?: object,
    sort?: object
}

🔐 设置 Notion 访问

创建集成

  1. 访问Notion Integrations

  2. 点击“新集成”

  3. 配置权限:

    • 内容:读取、更新、插入

    • 评论:阅读、创作

    • 用户信息:已读

连接页面

  1. 打开你的 Notion 页面

  2. 点击“...”菜单→“连接”

  3. 添加您的集成

  4. 根据需要对其他页面重复此操作

📝 使用示例

创建页面

const result = await notion.create_page({
  parentPageId: "page_id",
  title: "My Page",
  content: "# Welcome\nThis is a test page."
});

查询数据库

const result = await notion.query_database({
  databaseId: "db_id",
  filter: {
    property: "Status",
    select: {
      equals: "In Progress"
    }
  }
});

🤝 贡献

欢迎投稿!请:

  1. 分叉存储库

  2. 创建功能分支

  3. 提交拉取请求

📜 许可证

该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅LICENSE文件。

🙏 致谢

sweir1/notion-server对该项目进行了显著改进,并做出了以下更新:

  • 增强 Markdown 支持,提供更多块类型

  • 全面的数据库操作

  • 改进的错误处理和调试

  • 更好地处理数据库项的属性

  • 更清晰的页面输出格式

要使用 sweir1 的版本,您可以克隆他们的存储库:

git clone https://github.com/sweir1/notion-server.git
-
security - not tested
A
license - permissive license
-
quality - not tested

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/v-3/notion-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server