TypeScript

Notion Integration

Sync Notion databases with AI agents. Query pages, update databases, and create content.

import { MCPServer } from "@modelcontextprotocol/server";
import { Client } from "@notionhq/client";

const server = new MCPServer("notion");
const notion = new Client({ auth: process.env.NOTION_TOKEN });

@Tool()
async queryDatabase(dbId: string){
  return notion.databases.query({ database_id: dbId });
}

@Tool()
async createPage(parentId: string, title: string){
  return notion.pages.create({
    parent: { page_id: parentId },
    properties: { title: [{ text: { content: title }}] }
  });
}
Get Template Browse All Templates