内容
# 亚历山大里亚 MCP 服务器
[](https://codeguilds.dev/packages/alexandria-mcp)
对 20,000+ 篇古典哲学和人文作品中的 **460 万文本片段** 进行语义搜索。使用 [FastMCP](https://github.com/jlowin/fastmcp) 通过 HTTP 为 AI 代理构建。
## 集合内容
所有文本均为公共领域(1928 年前),来源于 [Internet Archive](https://archive.org)(americana、europeanlibraries、gutenberg 集合)。
- **哲学:** 亚里士多德、柏拉图、康德、黑格尔、尼采、叔本华、笛卡尔、斯宾诺莎、洛克、休谟、密尔、维特根斯坦、阿奎那、奥古斯丁、莱布尼茨、卢梭、伏尔泰、马克思等众多哲学家
- **主题:** 伦理学、形而上学、认识论、逻辑学、政治哲学、神学、斯多葛主义、新柏拉图主义、存在主义、思想史
- **语言:** 英语、德语、拉丁语、法语、意大利语、希腊语、俄语
## 连接到服务器
**远程(托管):**
```bash
claude mcp add --transport http alexandria https://alexandria.aidatanorge.no/mcp
```
**通过 MCP 配置文件:**
```json
{
"mcpServers": {
"alexandria": {
"type": "http",
"url": "https://alexandria.aidatanorge.no/mcp"
}
}
}
```
## 工具
### `search_texts`
使用自然语言搜索集合。使用混合密集 + 稀疏检索和交叉编码器重新排序。
| 参数 | 类型 | 描述 |
|---|---|---|
| `query` | 字符串 | 您要查找的内容 |
| `author` | 字符串 | 可选的作者/创作者过滤器,例如 `康德`、`尼采`、`柏拉图` |
| `language` | 字符串 | 可选的语言过滤器:`eng`、`ger`、`lat`、`fre`、`ita`、`gre`、`rus` |
| `limit` | 整数 | 结果数量(默认为 5,最大 20) |
**示例查询:**
- `"尼采的权力意志与永恒轮回"`
- `"康德的绝对命令与义务"`
- `"柏拉图的理型论与善"`
- `"斯多葛主义的美德与贤人"`
- `"黑格尔的辩证法与精神历史"`
每个结果包括:`title`、`creator`、`date`、`language`、`subject`、`text`(片段)、`rerank_score`、`vector_score`。
**curl 示例:**
```bash
curl -X POST https://alexandria.aidatanorge.no/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "search_texts",
"arguments": {
"query": "康德的绝对命令与义务伦理",
"author": "康德",
"limit": 3
}
}
}'
```
### `get_book_list`
按作者、主题或语言过滤集合中的书籍列表。
| 参数 | 类型 | 描述 |
|---|---|---|
| `author` | 字符串 | 按作者/创作者过滤,例如 `康德`、`柏拉图` |
| `subject` | 字符串 | 按主题关键词过滤,例如 `伦理学`、`逻辑学` |
| `language` | 字符串 | 按语言代码过滤:`eng`、`ger`、`lat`、`fre`、`ita`、`gre`、`rus` |
| `limit` | 整数 | 返回的最大书籍数量(默认为 20,最大 100) |
**curl 示例:**
```bash
curl -X POST https://alexandria.aidatanorge.no/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "get_book_list",
"arguments": {"author": "柏拉图", "language": "eng"}
}
}'
```
### `ping`
连接性测试。
## 提示
- `philosopher_analysis(philosopher)` — 深入探讨哲学家的核心思想
- `topic_exploration(topic)` — 跨多个思想家探索主题
- `compare_philosophers(philosopher_a, philosopher_b, topic)` — 比较两位哲学家在特定主题上的观点
## 架构
```
Archive.org(13,000+ 本书)
↓
文本提取 + 分段
↓
Qdrant(460 万向量)
↓
混合搜索:intfloat/multilingual-e5-large(密集)+ Qdrant/bm25(稀疏)
↓
交叉编码器重新排序:mmarco-mMiniLMv2-L12-H384-v1
↓
FastMCP 3.2 over HTTP
```
## 自主托管
需要一个运行中的 Qdrant 实例,并使用 `alexandria` 集合填充。
```bash
pip install -r requirements.txt
python alexandria_mcp_server.py
# 服务器启动于 http://localhost:8005/mcp
```
环境变量(可选):
```
QDRANT_HOST=localhost
QDRANT_PORT=6333
MCP_PORT=8005
```
## 许可证
MIT