0.1.1 • Published 4 months ago

notion-mcp-toolkit v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

Notion MCP Toolkit

A toolkit for integrating Notion with the Cursor MCP (Multi-Client Protocol) system.

Features

  • NotionClient: A client for interacting with the Notion API
  • CursorClient: A client for interacting with the Cursor MCP system
  • MCP Server: A server implementation for handling MCP connections
  • Factory Functions: Easy creation of client instances
  • STDIO Mode: Support for CLI integrations

Installation

npm install notion-mcp-toolkit

Quick Start

const { createNotionClient, createCursorClient } = require('notion-mcp-toolkit');

// Create a Notion client (API key can also be set in .env file as NOTION_API_KEY)
const notionClient = createNotionClient({
  apiKey: process.env.NOTION_API_KEY
});

// Create a Cursor client
const cursorClient = createCursorClient({
  serverUrl: 'http://localhost:5432',
  wsUrl: 'ws://localhost:5433'
});

// Connect to Cursor
await cursorClient.connect();

// Get current file from Cursor
const currentFile = await cursorClient.getCurrentFile();

// Create a page in Notion
const page = await notionClient.createPage({
  parent: { database_id: 'your-database-id' },
  properties: {
    title: {
      title: [{ text: { content: currentFile.name } }]
    }
  }
});

// Add content from Cursor to Notion
const fileContent = await cursorClient.getFileContent(currentFile.path);
await notionClient.addPageContent(page.id, fileContent);

// Disconnect from Cursor
cursorClient.disconnect();

Environment Variables

You can set these environment variables in a .env file in the root of your project:

NOTION_API_KEY=your-notion-api-key
MCP_SERVER_PORT=5432
MCP_WS_PORT=5433
MCP_LOG_LEVEL=INFO

Documentation

For detailed documentation, see the docs directory.

Examples

Check out the examples directory for more usage examples.

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for details.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Changelog

See CHANGELOG.md for a list of changes in each release.