MCP ExplorerExplorer

Mcp Notion

@melumuccuon 17 days ago
1 MIT
FreeCommunity
AI Systems
MCP server for Notion API integration, enabling workspace interactions.

Overview

What is Mcp Notion

mcp-notion is a Model Context Protocol server that integrates with the Notion API, enabling interaction with Notion workspaces.

Use cases

Use cases include automating content management in Notion, integrating Notion with other applications, and enhancing productivity through streamlined workflows.

How to use

To use mcp-notion, create a Notion integration, add it to your workspace, and set up the project by installing dependencies and building the server. Configure your environment settings in Claude Desktop.

Key features

Key features include block operations (create, retrieve, update, delete), page operations (retrieve, update properties), database operations (create, query, retrieve, update), comment operations (create, retrieve), user information retrieval, and search functionality.

Where to use

mcp-notion can be used in various fields such as project management, note-taking, and collaborative workspaces where Notion is utilized.

Content

Notion MCP サーバー

Notion API と連携する Model Context Protocol サーバー。Notion ワークスペースとの対話を可能にします。

より詳細な解説は以下の記事をご参照ください:

この TypeScript ベースの MCP サーバーは、Notion API との統合を提供します。以下の機能を実装しています:

  • ブロックの操作(作成、取得、更新、削除)
  • ページの操作(取得、プロパティ更新)
  • データベースの操作(作成、クエリ、取得、更新)
  • コメントの操作(作成、取得)
  • ユーザー情報の取得
  • 検索機能

セットアップ

1. Notion インテグレーションの作成

  1. Notion Your Integrationsにアクセス
  2. 「New Integration」をクリック
  3. インテグレーションの名前を入力し、適切な権限を選択(例:「Read content」、「Update content」)
  4. 生成された「Internal Integration Token」を保存

2. インテグレーションをワークスペースに追加

  1. Notion で、インテグレーションにアクセスさせたいページまたはデータベースを開く
  2. 右上のナビゲーションボタンをクリック
  3. 「Connect to」ボタンをクリックし、作成したインテグレーションを選択

3. プロジェクトのセットアップ

初期セットアップ(依存関係のインストール & ビルド):

make init

開発

ビルドのみ実行:

make build

開発時の自動リビルド:

make watch

クリーンアップ:

make clean

インストール

Claude Desktop で使用するには、以下の設定を追加してください:

MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "notion": {
      "command": "node",
      "args": [
        "your-built-file-path"
      ],
      "env": {
        "NOTION_API_TOKEN": "your-integration-token"
      }
    }
  }
}

トラブルシューティング

権限エラーが発生した場合:

  1. インテグレーションが必要な権限を持っているか確認
  2. インテグレーションが該当のページやデータベースに招待されているか確認
  3. トークンと設定がclaude_desktop_config.jsonに正しく設定されているか確認

利用可能なツール

ブロック操作

  1. notion_append_block_children

    • 親ブロックに子ブロックを追加
    • 必須パラメータ:
      • block_id (string): 親ブロックの ID
      • children (array): 追加するブロックオブジェクトの配列
  2. notion_retrieve_block

    • 特定のブロックの情報を取得
    • 必須パラメータ:
      • block_id (string): 取得するブロックの ID
  3. notion_retrieve_block_children

    • 特定のブロックの子ブロックを取得
    • 必須パラメータ:
      • block_id (string): 親ブロックの ID
    • オプションパラメータ:
      • start_cursor (string): 次のページの結果用カーソル
      • page_size (number, デフォルト: 100, 最大: 100): 取得するブロック数
  4. notion_delete_block

    • 特定のブロックを削除
    • 必須パラメータ:
      • block_id (string): 削除するブロックの ID

ページ操作

  1. notion_retrieve_page

    • 特定のページの情報を取得
    • 必須パラメータ:
      • page_id (string): 取得するページの ID
  2. notion_update_page_properties

    • ページのプロパティを更新
    • 必須パラメータ:
      • page_id (string): 更新するページの ID
      • properties (object): 更新するプロパティ

データベース操作

  1. notion_create_database

    • 新しいデータベースを作成
    • 必須パラメータ:
      • parent (object): データベースの親オブジェクト
      • title (array): データベースのタイトル(リッチテキスト配列)
      • properties (object): データベースのプロパティスキーマ
  2. notion_query_database

    • データベースをクエリ
    • 必須パラメータ:
      • database_id (string): クエリするデータベースの ID
    • オプションパラメータ:
      • filter (object): フィルター条件
      • sorts (array): ソート条件
      • start_cursor (string): ページネーションカーソル
      • page_size (number, デフォルト: 100, 最大: 100): 取得する結果数
  3. notion_retrieve_database

    • データベースの情報を取得
    • 必須パラメータ:
      • database_id (string): 取得するデータベースの ID
  4. notion_update_database

    • データベースの情報を更新
    • 必須パラメータ:
      • database_id (string): 更新するデータベースの ID
    • オプションパラメータ:
      • title (array): 新しいタイトル
      • description (array): 新しい説明
      • properties (object): 更新するプロパティスキーマ
  5. notion_create_database_item

    • データベースに新しいアイテムを作成
    • 必須パラメータ:
      • database_id (string): アイテムを追加するデータベースの ID
      • properties (object): 新しいアイテムのプロパティ(データベーススキーマに一致する必要あり)

検索

  1. notion_search
    • ページまたはデータベースをタイトルで検索
    • オプションパラメータ:
      • query (string): 検索するテキスト
      • filter (object): ページまたはデータベースに結果を限定する条件
      • sort (object): 結果のソート条件
      • start_cursor (string): ページネーション開始カーソル
      • page_size (number, デフォルト: 100, 最大: 100): 取得する結果数

ユーザー操作

  1. notion_list_all_users

    • ワークスペース内の全ユーザーを一覧表示
    • 注意: この機能には Notion エンタープライズプランと Organization API キーが必要
    • オプションパラメータ:
      • start_cursor (string): ユーザー一覧のページネーションカーソル
      • page_size (number, 最大: 100): 取得するユーザー数
  2. notion_retrieve_user

    • 特定のユーザーの情報を取得
    • 注意: この機能には Notion エンタープライズプランと Organization API キーが必要
    • 必須パラメータ:
      • user_id (string): 取得するユーザーの ID
  3. notion_retrieve_bot_user

    • 現在のトークンに関連付けられたボットユーザーの情報を取得

コメント操作

  1. notion_create_comment

    • コメントを作成
    • インテグレーションに’insert comment’権限が必要
    • parentpage_idを含む)またはdiscussion_idのいずれかを指定(両方は不可)
    • 必須パラメータ:
      • rich_text (array): コメント内容のリッチテキストオブジェクト配列
    • オプションパラメータ:
      • parent (object): page_idを含むオブジェクト
      • discussion_id (string): 既存のディスカッションスレッド ID
  2. notion_retrieve_comments

    • ページまたはブロックの未解決コメントを取得
    • インテグレーションに’read comment’権限が必要
    • 必須パラメータ:
      • block_id (string): コメントを取得するブロックまたはページの ID
    • オプションパラメータ:
      • start_cursor (string): ページネーションカーソル
      • page_size (number, 最大: 100): 取得するコメント数

使用例

// データベースのクエリ
<use_mcp_tool>
<server_name>notion</server_name>
<tool_name>notion_query_database</tool_name>
<arguments>
{
  "database_id": "your_database_id",
  "filter": {
    "property": "Status",
    "status": {
      "equals": "Done"
    }
  }
}
</arguments>
</use_mcp_tool>

// ページのプロパティ更新
<use_mcp_tool>
<server_name>notion</server_name>
<tool_name>notion_update_page_properties</tool_name>
<arguments>
{
  "page_id": "your_page_id",
  "properties": {
    "Status": {
      "status": {
        "name": "In Progress"
      }
    }
  }
}
</arguments>
</use_mcp_tool>

デバッグ

MCP サーバーは stdio を介して通信するため、デバッグが難しい場合があります。MCP Inspectorの使用をお勧めします:

pnpm run inspector

Inspector は、ブラウザでデバッグツールにアクセスするための URL を提供します。

ライセンス

この MCP サーバーは MIT ライセンスの下で提供されています。これは、MIT ライセンスの条件に従って、ソフトウェアを自由に使用、修正、配布できることを意味します。詳細については、プロジェクトリポジトリの LICENSE ファイルをご覧ください。

Tools

No tools

Comments