概念mcp快速
Notion的快速MCP服务器-从macOS上Notion.app的本地SQLite缓存中读取。
为什么?
官方的Notion API需要身份验证,并且有速率限制。此MCP服务器直接从Notion的本地缓存读取,提供:
- 没有API调用 -无网络延迟的即时访问
- 无费率限制 -想读多少就读多少
- 近乎实时同步 -Notion.app通过WebSocket同步,更新会在1-3秒内反映出来
- 离线访问 -无需互联网连接即可工作
- 完全内容访问 -搜索页面内容,而不仅仅是元数据
⚠️ 只读:此服务器无法写入Notion。对于写入操作,请使用 API官方通知.
需求
- macOS(使用Notion.app的本地SQLite数据库)
- 概念.app 安装并打开至少一次
- Python 3.10+
安装
# Clone and install
git clone https://github.com/chat-prompt/notion-mcp-fast.git
cd notion-mcp-fast
uv sync
# Or install directly
uv pip install git+https://github.com/chat-prompt/notion-mcp-fast.git使用Claude Desktop
添加到您的Claude桌面配置(~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"notion-local": {
"command": "uv",
"args": ["run", "--directory", "/path/to/notion-mcp-fast", "notion-mcp-fast"]
}
}
}或者,如果全局安装:
{
"mcpServers": {
"notion-local": {
"command": "notion-mcp-fast"
}
}
}可用工具
| 工具 | 说明 |
|---|---|
list_pages | 列出具有可选工作区/父过滤器的页面 |
get_page | 获取包含内容的页面详细信息 |
search_pages | 按标题搜索页面 |
full_text_search | 搜索页面内容(不仅仅是标题) |
list_databases | 列出所有数据库 |
get_database | 获取数据库架构 |
query_database | 从数据库中获取记录 |
list_workspaces | 列出所有工作区 |
get_summary | 获取缓存摘要 |
例子
列出最近使用的页面
> list_pages(limit=10)搜索页面
> search_pages("meeting notes")全文搜索
> full_text_search("project deadline")获取页面内容
> get_page("page-id-here", include_content=True)查询数据库
> query_database("database-id-here", limit=20)数据新鲜度
数据从Notion.app的本地缓存中读取:
- Notion.app同步时缓存更新
- 内存缓存具有5分钟TTL
- 对于实时数据,请使用官方的Notion API
故障排除
未找到数据库
Notion database not found at ~/Library/Application Support/Notion/notion.db解决方案:打开Notion.app至少一次以创建本地数据库。
未找到页面
这通常意味着:
- Notion尚未同步-打开Notion.app并等待
- 您已登录到其他帐户-检查
meta_user_id检测
权限不足
macOS可能会阻止访问应用程序支持。在“系统首选项”>“安全与隐私”>“隐私”>《全磁盘访问》中授予终端/IDE全磁盘访问权限。
背景:为什么Notion有本地缓存?
Notion的桌面应用程序基于Electron构建,并维护本地SQLite数据库以提供离线支持。当你在Notion中打开任何页面时,它都会在本地缓存,这样你就可以:
- 在没有互联网的情况下访问最近查看的页面
- 在网络中断期间继续工作
- 在后续访问中体验更快的页面加载
此本地缓存(notion.db)包含与Notion内部使用的基于块的数据结构相同的数据结构——页面、数据库、文本块及其所有属性。该应用程序通过WebSocket同步更改,因此本地缓存保持非常新鲜(在线时通常比服务器晚1-3秒)。
这个MCP服务器只是从现有的缓存中读取-没有额外的同步机制,没有API令牌,没有速率限制。
运作原理
Notion.app在以下位置存储SQLite缓存 ~/Library/Application Support/Notion/notion.db此MCP服务器:
- 以只读模式打开数据库
- 通过以下方式检测主要用户
meta_user_id - 缓存元数据(页面、数据库)5分钟
- 按需加载内容块以节省内存
- 使用SQLite LIKE查询进行全文搜索
许可证
麻省理工学院
