Skip to content

Notion MCP

Notion มี official MCP server ที่ช่วยให้ AI สามารถอ่าน/เขียน Notion pages และ databases ได้

เตรียมตัวก่อนเริ่ม

Section titled “เตรียมตัวก่อนเริ่ม”
  1. มี Notion account
  2. สร้าง Notion Integration (API Key)
  1. ไปที่ https://www.notion.so/profile/integrations
  2. กด “New integration”
  3. ตั้งชื่อและเลือก workspace
  4. Copy Integration Token (เริ่มด้วย ntn_)

แชร์ Content ให้ Integration

Section titled “แชร์ Content ให้ Integration”

ไปที่หน้า page ที่ต้องการ → กด ... → “Add connections” → เลือก integration ที่สร้างไว้

ตั้งค่าใน opencode.jsonc

Section titled “ตั้งค่าใน opencode.jsonc”
{
"mcp": {
"notion": {
"type": "local",
"command": ["npx", "-y", "@notionhq/notion-mcp-server"],
"env": {
"NOTION_TOKEN": "ntn_xxxx"
},
"enabled": true
}
}
}

⚠️ แนะนำใช้ {env:NOTION_TOKEN} แทนการใส่ token ตรงๆ เพื่อความปลอดภัย

{
"mcp": {
"notion": {
"type": "local",
"command": ["npx", "-y", "@notionhq/notion-mcp-server"],
"env": {
"NOTION_TOKEN": "{env:NOTION_TOKEN}"
},
"enabled": true
}
}
}

Notion MCP มี tools ให้ใช้มากมาย เช่น:

  • search - ค้นหา pages/databases
  • get-page - ดึงข้อมูล page
  • get-block-children - ดึง content ใน page
  • patch-block-children - เพิ่ม/แก้ไข content
  • create-page - สร้าง page ใหม่
  • update-page - แก้ไข page properties

ตัวอย่างการใช้งาน

Section titled “ตัวอย่างการใช้งาน”

หลังจากตั้งค่าเสร็จ ลองถาม AI ว่า:

Show me the content of my "Projects" page using notion

หรือ

Create a new page titled "Meeting Notes" under the "Work" page using notion

ทดสอบความเข้าใจเกี่ยวกับ Notion MCP

ข้อ 1 / 40%

Integration Token ของ Notion ขึ้นต้นด้วยอะไร?