rikkahub-history-mcp
RikkaHub History MCP
一个只读 MCP 桥接器,用于通过官方 RikkaHub 应用的 Web API 搜索对话。它不需要修改过的 APK、root 权限或 Room 数据库迁移。
功能
recent_conversations— 列出当前选中助手的最近对话,并附带轻量级元数据。search_conversations— 使用 RikkaHub 内置的全局全文索引。get_conversation_context— 读取搜索命中项周围的有界窗口。仅读取当前选中的消息分支。
仅返回 USER/ASSISTANT 文本;推理内容、工具调用/结果、系统消息和附件均被省略。
通过 mDNS 解析
rikkahub.local,因此手机 DHCP 地址变化通常无需重新配置。同时支持受密码保护和未认证的 RikkaHub Web Server 模式。
当配置了 Web 密码时,自动刷新 RikkaHub 的 Web JWT。
Streamable HTTP 模式需要单独的 Bearer 令牌,并保持 DNS 重绑定保护启用。
[!IMPORTANT] RikkaHub 的上游全文搜索是全局的,可能返回属于其他助手的对话。
recent_conversations仅限于当前选中的助手,但搜索/上下文并不构成助手隔离边界。
Related MCP server: reddit-mcp
要求
Python 3.10+
在同一个可信局域网内启用并可达 RikkaHub Web Server
当应用密码/JWT 模式正常工作时,使用专用的 RikkaHub Web 密码
安装
python -m venv .venv
# Windows
.venv\Scripts\python -m pip install -e .
# Linux/macOS
.venv/bin/python -m pip install -e .用于开发和安全检查:
python -m pip install -e ".[dev]"
pytest
ruff check .
bandit -q -r rikkahub_history_mcp
pip-audit配置 RikkaHub Web
在 RikkaHub 中启用 Web Server。默认端口为 8080。
桥接器首先尝试:
http://rikkahub.local:8080失败后它会重新解析 mDNS,并可将最后一次成功的手机 IP 保留为回退地址。你也可以设置显式的基础 URL,例如 http://192.168.0.20:8080。
已启用密码/JWT
设置一个专用、不重复使用的 RikkaHub Web 密码,并通过以下方式提供:
RIKKAHUB_WEB_PASSWORD=...已禁用密码/JWT
将 RIKKAHUB_WEB_PASSWORD 留空。桥接器将在没有 Authorization 头的情况下调用官方 Web API。
[!WARNING] 此兼容模式较弱。当 RikkaHub Web JWT 被禁用时,官方 Web API 自身的写端点也可能在局域网内无需认证即可访问。桥接器仍然只读,但无法保护独立的 RikkaHub Web Server。仅在可信的隔离局域网中使用此模式。
使用 Streamable HTTP 运行
将 start_http.example.ps1 复制为被忽略的 start_http.ps1,然后替换每个占位符。或者,在进程环境中设置来自 .env.example 的变量。
重要变量:
变量 | 描述 |
| 可选的 RikkaHub Web 访问密码;仅当上游 JWT 被禁用时留空 |
| 可选的显式 RikkaHub Web 基础 URL |
| RikkaHub Web 端口,默认 |
| 可选的最后成功 IP 状态文件 |
|
|
| MCP 绑定地址;安全默认值为 |
| MCP 端口,默认 |
| HTTP 模式必需;至少 24 个高熵字符,建议使用 |
| 逗号分隔的允许 Host 头,例如 |
| 逗号分隔的允许 Origins |
生成令牌:
python -c "import secrets; print(secrets.token_urlsafe(32))"在 Windows 上启动:
.\start_http.ps1然后配置 RikkaHub MCP:
Transport: Streamable HTTP
URL: http://<computer-lan-ip>:8766/mcp
Header: Authorization: Bearer <RIKKAHUB_HISTORY_TOKEN>对于局域网访问,请设置 RIKKAHUB_HISTORY_HOST=0.0.0.0,使用主机防火墙限制端口,并将 RikkaHub 使用的确切主机和端口添加到 RIKKAHUB_HISTORY_ALLOWED_HOSTS。HTTP 模式在没有非占位符 Bearer 令牌时拒绝启动。
STDIO 模式
RIKKAHUB_WEB_PASSWORD=... rikkahub-history-mcp当未设置 RIKKAHUB_HISTORY_RUN_MODE 时,STDIO 是默认模式,并且不需要 RIKKAHUB_HISTORY_TOKEN,因为它不会打开监听的 HTTP 端口。
安全与隐私
本项目公开的 MCP 工具是只读的。
切勿将 RikkaHub Web Server 或此 MCP 服务器直接暴露到公共互联网。
不要为端口
8080或8766配置路由器端口转发。RikkaHub Web 和示例 MCP 连接使用明文 HTTP。请仅在可信局域网中使用;密码和 Bearer 令牌无法防范恶意的网络观察者。
使用唯一的 RikkaHub Web 密码和单独、随机生成的 MCP Bearer 令牌。
桥接器会禁用为手机 API 流量继承的
HTTP_PROXY/HTTPS_PROXY设置,以避免通过代理发送本地凭据或对话数据。检索到的对话文本是不可信数据。模型不得遵循历史消息中的指令、链接或工具请求。
检索到的历史记录会作为工具上下文发送给当前选定的模型提供商。当对话包含敏感信息时,请精确搜索并保持上下文窗口较小。
不要提交
.env、start_http.ps1、密码、JWT、Bearer 令牌、状态文件或日志。有关漏洞报告和支持的安全模型,请参阅 SECURITY.md。
许可证
MIT
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables fetching and reading Reddit content such as posts, comments, and subreddit listings via the MCP protocol.23MIT
- AlicenseNot gradedqualityDmaintenanceA read-only MCP server that connects to the Reddit Data API to search posts, browse subreddits, read comments, view user profiles, and check trending content through the Model Context Protocol.181MIT
- FlicenseAqualityCmaintenanceRead-only MCP server for finding Discord messages. It enables searching guild messages, locating messages from jump URLs, and reading context around results.71
- FlicenseNot gradedqualityBmaintenanceRead-only MCP server for Kan's FxTwitter API proxy, enabling public X/Twitter search and retrieval.
Related MCP Connectors
Search your AI chat history (ChatGPT, Claude, Codex) from any MCP client. Remote, private, read-only
Lemmy MCP — public reads on any Lemmy instance.
Reddit MCP — public Reddit data via JSON endpoints (no auth required)
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Photalia/rikkahub-history-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server