A TypeScript implementation of a Model Context Protocol (MCP) server that connects Notion workspaces to Claude Desktop, enabling Claude to search, read, and query your Notion content.
- Search Pages: Search across all accessible Notion pages by keyword
- Fetch Page Content: Retrieve full page content including title and text
- List Databases: Discover all databases in your workspace
- Query Databases: Get complete database entries with all property values
- Node.js 24.11.0 (or compatible version)
- A Notion account with admin access
- Claude Desktop application
- Clone or download this repository
- Install dependencies:
npm install- Build the project:
npm run build- Go to Notion Integrations
- Click "+ New integration"
- Give it a name (e.g., "Claude MCP Integration")
- Set capabilities to "Read content" (minimum required)
- Copy the "Internal Integration Token" (starts with
secret_)
Important: The integration won't have access to any content by default. You must explicitly share pages/databases:
- Open the page or database in Notion
- Click the "..." menu in the top right
- Select "Connections"
- Find and add your integration
Repeat for each page/database you want Claude to access.
-
Locate your Claude Desktop config file:
- Windows:
%APPDATA%\Claude\claude_desktop_config.json - macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
- Windows:
-
Add the MCP server configuration:
{
"mcpServers": {
"custom-notion-mcp": {
"command": "node",
"args": ["C:\\path\\to\\custom-notion-mcp-ts\\build\\index.js"],
"env": {
"NOTION_TOKEN": "secret_your_token_here"
}
}
}
}Replace the path with your actual absolute path to build/index.js.
- Restart Claude Desktop
Once configured, Claude will have access to four tools:
Search for pages by keyword:
"Search my Notion for pages about project planning"
Get the full content of a specific page:
"Fetch the content of this Notion page: [page-id or URL]"
See all available databases:
"List all databases in my Notion workspace"
Get all entries from a database:
"Show me all entries in database [database-id]"
Claude will automatically use these tools when you ask questions about your Notion content.
This MCP server uses:
- @modelcontextprotocol/sdk: Official MCP SDK for server implementation
- @notionhq/client: Official Notion API client
- stdio transport: Communication with Claude Desktop via stdin/stdout
- Zod schemas: Parameter validation for tool inputs
custom-notion-mcp-ts/
├── src/
│ └── index.ts # Main MCP server implementation
├── build/ # Compiled JavaScript output
├── package.json # Dependencies and scripts
├── tsconfig.json # TypeScript configuration
└── README.md # This file
The query_database tool handles these Notion property types:
- Title
- Rich Text
- Number
- Select / Multi-select
- Date
- Checkbox
- URL
- Phone Number
- Status
Other property types will show as [type] in the output.
- fetch_page only extracts paragraph blocks
- Headings, lists, code blocks, and other block types are not included
- Nested/child blocks are not retrieved
- Search results limited to first 100 items
- Database queries limited to first 100 entries
- No automatic pagination handling
- No caching of API responses
- Each request makes fresh API calls
- No rate limit handling or retry logic
npm run buildCompiles TypeScript from src/ to build/ directory.
- Make changes to
src/index.ts - Run
npm run build - Restart Claude Desktop to reload the server
The server logs to stderr. View logs by checking Claude Desktop's MCP server output or running the server directly:
node build/index.jsThe server will wait for MCP messages on stdin.
Cause: Pages not shared with the integration
Solution: Open pages in Notion → "..." menu → "Connections" → Add your integration
Cause: Databases not shared with the integration
Solution: Share at least one page that's a child of the database, or share the database directly
Cause: MCP server not properly registered or old build being used
Solution:
- Rebuild the project:
npm run build - Restart Claude Desktop
- Verify the path in Claude Desktop config is correct
Possible causes:
NOTION_TOKENenvironment variable not set in Claude Desktop config- Invalid token format (should start with
secret_) - Wrong Node.js version (requires 24.11.0)
- Build directory missing (run
npm run build)
This is a learning project for understanding MCP server implementation. Feel free to:
- Add support for more block types in
fetch_page - Implement pagination for large result sets
- Add caching layer for frequently accessed content
- Implement DEPRECATED page filtering
- Add configuration file support
ISC
Never commit your Notion integration token to version control.
Always use environment variables or configuration files (excluded via .gitignore) to store sensitive credentials.