一个灵活的系统,用于管理各种类型的资源(论文、书籍、网页等),并将其与知识图谱集成。
该系统与MCP记忆服务器集成,用于持久化存储知识图谱。
# 创建一个新的数据库
sqlite3 sources.db < create_sources_db.sql
# 为Claude桌面安装资源管理服务器,并指定数据库路径
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": "开创性的论文介绍了变压器..."
}
)
# 向同一论文添加另一个标识符
add_identifier(
title="Attention Is All You Need",
type="paper",
current_identifier_type="arxiv",
current_identifier_value="11706.03762",
new_identifier_type="semantic_scholar",
new_identifier_value="204e3073870fae3d05bcbc2f6a8e263d9b72e776"
)
添加网页:
add_source(
title="理解变压器",
type="webpage",
identifier_type="url",
identifier_value="https://example.com/transformers",
)
向资源添加笔记:
add_note(
title="Attention Is All You Need",
type="paper",
identifier_type="arxiv",
identifier_value="1706.03762",
note_title="实现细节",
note_content="论文描述了架构..."
)
将资源链接到实体:
link_to_entity(
title="Attention Is All You Need",
type="paper",
identifier_type="arxiv",
identifier_value="1706.03762",
entity_name="transformer",
relation_type="introduces",
notes="首次介绍变压器架构的论文"
)
按实体查询资源:
get_entity_sources(
entity_name="transformer",
type_filter="paper",
relation_filter="discusses"
)
资源管理
实体链接
资源标识
数据组织