Skip to main content

Notion MCP Light - Notion APIを使用してMarkdownファイルとNotionページを同期するMCPサーバー

Project description

NotionMCP Light

NotionMCP Lightは、Notion APIを使用してMarkdownファイルとNotionページを同期するModel Context Protocol (MCP)サーバーです。

概要

このプロジェクトは、Notionの公式Model Context Protocol (MCP)サーバーが抱える非効率性(Markdownをブロック単位で読み書きし、LLMトークンを消費する点)を解決するために開発されました。トークンを使用せず、API経由で直接MarkdownファイルとNotionのページ/データベースを同期できる非公式のMCPサーバーを提供します。

機能

  • Markdown → Notion

    • H1をページタイトルとして認識
    • Markdownの内容をNotionページまたはデータベースのページとして作成
    • データベースIDを指定可能
    • Notion APIを直接使用(トークン未使用)
  • Notion → Markdown

    • 指定されたページまたはデータベースのページをMarkdown形式に変換
    • タイトルをH1として出力
    • ブロック構造をMarkdownに変換
    • ファイルに保存
  • MCPサーバー対応

    • Model Context Protocol(MCP)に準拠
    • CursorやClineなどのAIツールから呼び出し可能なエンドポイントを提供
    • JSON-RPC over stdioベースで動作

インストール

依存関係のインストール

# uvがインストールされていない場合は先にインストール
# pip install uv

# 依存関係のインストール
uv sync

Notion API Tokenの設定

  1. Notion Developersでアカウントを作成し、APIトークンを取得します。
  2. 環境変数に設定するか、.envファイルを作成してトークンを設定します。
# .envファイルの例
NOTION_TOKEN=your_notion_api_token

使い方

MCPサーバーの起動

uvを使用する場合(推奨)

uv run python -m src.main

または、トークンを直接指定する場合:

uv run python -m src.main --token your_notion_api_token

通常のPythonを使用する場合

python -m src.main

または、トークンを直接指定する場合:

python -m src.main --token your_notion_api_token

Cline/Cursorでの設定

Cline/Cursor/Claude CodeなどのAIコーディングツールでNotionMCP Lightを使用するには、各ツールのMCPサーバ設定を行うJSONファイルに以下のような設定を追加します:

{
  "mcpServers": {
    "notion-mcp-light": {
      "command": "uv",
      "args": [
        "run",
        "--directory",
        "/path/to/notion-mcp-light",
        "-m",
        "src.main"
      ],
      "env": {
        "NOTION_TOKEN": "your_notion_api_token"
      }
    }
  }
}

/path/to/notion-mcp-lightは、NotionMCP Lightのインストールディレクトリ、your_notion_api_tokenは、NotionのAPIトークンに置き換えてください。

MCPツールの使用方法

NotionMCP Lightは以下のMCPツールを提供します:

uploadMarkdown

Markdownファイルをアップロードし、Notionページとして作成します。

{
  "jsonrpc": "2.0",
  "method": "uploadMarkdown",
  "params": {
    "filepath": "path/to/markdown.md",
    "database_id": "optional_database_id",
    "page_id": "optional_parent_page_id"
  },
  "id": 1
}

downloadMarkdown

NotionページをダウンロードしてMarkdownファイルとして保存します。

{
  "jsonrpc": "2.0",
  "method": "downloadMarkdown",
  "params": {
    "page_id": "notion_page_id",
    "output_path": "path/to/output.md"
  },
  "id": 2
}

ライセンス

このプロジェクトはMITライセンスの下で公開されています。詳細はLICENSEファイルを参照してください。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iflow_mcp_notion_mcp_light-0.1.0.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

iflow_mcp_notion_mcp_light-0.1.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file iflow_mcp_notion_mcp_light-0.1.0.tar.gz.

File metadata

File hashes

Hashes for iflow_mcp_notion_mcp_light-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8fe824dbc89d802b9f253e8b5c36917158a6e070f444bbd0fe44008ca9dcaa9e
MD5 4102a99347432e0cecd415bf67ac5ade
BLAKE2b-256 49618871a9e6a9b291d74951087c345e1a82b8f5dc99edf5dcfffcbcda525b1b

See more details on using hashes here.

File details

Details for the file iflow_mcp_notion_mcp_light-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for iflow_mcp_notion_mcp_light-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ec004502ef4c5c02e2045c30c5f7046f5cbd1421f2d09ea79b4b313f7034e54c
MD5 3d430a4bfafb6d8ee4e846e86885fdc5
BLAKE2b-256 bfbce4943d8bb20887b42157962db4c69bf4e2fb3c33e550306eb4e28b0195eb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page