Notion MCP Server

Notion MCP Server

Enables interaction with Notion workspaces through the Notion API. Provides tools to search, read, create, and update Notion pages and databases with real-time synchronization.

Category
Visit Server

README

Notion MCP Server

這是一個 Model Context Protocol (MCP) 伺服器,用於連接和操作 Notion API。它提供了一套完整的工具來讀取、寫入和管理 Notion 頁面與資料庫。

功能特色

  • 🔍 搜尋頁面 - 在 Notion 工作區中搜尋頁面
  • 📄 頁面操作 - 取得、建立和更新 Notion 頁面
  • 🗃️ 資料庫查詢 - 查詢和操作 Notion 資料庫
  • 📋 內容管理 - 讀取和修改頁面內容區塊
  • 🔄 即時同步 - 透過 MCP 協議即時與 Notion 同步

安裝和設定

1. 安裝依賴

npm install

2. 設定 Notion 整合

  1. 前往 Notion 整合設定頁面
  2. 建立新的整合
  3. 複製整合 token
  4. 建立 .env 檔案並加入您的 token:
cp .env.example .env
# 編輯 .env 檔案,加入您的 Notion token

3. 建立專案

npm run build

使用方法

開發模式

npm run dev

生產模式

npm start

監控模式(自動重新載入)

npm run watch

可用的工具

頁面操作

  • get-page - 根據 ID 取得頁面詳細資訊
  • search-pages - 搜尋頁面
  • create-page - 建立新頁面
  • update-page - 更新頁面屬性

資料庫操作

  • query-database - 查詢資料庫內容

資源

  • notion://recent-pages - 最近存取的頁面
  • notion://databases - 可存取的資料庫清單

在 VS Code 中使用

  1. 確保已安裝 MCP 相關的 VS Code 擴充功能
  2. 使用 .vscode/mcp.json 配置檔案來設定伺服器連接
  3. 在 VS Code 中啟動偵錯模式以測試 MCP 伺服器

API 範例

搜尋頁面

{
  "name": "search-pages",
  "arguments": {
    "query": "meeting notes",
    "filter": {
      "property": "Status",
      "value": "Active"
    }
  }
}

建立頁面

{
  "name": "create-page",
  "arguments": {
    "parent": {
      "database_id": "your-database-id"
    },
    "properties": {
      "Name": {
        "title": [
          {
            "text": {
              "content": "新頁面標題"
            }
          }
        ]
      }
    }
  }
}

錯誤排除

常見問題

  1. Authentication Error: 確認 NOTION_TOKEN 環境變數已正確設定
  2. Permission Error: 確認 Notion 整合有適當的權限存取所需的頁面和資料庫
  3. Module Resolution Error: 確認所有依賴已正確安裝

偵錯

在開發模式下,伺服器會在 stderr 輸出詳細的偵錯資訊。

專案結構

.
├── src/
│   ├── index.ts           # MCP 伺服器主程式
│   └── notion-service.ts  # Notion API 服務類別
├── .vscode/
│   └── mcp.json          # VS Code MCP 配置
├── .github/
│   └── copilot-instructions.md  # GitHub Copilot 指令
├── package.json
├── tsconfig.json
├── .env.example
└── README.md

授權

MIT License

相關連結

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured