这是一个灵活的系统,可用于管理各类来源(如论文、书籍、网页等),并将其与知识图谱集成,为知识管理提供高效解决方案。
此系统与 MCP 记忆服务器 集成,用于持久化知识图谱存储。
# 创建新数据库
sqlite3 sources.db < create_sources_db.sql
# 为 Claude Desktop 安装,指定数据库路径
fastmcp install source-manager-server.py --name "Source Manager" -e SQLITE_DB_PATH=/path/to/sources.db
-- 来源表
CREATE TABLE sources (
id UUID PRIMARY KEY,
title TEXT NOT NULL,
type TEXT CHECK(type IN ('paper', 'webpage', 'book', 'video', 'blog')) NOT NULL,
identifiers JSONB NOT NULL,
status TEXT CHECK(status IN ('unread', 'reading', 'completed', 'archived')) DEFAULT 'unread'
);
-- 来源笔记
CREATE TABLE source_notes (
source_id UUID REFERENCES sources(id),
note_title TEXT NOT NULL,
content TEXT NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (source_id, note_title)
);
-- 实体链接
CREATE TABLE source_entity_links (
source_id UUID REFERENCES sources(id),
entity_name TEXT,
relation_type TEXT CHECK(relation_type IN ('discusses', 'introduces', 'extends', 'evaluates', 'applies', 'critiques')),
notes TEXT,
PRIMARY KEY (source_id, entity_name)
);
添加一个带有多个标识符的论文:
add_source(
title="Attention Is All You Need",
type="paper",
identifier_type="arxiv",
identifier_value="1706.03762",
initial_note={
"title": "初始想法",
"content": "开创性论文,介绍 transformer 架构..."
}
)
# 为同一论文添加另一个标识符
add_identifier(
title="Attention Is All You Need",
type="paper",
current_identifier_type="arxiv",
current_identifier_value="1706.03762",
new_identifier_type="url",
new_identifier_value="https://arxiv.org/abs/1706.03762"
)
添加一个网页:
add_source(
title="如何使用深度学习进行自然语言处理",
type="webpage",
identifier_type="url",
identifier_value="https://www.tensorflow.org/text",
initial_note={
"title": "快速入门指南",
"content": "介绍了使用 TensorFlow 进行文本处理的基础知识..."
}
)
将来源标记为已读:
update_status(source_id, 'completed')
获取所有未读论文:
get_sources_by_status('unread', 'paper')
将论文与实体链接:
link_entity(
source_id,
entity_name="transformer_architecture",
relation_type="introduces"
)
获取所有相关实体:
get_linked_entities(source_id)
sources 表用于存储基本来源信息。source_notes 表用于记录与来源相关的笔记。source_entity_links 表用于跟踪来源与其他实体的关系。