Notion MCP Server

by HariFatherKR
Integrations
  • Provides a REST API interface for interacting with Notion's API, allowing for searching, database operations (creation, querying, updating), page management, block manipulation, user information retrieval, and comment functionality.

  • Integrates Swagger UI to provide interactive API documentation, available at the /api-docs endpoint with OpenAPI schema accessible at /openapi.json.

Servidor API de Notion

Vídeo de referencia

Un servidor personalizado para facilitar el uso de la API de Notion. Se implementa utilizando Express.js y expone varias características de la API de Notion como una API REST.

Cómo instalar

  1. Instalar los paquetes necesarios:
npm install express cors @notionhq/client swagger-jsdoc swagger-ui-express
  1. Ejecutando el servidor:
node server.js
  1. El servidor se ejecuta en http://localhost:3000 .

Cómo configurar

  1. Establezca su token de API de Notion en la variable NOTION_TOKEN en su archivo server.js:
const NOTION_TOKEN = '여기에_노션_API_토큰_입력';
  1. Si es necesario, puede ejecutarlo en un puerto diferente modificando la variable PORT.

Características de la API

API de búsqueda

  • POST /api/search : busca páginas y bases de datos dentro de tu espacio de trabajo de Notion.

API de base de datos

  • POST /api/databases : Crear una base de datos
  • GET /api/databases/:id : Consultar base de datos
  • PATCH /api/databases/:id : Actualizar la base de datos
  • POST /api/databases/:id/query : Consulta de base de datos

API de página

  • POST /api/pages : Crear una página
  • GET /api/pages/:id : Ver información de la página
  • PATCH /api/pages/:id : Actualizar página
  • GET /api/pages/:page_id/properties/:property_id : Ver propiedades de la página

API de bloque

  • GET /api/blocks/:id : Consulta de bloque
  • GET /api/blocks/:id/children : Ver el contenido del bloque
  • PATCH /api/blocks/:id : Actualizar bloque
  • PATCH /api/blocks/:id/children : Agregar contenido del bloque
  • DELETE /api/blocks/:id : Eliminar bloque

API de usuario

  • GET /api/users : Ver lista de usuarios
  • GET /api/users/:id : Búsqueda de usuarios
  • GET /api/users/me : Ver su propia información de usuario

API de comentarios

  • POST /api/comments : Crear un comentario
  • GET /api/comments?block_id=... : Ver comentarios

Integración de Cursor MCP

  1. Agregue las siguientes configuraciones a .cursor/mcp.json :
{ "mcpServers": { "customApi": { "url": "http://localhost:3000", "toolNameStrategy": "url-path-segments" } } }
  1. Puede acceder a la API de Notion utilizando funciones MCP en Cursor mientras el servidor está en ejecución.

Ejemplos de uso

Ejemplo de solicitud de búsqueda

// 페이지 검색 fetch('http://localhost:3000/api/search', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ filter: { value: "page", property: "object" } }) }) .then(response => response.json()) .then(data => console.log(data));

Ejemplo de creación de página

// 새 페이지 생성 fetch('http://localhost:3000/api/pages', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ parent: { page_id: "페이지_ID" }, properties: { title: { title: [ { text: { content: "새 페이지 제목" } } ] } } }) }) .then(response => response.json()) .then(data => console.log(data));

Ejemplo de creación de una base de datos

// 데이터베이스 생성 fetch('http://localhost:3000/api/databases', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ parent: { type: "page_id", page_id: "페이지_ID" }, title: [ { text: { content: "테스트 데이터베이스" } } ], properties: { "이름": { "title": {}, "description": "제목 항목" }, "상태": { "description": "작업 상태", "select": { "options": [ { "name": "진행 중", "color": "blue" }, { "name": "완료", "color": "green" } ] } } } }) }) .then(response => response.json()) .then(data => console.log(data));

Documentación de la API

La documentación de la API está disponible en la siguiente URL cuando se ejecuta el servidor:

-
security - not tested
F
license - not found
-
quality - not tested

Un servidor personalizado que proporciona una interfaz API REST para Notion, lo que permite un fácil acceso a la funcionalidad de Notion a través de la función MCP de Cursor.

  1. Vídeo de referencia
    1. Cómo instalar
      1. Cómo configurar
        1. Características de la API
          1. API de búsqueda
          2. API de base de datos
          3. API de página
          4. API de bloque
          5. API de usuario
          6. API de comentarios
        2. Integración de Cursor MCP
          1. Ejemplos de uso
            1. Ejemplo de solicitud de búsqueda
            2. Ejemplo de creación de página
            3. Ejemplo de creación de una base de datos
          2. Documentación de la API

            Related MCP Servers

            • A
              security
              A
              license
              A
              quality
              MCP Server for the Notion API, enabling Claude to interact with Notion workspaces.
              Last updated -
              18
              1,398
              699
              TypeScript
              MIT License
            • -
              security
              F
              license
              -
              quality
              Enables interaction with Notion through the Notion API by exposing it as tools for LLMs, allowing operations like reading, creating, updating, and deleting Notion pages seamlessly via natural language.
              Last updated -
              41
              17
              TypeScript
            • -
              security
              A
              license
              -
              quality
              A Model Context Protocol server that provides a standardized interface for interacting with Notion's API, enabling users to list databases, create pages, and search across their Notion workspace.
              Last updated -
              95
              Python
              MIT License
              • Apple
            • A
              security
              A
              license
              A
              quality
              Notion MCP Server is a MCP server implementation that enables AI assistants to interact with Notion's API.
              Last updated -
              13
              275
              91
              TypeScript
              MIT License

            View all related MCP servers

            MCP directory API

            We provide all the information about MCP servers via our MCP API.

            curl -X GET 'https://glama.ai/api/mcp/v1/servers/HariFatherKR/notion_mcp_server'

            If you have feedback or need assistance with the MCP directory API, please join our Discord server