AI-Notion Integration MCP Server
Enables AI assistants to save and manage question-and-answer pairs within a structured Notion database. It provides tools for database setup, entry creation, and querying existing conversation history.
README
Notion MCP Server - AI-Notion Integration
A Model Context Protocol (MCP) server that seamlessly integrates Claude AI with Notion databases. Save your conversations, Q&A pairs, and learning progress directly to Notion from Claude Desktop.
🎯 What is This?
This project allows Claude (via Claude Desktop) to:
- ✅ Save conversations and Q&A pairs to Notion automatically
- ✅ Query your Notion database from Claude
- ✅ Track learning progress with mastery levels
- ✅ Organize information in a structured database
📋 Quick Start
New to this project? Start here: QUICKSTART.md - A complete step-by-step guide for first-time users!
Setup
- Clone the repository
- Install dependencies:
npm install - Create a
.envfile with the following variables:NOTION_API_TOKEN=your_notion_integration_token NOTION_DATABASE_ID=your_notion_database_id NOTION_PARENT_PAGE_ID=your_notion_page_id (only needed for database setup)
Notion Integration Setup
-
Go to Notion Integrations and create a new integration <img width="600" alt="Screenshot 2026-01-31 at 7 50 23 PM" src="https://github.com/user-attachments/assets/d1373f24-663f-4c87-8e54-582707f411e6" />
-
Give your integration a name (e.g., "AI QA Tracker") and select the appropriate capabilities (read & write)
-
Copy the "Internal Integration Token" and paste it into your
.envfile
<img width="600" alt="Screenshot 2026-01-31 at 7 50 11 PM" src="https://github.com/user-attachments/assets/2e6c446f-cd99-4c30-94bf-f5933bee35ca" />
- Share your Notion database with your integration
Database Setup
To create a new database structure for tracking AI questions/answers:
# 1. Install dependencies
npm install
# 2. Configure .env (copy from .env.example)
cp .env.example .env
# Edit .env with your Notion credentials
# 3. Build the project
npm run build
# 4. Configure Claude Desktop
# Edit ~/Library/Application\ Support/Claude/claude_desktop_config.json
# See QUICKSTART.md Step 3 for details
# 5. Restart Claude Desktop
# You're ready to use it!
📚 Documentation
| Document | Purpose |
|---|---|
| QUICKSTART.md | Complete setup guide for new users |
| README.md | This file - project overview |
.env.example |
Configuration template |
🔧 System Requirements
- Node.js: 18 or higher
- npm: 9 or higher
- Operating System: macOS, Windows, or Linux
- Notion Account: With an active workspace
- Claude Desktop: Latest version
🚀 Core Features
1. Notion Integration
- Create and manage Notion databases from your code
- Automatic database setup with proper structure
- Full read/write access through Notion API
2. MCP Server
- Exposes tools to Claude Desktop via MCP protocol
- Built-in support for ES Modules (ESM)
- Type-safe with TypeScript
3. AI-Ready Tools
The server provides these tools for Claude to use:
notion_ai_save_entry- Save Q&A to Notionnotion_query_database- Search your Notion databasenotion_update_mastery- Track learning progress
📁 Project Structure
notion-mcp-server/
├── src/
│ ├── index.ts # Main MCP server entry point
│ ├── config.ts # Environment & config validation
│ ├── types.ts # TypeScript type definitions
│ ├── setup-database.ts # Database initialization script
│ ├── test-notion.ts # Notion API connection tests
│ ├── mock-test.ts # Tests without real Notion
│ └── test.ts # MCP server tests
├── dist/ # Compiled JavaScript (auto-generated)
├── .env # Your configuration (don't commit!)
├── .env.example # Configuration template
├── tsconfig.json # TypeScript settings
├── package.json # Dependencies & scripts
├── QUICKSTART.md # First-time user guide
└── README.md # This file
🔑 Configuration
Environment Variables
Create a .env file in the project root with:
# Required: Notion API Integration Token
NOTION_API_TOKEN=ntn_your_token_here
# Required: Notion page ID where database will be created
NOTION_PARENT_PAGE_ID=your_page_id_here
# Optional: Existing database ID (auto-created on first run)
NOTION_DATABASE_ID=your_database_id_here
See .env.example for more details.
Claude Desktop Configuration
Edit your Claude Desktop config:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"notion-server": {
"command": "node",
"args": [
"/path/to/notion-mcp-server/dist/index.js"
],
"env": {
"NOTION_API_TOKEN": "ntn_your_token",
"NOTION_PARENT_PAGE_ID": "your_page_id",
"NOTION_DATABASE_ID": "your_database_id"
}
}
}
}
🛠️ Available Commands
# Install dependencies
npm install
# Build the project (TypeScript → JavaScript)
npm run build
# Run tests
npm run test
# Test Notion connection specifically
npm run test-notion
# Start in development mode with auto-reload
npm run dev
# Start the server (production)
npm start
📖 How It Works
1. You write in Claude Desktop
2. Claude uses the Notion tools
3. MCP Server (dist/index.js) handles the request
4. Notion API saves your data
5. Your Notion database is updated
❓ Why TypeScript → JavaScript?
Key Question: Why do we need to build?
- Source:
src/index.ts(TypeScript with type checking) - Build:
npm run build(compilation step) - Runtime:
dist/index.js(plain JavaScript) - Why: Claude Desktop runs Node.js, which needs
.jsfiles, not.ts
Development: src/index.ts
↓ npm run build
Production: dist/index.js ← Claude Desktop executes this
🔐 Security Notes
- ⚠️ Never commit
.envfile - It contains your API token - ✅
.envis already in.gitignore - ✅ Safe to share:
src/,package.json,tsconfig.json,.env.example - ❌ Never share:
.env,dist/,node_modules/
🐛 Troubleshooting
Claude Desktop shows "Failed to connect"
- Check
.envfile has correct values - Run
npm run buildto generatedist/index.js - Verify path in Claude Desktop config is correct
- Restart Claude Desktop
"NOTION_API_TOKEN is not set"
- Create
.envfile (copy from.env.example) - Add your actual Notion token
- Restart Claude Desktop
"Database permission denied"
- Go to https://www.notion.so/my-integrations
- Find your integration
- Share your Notion page with the integration
- Restart Claude Desktop
"Cannot find module dist/index.js"
- Run
npm installfirst - Run
npm run build - Check
dist/folder exists and containsindex.js
📚 Next Steps
- First time? Read QUICKSTART.md
- Want to customize? Modify
src/index.tsto add new tools - Need help? Check QUICKSTART.md's FAQ section
📝 Git Best Practices
What to commit:
src/- Your source codepackage.json- Dependencies listtsconfig.json- Build configuration.env.example- Configuration templateQUICKSTART.md- Documentation.gitignore- Git settings
What NOT to commit:
dist/- Regenerate withnpm run buildnode_modules/- Regenerate withnpm install.env- Contains secrets, already ignored*.log- Log files.DS_Store- macOS system files
🤝 Contributing
To modify or extend this project:
- Edit files in
src/ - Run
npm run buildto recompile - Test locally:
npm run test - Restart Claude Desktop to see changes
📄 License
ISC
🙏 Acknowledgments
Questions? Check QUICKSTART.md for detailed step-by-step instructions! 🚀
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。