Skip to main content
Glama
JinyongHyun

notion_summary_server

by JinyongHyun

notion_summary_server

一个将 AI 论文或股票文章摘要自动保存到 Notion 数据库的 MCP 服务器。

文件结构

notion_summary_server/
├── server.py           # MCP 서버 메인 파일
├── .env                # 환경변수 (직접 생성, git 제외)
├── .env.example        # 환경변수 템플릿
├── .gitignore
├── requirements.txt
└── README.md

Related MCP server: notion-mcp-server

工具 (Tool)

工具

说明

save_summary_to_notion

将摘要内容保存为 Notion 数据库中的新页面

输入参数

参数

类型

必填

说明

title

string

✅

页面标题

content

string

✅

摘要内容

source_url

string

✅

原文或论文 URL

category

"stock"

"paper"

✅

选择存储的目标数据库


前期准备

1. 创建 Notion Integration

  1. 访问 https://www.notion.so/my-integrations

  2. 点击 New integration

  3. 输入名称并创建 → 复制 Internal Integration Token

2. 将 Integration 连接到 Notion 数据库

在两个数据库中分别执行:

  1. 点击右上角 ... 菜单 → Connections → 添加已创建的 Integration

  2. 如果未连接 Integration,调用 API 时会发生 object_not_found 错误


安装

cd d:\python\notion_summary_server

# 가상환경 생성 (선택)
python -m venv .venv
.venv\Scripts\activate

# 의존성 설치
pip install -r requirements.txt

环境变量设置

复制 .env.example 创建 .env 文件:

copy .env.example .env

打开 .env 文件并输入值:

NOTION_API_KEY=secret_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
NOTION_STOCK_DB_ID=33117b872be68187a1b4ddc51261856e
NOTION_PAPER_DB_ID=34617b872be68060a474e18a73510f38

如何获取数据库 ID:在 Notion 数据库页面的 URL 中,notion.so/ 之后、? 之前的 32 位字符串


注册 Claude Code MCP

在终端执行以下命令:

claude mcp add notion_summary_server -- python d:/python/notion_summary_server/server.py

或者直接添加到 ~/.claude/settings.json:

{
  "mcpServers": {
    "notion_summary_server": {
      "command": "python",
      "args": ["d:/python/notion_summary_server/server.py"]
    }
  }
}

注册后重启 Claude Code 或通过 /mcp 命令确认:

/mcp

使用示例

向 Claude 发送如下请求:

이 논문을 요약해서 Notion에 저장해줘:
https://arxiv.org/abs/2310.06825
오늘 삼성전자 기사 요약해서 주식 DB에 저장해줘

MCP 工具直接调用示例:

{
  "tool": "save_summary_to_notion",
  "arguments": {
    "title": "Attention Is All You Need",
    "content": "Transformer 아키텍처를 제안한 논문. Self-attention 메커니즘만으로 RNN 없이 seq2seq 모델 구현. BLEU 점수에서 SOTA 달성.",
    "source_url": "https://arxiv.org/abs/1706.03762",
    "category": "paper"
  }
}

Notion 页面结构

保存的页面格式:

[제목]
┌─────────────────────────────────┐
│ 🔗 원본 링크: {source_url}       │
└─────────────────────────────────┘

## 요약
{content}

---
저장일시: 2025-05-09 10:30 UTC  |  분류: AI 논문

注意事项

  • 无论 Notion 数据库的标题属性名称是什么,都会自动检测并使用。

  • 如果摘要内容过长,会自动拆分保存(Notion 块限制:2000 字符)。

  • 请勿将 API 密钥提交到 git。.env 文件已包含在 .gitignore 中。

Related MCP Connectors

Related MCP Servers