mcp-signal
mcp-signal
一个本地模型上下文协议 (MCP) 服务器,通过
signal-export从本地加密数据库读取 Signal Desktop 历史记录,并通过signal-cli发送出站消息。
mcp-signal 专注于个人 Signal 自动化的核心工作流——列出聊天、读取消息、搜索消息、检查群组以及向直接聊天或群组发送消息。所有操作均在本地运行;使用 stdio 传输,无网络监听。
注意——混合后端。 读取/搜索功能来自本地 Signal Desktop 数据库。发送功能使用
signal-cli,该工具必须单独安装并关联到 Signal 账户。如果signal-cli不可用,读取/搜索功能仍可正常工作,但发送工具将无法使用。
功能
从 Signal Desktop 列出直接聊天和群组聊天
读取聊天中的最近消息
在单个聊天或所有聊天中搜索消息
列出带有
signal-cli群组 ID 的群组聊天,以便进行出站发送发送消息至:
通过电话号码发送给直接收件人
通过群组 ID 发送给群组
通过精确的聊天名称发送给聊天(带有歧义检查)
完全在您的机器上运行;使用 stdio 传输,无网络监听
Related MCP server: Signal MCP
设置
先决条件
Python 3.13+
带有现有本地消息数据库的 Signal Desktop
如果需要出站发送,请安装并关联
signal-cli
安装
克隆此仓库
git clone https://github.com/Sealjay/mcp-signal.git cd mcp-signal安装依赖项
uv sync安装
signal-cli(可选——仅在需要出站发送时才需要)在 macOS 上,最简单的方法是使用 Homebrew:
brew install signal-cli
配置出站发送
如果存在,服务器会自动从仓库根目录加载本地 .env.local 文件。此文件已被 gitignore 忽略,是存放机器本地配置的推荐位置。
cat > .env.local <<'EOF'
SIGNAL_ACCOUNT="+441234567890"
EOF可选环境变量:
变量 | 用途 |
| 覆盖 |
| 覆盖 Signal Desktop 数据目录 |
| 如有需要,为加密桌面数据库提供密码 |
| 如有需要,为加密桌面数据库提供原始密钥 |
在 shell 中设置的环境变量优先级高于 .env.local。
关联 signal-cli(仅限首次运行)
mcp-signal 本身不管理关联。请先关联本地 signal-cli 设备:
signal-cli link -n "signal-mcp"在 Signal 移动应用中扫描二维码(设置 → 已关联设备 → 关联新设备)。
在当前的 signal-cli 版本中,请不要向 link 命令传递 -a / --account 参数——关联新的辅助设备时不需要电话号码。
二维码被接受后,确认已关联的账户可见:
signal-cli listAccounts该账户应与 .env.local 中的 SIGNAL_ACCOUNT 值匹配。
signal-cli 将其关联账户状态存储在自己的本地数据目录下(macOS/Linux 上通常为 ~/.local/share/signal-cli/data)。该状态位于此仓库之外,且不会被 mcp-signal 提交。
验证一切连接正常:
uv run signal-mcp smokeMCP 客户端配置
所有客户端都通过 stdio 以相同方式启动服务器。在 macOS 上,您可能需要 uv 的绝对路径——请参阅下方的 macOS: uv PATH。
Claude Code
最快的方法是使用 CLI:
claude mcp add --transport stdio signal --scope user -- uv run --directory /absolute/path/to/mcp-signal signal-mcp serve或者,将其添加到项目根目录的 .mcp.json 中(或用户范围服务器的 ~/.claude.json 中):
{
"mcpServers": {
"signal": {
"type": "stdio",
"command": "uv",
"args": ["run", "--directory", "/absolute/path/to/mcp-signal", "signal-mcp", "serve"]
}
}
}如果您直接编辑该文件,请重启 Claude Code 会话以使其生效。
Claude Desktop
添加到 ~/Library/Application Support/Claude/claude_desktop_config.json(macOS):
{
"mcpServers": {
"signal": {
"command": "uv",
"args": ["run", "--directory", "/absolute/path/to/mcp-signal", "signal-mcp", "serve"]
}
}
}重启 Claude Desktop。您应该会看到 signal 列为可用的集成。
Cursor
添加到 ~/.cursor/mcp.json:
{
"mcpServers": {
"signal": {
"command": "uv",
"args": ["run", "--directory", "/absolute/path/to/mcp-signal", "signal-mcp", "serve"]
}
}
}重启 Cursor。
macOS: uv PATH
GUI 应用程序(Claude Desktop、Cursor)并不总是从您的交互式终端继承 PATH,因此 uv 可能会因 spawn uv ENOENT 而失败。通过在 command 中使用 uv 的绝对路径来修复:
Homebrew —
/opt/homebrew/bin/uv(Apple Silicon) 或/usr/local/bin/uv(Intel)手动安装 — 在终端运行
which uv以查找路径
示例:
{
"mcpServers": {
"signal": {
"command": "/opt/homebrew/bin/uv",
"args": ["run", "--directory", "/absolute/path/to/mcp-signal", "signal-mcp", "serve"]
}
}
}架构
组件 | 描述 |
MCP 服务器 | Python/FastMCP,stdio 传输 |
读取路径 |
|
发送路径 | 按需启动的 |
状态 | 无独立缓存;直接从 Signal Desktop 数据读取 |
数据流
MCP 客户端通过 stdio 启动
signal-mcp serve。读取/搜索工具针对本地 Signal Desktop 数据库调用
signal-export。群组列表和出站发送调用
signal-cli -a ACCOUNT jsonRpc。结果以结构化 JSON 形式返回。
项目结构
mcp-signal/
src/mcp_signal/
config.py
main.py
reader.py
server.py
signal_cli.py
tests/
CLAUDE.md
LICENSE
README.md
SECURITY.md工具
工具 | 用途 |
| 从 Signal Desktop 列出直接聊天和群组聊天 |
| 读取特定聊天中的消息 |
| 在单个聊天或所有聊天中搜索消息 |
| 从 |
| 向直接收件人或群组发送文本消息 |
| 显示桌面数据库 / |
隐私与安全
无云端中继。无网络监听。所有数据保留在您的机器上。
读取/搜索仅使用您的本地 Signal Desktop 数据。
发送操作需要本地配置的
signal-cli账户。.env.local旨在用于存放本地机密(如SIGNAL_ACCOUNT),且不会被提交。signal-cli关联设备状态存储在它自己的本地应用数据目录中,位于此仓库之外,且不会被提交。
请参阅 SECURITY.md 了解如何报告漏洞。
限制
提示注入风险: 与许多 MCP 服务器一样,此服务器也受到 the lethal trifecta 的影响。恶意的传入消息可能会尝试指示代理窃取其他消息。请相应地对待工具界面,并在批准出站操作前进行审查。
混合后端: 聊天记录来自 Signal Desktop,而出站发送来自
signal-cli。无附件: 仅支持发送文本。
无实时通知: 仅支持轮询/读取。
每个 MCP 实例仅支持单个账户。
群组发送需要
signal-cli: 仅靠本地数据库读取无法提供安全发送到群组所需的信息。
开发
uv sync
uv run signal-mcp smoke
uv run pytest
uv run ruff check .故障排除
找不到
signal-cli— 确认signal-cli在PATH中,或在.env.local中设置SIGNAL_CLI_PATH。在 macOS 上,brew install signal-cli是最简单的方法。读取/搜索正常但发送失败 —
signal-cli未关联或未设置SIGNAL_ACCOUNT。运行signal-cli listAccounts进行验证,然后检查.env.local。signal-cli link挂起或失败 — 在当前版本中,请勿向link传递-a/--account参数。运行signal-cli link -n "signal-mcp"并从手机扫描二维码。MCP 客户端无法启动服务器 —
args必须包含仓库的绝对路径,而不是相对路径。如果uv本身因spawn uv ENOENT而失败,请参阅 macOS:uvPATH。未返回消息 — 确认已安装 Signal Desktop 并拥有消息历史记录。读取路径直接查询本地 Signal Desktop 数据库。
贡献
欢迎通过 Pull Request 贡献代码。请:
在推送前运行
uv run ruff check .。确保
uv run pytest通过。
请参阅 CLAUDE.md 了解完整的开发工作流。
许可证
MIT 许可证 — 请参阅 LICENSE。
Available Tools
9 toolschat_activityChat ActivityARead-onlyIdempotent
List Signal chats ranked by recent activity, showing last message date, last reply date, and count of unanswered inbound messages.
Read-only with no side effects. Use this to identify chats that need a response. Use list_chats instead for a general chat directory with message previews.
Inputs: limit. Returns: result
decrypt_attachmentDecrypt AttachmentA
Decrypt a locally stored Signal attachment and return the path to the decrypted file.
The encrypted_path and local_key values come from attachment metadata in read_messages or search_messages results. Read-only on Signal data; writes a decrypted copy to a temporary directory (the temp file is not auto-cleaned). Returns the absolute path to the decrypted file as a string on success, or a string starting with 'Error:' on failure (missing file, wrong key length, or HMAC mismatch). Use this after reading messages that contain attachments.
Inputs: local_key (required), encrypted_path (required). Returns: result
get_statusGet StatusARead-onlyIdempotent
Check whether the Signal MCP server can read local messages and send outbound messages.
Returns boolean fields: source_dir_exists, signal_cli_available, signal_account_configured, read_available, send_available. Read-only with no side effects. Call this before read or send operations to verify configuration; call pairing_status instead to check first-run device-linking state.
Inputs: no named parameters. Returns: object
list_chatsList ChatsARead-onlyIdempotent
List direct and group Signal chats from the local desktop database, sorted by most recent message.
Each result includes name, phone number, message count, and a preview of the last message. Read-only with no side effects. Use this to discover exact chat names before calling read_messages or search_messages. Use list_groups instead when you need group_id values for send_message.
Inputs: limit, query. Returns: result
list_groupsList GroupsARead-onlyIdempotent
List Signal groups with group_id, name, description, members, and admin lists, sorted alphabetically.
Read-only with no side effects. Queries signal-cli when available; falls back to the local desktop database (without group_id). Use this to obtain group_id values needed by send_message. Use list_chats instead for a combined view of both direct and group chats.
Inputs: limit, query. Returns: result
pairing_statusPairing StatusA
Report the Signal device-linking setup state for first-run pairing, so a client can surface the live link QR.
Returns a setup_state envelope: state 'ready' with the linked account once signal-cli is linked; 'awaiting_qr' with a 'qr_payload' sgnl://linkdevice URI to scan in Signal (Settings → Linked devices → Link new device) while a link is in progress (no payload yet on the first call, until the URI is captured); or 'error' when signal-cli is unavailable. Read-only from the caller's view, but the first call on an unlinked device starts a background signal-cli link process as a side effect. Poll this to drive a pairing UI; call get_status instead to check read/send availability once linked.
Inputs: no named parameters. Returns: object
read_messagesRead MessagesARead-onlyIdempotent
Read messages from a single Signal chat, returned newest-first.
Each message includes sender, date, body text, reactions, and attachment metadata. Read-only with no side effects. Requires an exact chat name from list_chats. Use search_messages instead to find messages by keyword across chats.
Inputs: chat_name (required), after, limit, before, +1 more. Returns: result
search_messagesSearch MessagesARead-onlyIdempotent
Search Signal message bodies for a keyword, within one chat or across all chats, returned newest-first.
Each result includes sender, date, chat name, body text, reactions, and attachment metadata. Read-only with no side effects. Use this to find messages by content. Use read_messages instead to browse a specific chat chronologically.
Inputs: query (required), limit, chat_name. Returns: result
send_messageSend MessageA
Send a text message via Signal to a direct recipient or group.
This is a write operation that delivers a real message through signal-cli. Sends are not reversible from this server — Signal supports user-initiated message deletion only via the official clients. Exactly one of phone_number, group_id, or chat_name must be supplied; providing zero or more than one raises an error. Rate-limited to 1 message per recipient per second and 10 messages per 60-second window globally. Requires signal-cli and SIGNAL_ACCOUNT to be configured — call get_status first to verify send_available is true. Returns target_type, target identifier, and timestamp on success.
Inputs: message (required), group_id, chat_name, phone_number. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Each tool has a narrow, distinct purpose, and descriptions explicitly route the agent elsewhere when overlap exists (e.g. chat_activity vs list_chats, read_messages vs search_messages, get_status vs pairing_status). The only natural overlap is list_chats also covering groups, but list_groups is clearly framed as the source of group_id values. An agent should never misselect here.
Most tools follow a clean verb_noun pattern (list_chats, read_messages, search_messages, send_message, decrypt_attachment). Two names deviate by dropping the verb (chat_activity, pairing_status), where get_ is implied by analogy with get_status. Minor and still readable.
Nine tools is well-scoped for a Signal read/send bridge: discovery, reading, search, activity triage, attachment decryption, diagnostic/pairing state, and one write path. No obviously redundant or filler tools.
Core lifecycle is covered: discover chats/groups, read and search messages, decrypt attachments, check configuration/pairing, and send text messages. Gaps remain on the write side — no sending attachments, no group creation/management, no message deletion — though these are reasonable scope limits rather than dead ends for the stated read-focused purpose.
Maintenance
Related MCP Connectors
Your own WhatsApp as an MCP server: read, search and send from any MCP client.
Hosted WhatsApp MCP server: send and read messages from your own linked number. OAuth sign-in.
MCP connector for iMessage & Contacts via a local Mac agent + Vercel relay
Unified messaging MCP server: WhatsApp, Instagram, Telegram, SMS, Messenger & email support inbox
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceMCP Server for retrieving Signal messages using signal-export logic.8-
- AlicenseAqualityAmaintenanceThe most complete Signal MCP server and CLI.8192 PyPI15MIT
- FlicenseNot gradedqualityDmaintenanceMCP server for Signal via signal-cli that enables sending and receiving messages, managing contacts and groups, and reacting over stdio.11 npm-
- AlicenseNot gradedqualityBmaintenanceMCP server for a local-first messaging workspace that integrates Google Messages, WhatsApp, and Signal. It enables reading, sending, searching messages, and managing conversations through MCP tools.73-