使用说明
概念增强型MCP
增强的Notion MCP服务器,对数据库操作提供完整的属性类型支持。
特性
- 完整的物业类型支持:使用所有24种Notion属性类型创建和更新数据库行
- 自动分页:默认情况下,查询函数会自动获取所有结果(没有100个项目的限制)
- 区块操作:将任何块类型(表、标注、代码等)附加到页面
- Markdown转换:将markdown转换为Notion块
- 图式反思:获取具有属性定义的数据库架构
工具
数据库操作
get_database_schema(database_id)-获取具有属性类型和选项的数据库架构query_database(database_id, filter, sorts, page_size, start_cursor, fetch_all)-使用筛选器查询数据库fetch_all=True(默认):自动分页以获取所有结果fetch_all=False:返回单页next_cursor用于手动分页
create_database_row(database_id, properties, content)-使用任何属性类型创建行update_database_row(page_id, properties)-更新行属性
页面操作
get_page(page_id, include_content)-获取包含属性和内容的页面(自动分页内容块)search_pages(query, filter_type, page_size, start_cursor, fetch_all)-搜索页面和数据库fetch_all=True(默认):自动分页以获取所有结果fetch_all=False:返回单页next_cursor用于手动分页
append_blocks(page_id, blocks)-将块附加到页面append_markdown(page_id, markdown)-添加降价内容
支持的属性类型
| 类型 | 示例值 |
|---|---|
| 标题 | "My Title" |
| rich_text | "Some text" |
| 编号 | 42 或 3.14 |
| 选择 | "Option A" |
| 多选 | ["Tag1", "Tag2"] |
| 日期 | "2024-01-15" 或 {"start": "...", "end": "..."} |
| 复选框 | true 或 false |
| url | "https://example.com" |
| 电子邮件 | "user@example.com" |
| 电话号码 | "+1234567890" |
| 状态 | "In Progress" |
| 文件 | ["https://url1.com", "https://url2.com"] |
| 关系 | ["page_id_1", "page_id_2"] |
| 人民 | ["user_id_1"] |
安装
uv tool install .
配置
增添 ~/.claude.json:
{
"mcpServers": {
"notion-enhanced": {
"type": "stdio",
"command": "notion-enhanced-mcp",
"args": [],
"env": {
"NOTION_TOKEN": "your_notion_token"
}
}
}
}
分页
默认情况下, query_database 和 search_pages 自动分页所有结果。Notion API将每个请求的响应限制为100个项目,但此MCP透明地处理分页。
# Fetch ALL rows (auto-pagination, default behavior)
result = query_database(database_id="abc123...")
print(f"Total tools: {result['total_count']}") # e.g., 500
# Manual pagination (for large datasets or streaming)
result = query_database(database_id="abc123...", fetch_all=False)
while result.get('has_more'):
# Process current batch
process(result['results'])
# Fetch next page
result = query_database(
database_id="abc123...",
start_cursor=result['next_cursor'],
fetch_all=False
)
用法示例
# Create a tool row with full properties
create_database_row(
database_id="abc123...",
properties={
"Tool Name": "Morph LLM",
"URL": "https://morphllm.com",
"Tags": ["Coding", "AI", "Developers"],
"Rating": 2,
"Description": "Fast code editing AI"
}
)
