FreshRSS MCP服务器
用Go编写的FreshRSS模型上下文协议(MCP)服务器。该服务器使LLM能够通过Fever API与FreshRSS交互,提供管理RSS提要和文章的工具。
特性
- 列表类别:从您的FreshRSS实例中检索所有类别/组
- 列表订阅源:列出提要,可选择按类别和读取状态进行筛选
- 标记为已读:将单个新闻项目标记为已读
- 标记为未读:将单个新闻项目标记为未读
需求
- 达到1.21或更高
- 启用Fever API的FreshRSS服务器
- API凭据(用户名和API密码)
安装
从源代码构建
git clone https://github.com/yourusername/mcp-freshrss.git
cd mcp-freshrss
go build -o freshrss-mcp使用Go安装
go install github.com/yourusername/mcp-freshrss@latest配置
环境变量
在运行服务器之前设置以下环境变量:
| 变量 | 描述 | 示例 |
|---|---|---|
FRESHRSS_URL | FreshRSS服务器的基本URL | https://freshrss.example.net |
FRESHRSS_API_KEY | Fever API密钥(预先计算的MD5哈希) | abc123def456... |
生成API密钥
这 FRESHRSS_API_KEY 环境变量必须包含 预计算 您的FreshRSS用户名和API密码的MD5哈希,用冒号连接。
计算哈希值:
# Linux
echo -n "username:api_password" | md5sum | cut -d' ' -f1
# macOS
echo -n "username:api_password" | md5
# Using Python
python3 -c "import hashlib; print(hashlib.md5('username:api_password'.encode()).hexdigest())"重要:
- 使用你的FreshRSS API密码,不是您的登录密码
- 您可以在下的FreshRSS中设置/生成API密码 设置 → 用户资料 → API密码
- 服务器需要已经散列的值,而不是原始值
username:password字符串
在FreshRSS中启用Fever API
- 登录您的FreshRSS实例
- 首选 设置 → 用户资料
- 检查 启用API访问
- 设置或生成 API密码
- 保存更改
用法
运行服务器
export FRESHRSS_URL="https://your-freshrss.example.net"
export FRESHRSS_API_KEY="your_md5_hash_here"
./freshrss-mcp服务器通过stdio进行通信,使其与任何MCP客户端兼容。
与MCP客户端集成
克劳德桌面版
添加到您的Claude Desktop配置(~/Library/Application Support/Claude/claude_desktop_config.json 在macOS上):
{
"mcpServers": {
"freshrss": {
"command": "/path/to/freshrss-mcp",
"env": {
"FRESHRSS_URL": "https://your-freshrss.example.net",
"FRESHRSS_API_KEY": "your_md5_hash_here"
}
}
}
}其他MCP客户端
服务器使用stdio传输,并与任何兼容MCP的客户端兼容。配置您的客户端以运行 freshrss-mcp 带有所需环境变量的二进制文件。
可用工具
freshrss_list_类别
列出FreshRSS实例中的所有类别(组)。
参数:无
示例响应:
{
"categories": [
{"id": 1, "title": "Technology"},
{"id": 2, "title": "News"},
{"id": 3, "title": "Entertainment"}
]
}freshrss_list_feeds
列出具有可选过滤功能的提要。
参数:
category_id(可选,整数):按类别ID筛选read_status(可选,字符串):按读取状态筛选
- all (默认):显示所有提要 - read:显示包含已读项目的提要 - unread:显示包含未读项目的订阅源
示例:
List all feeds with unread items in category 1示例响应:
{
"feeds": [
{
"id": 1,
"title": "Example Blog",
"url": "https://example.com/feed",
"site_url": "https://example.com",
"unread_count": 5
}
]
}freshrss_getitem
按ID获取新闻条目。
参数:
item_id(必填,整数):要检索的项目的ID
示例:
Get item 12345示例响应:
{
"id": "12345",
"feed_id": 1,
"title": "Article Title",
"author": "Author Name",
"url": "https://example.com/article",
"html": "
Article content...
",
"is_read": false,
"is_saved": false,
"created_on_time": 1234567890
}freshrss_mark_item_read
将新闻标记为已读。
参数:
item_id(必填,整数):要标记为已读的项目的ID
示例:
Mark item 12345 as readfreshrss_mark_item_unread
将新闻标记为未读。
参数:
item_id(必填,整数):要标记为未读的项目的ID
示例:
Mark item 12345 as unreadAPI 参考
此服务器使用FreshRSS Fever API实现。关键端点:
| 操作 | 端点 | 方法 |
|---|---|---|
| 列出类别 | ?api&groups | 职位 |
| 列出订阅源 | ?api&feeds | 职位 |
| 列出未读ID | ?api&unread_item_ids | 职位 |
| 将项目标记为已读 | POST正文: mark=item&as=read&id= | 职位 |
| 将项目标记为未读 | POST正文: mark=item&as=unread&id= | 职位 |
有关API的完整文档,请参阅:
发展
项目结构
mcp-freshrss/
├── main.go # Entry point
├── client/
│ └── fever.go # Fever API client
├── tools/
│ ├── categories.go # Categories tool
│ ├── feeds.go # Feeds tool
│ └── items.go # Item tools
└── models/
└── types.go # Data models建筑
go build -o freshrss-mcp测试
go test ./...局限性
- Fever API不支持添加、编辑或删除提要
- FreshRSS不支持热链接功能
- 每次请求最多返回50个项目
许可证
MIT许可证
贡献
欢迎投稿!请随时提交拉取请求。
支持
关于以下问题:
- 此MCP服务器:在GitHub上打开一个问题
- 新鲜RSS:参见 FreshRSS文档
- 发烧API:参见 API文档
