localsend-mcp

localsend-mcp

Enables sending files to LocalSend devices on the local network by scanning for devices and sending files using the LocalSend v2 protocol.

Category
访问服务器

README

LocalSend MCP

localsend-mcp gives MCP clients tools for moving files across your local network with LocalSend.

It exposes:

  • localsend_scan: scan the LAN for LocalSend devices.
  • localsend_send: send explicit absolute file paths to a LocalSend target.
  • localsend-mcp-inbox: optional LocalSend-compatible receiver for collecting logs or small files.

The server uses the LocalSend v2 protocol directly with Python standard-library networking. No cloud relay is used.

Security Warning

This MCP lets an authorized AI client request file transfers from your computer. Only install it in MCP clients you trust.

Safety controls:

  • Sends require explicit absolute file paths.
  • The server does not scan your folders to choose files.
  • You can restrict sends and receives to trustedDevices.
  • The inbox receiver is opt-in.
  • The inbox receiver saves files only to a configured inbox directory.
  • The inbox receiver echoes only small text-like files.
  • This project transfers files; it does not run commands from other devices.

Requirements

  • Python 3.10 or newer.
  • LocalSend running on the target device.
  • Both devices on the same local network.

Optional:

  • localsend-cli on PATH, or LOCALSEND_CLI=/absolute/path/to/localsend-cli, as a fallback sender.

Install

From a local checkout:

python3 -m pip install -e .

Then configure your MCP client:

{
  "mcpServers": {
    "localsend": {
      "command": "localsend-mcp"
    }
  }
}

Without installing, you can run the server by path:

{
  "mcpServers": {
    "localsend": {
      "command": "python3",
      "args": ["/path/to/localsend-mcp/src/localsend_mcp/server.py"]
    }
  }
}

Recommended Safe Setup

First scan for LocalSend devices:

{
  "name": "localsend_scan",
  "arguments": {
    "timeout": 3
  }
}

Copy the trusted device alias and fingerprint into:

~/.config/localsend-mcp/config.json

Example:

{
  "trustedDevices": [
    {
      "alias": "Wise Blackberry",
      "fingerprint": "A9702925B0CA2BB48F5B851F82AC4013FB23AB996E3682F24D225A1C7F7C530F"
    }
  ],
  "inboxDir": "~/Downloads/localsend-mcp-inbox"
}

If trustedDevices is empty or omitted, the server allows discovered targets. For regular use, configure trusted devices.

Set a custom config path with:

export LOCALSEND_MCP_CONFIG=/path/to/config.json

You can also manage trusted devices through MCP:

{
  "name": "localsend_trust_device",
  "arguments": {
    "target": "Wise Blackberry"
  }
}
{
  "name": "localsend_list_trusted",
  "arguments": {}
}
{
  "name": "localsend_untrust_device",
  "arguments": {
    "alias": "Wise Blackberry"
  }
}

Sending Files

Send to a trusted alias:

{
  "name": "localsend_send",
  "arguments": {
    "target": "Wise Blackberry",
    "files": ["/home/me/Downloads/report.pdf"]
  }
}

Send to a known URL:

{
  "name": "localsend_send",
  "arguments": {
    "target": "https://192.168.1.50:53317",
    "files": ["/home/me/Pictures/image.png"],
    "pin": "123456"
  }
}

If the receiving LocalSend app is still finishing the previous transfer, localsend_send retries busy-session responses by default:

{
  "name": "localsend_send",
  "arguments": {
    "target": "Wise Blackberry",
    "files": ["/home/me/file.txt"],
    "busy_retry_seconds": 90,
    "busy_retry_interval": 3
  }
}

For phones or sleeping devices, opt into waiting for the target to come online:

{
  "name": "localsend_send",
  "arguments": {
    "target": "Rich Broccoli",
    "files": ["/home/me/file.txt"],
    "queue_if_offline": true,
    "queue_wait_seconds": 300,
    "queue_retry_interval": 5
  }
}

If the target is an iPhone or Android device, open LocalSend and keep the app awake while the queued send waits.

Optional Inbox Receiver

Start a receiver:

localsend-mcp-inbox

It advertises itself on LocalSend as Codex MCP Inbox by default and saves received files to:

~/Downloads/localsend-mcp-inbox

Change the alias:

LOCALSEND_INBOX_ALIAS="My MCP Inbox" localsend-mcp-inbox

Change the inbox directory:

localsend-mcp-inbox --dir ~/Desktop/mcp-inbox

For best compatibility with the LocalSend mobile apps, run the inbox on the default LocalSend port with HTTPS:

localsend-mcp-inbox --port 53317 --protocol https

This generates a local self-signed certificate under ~/.config/localsend-mcp/ if one does not already exist. Do not run the desktop LocalSend app on the same machine at the same time if it also needs port 53317.

Protocol request logs are quiet by default. For debugging:

localsend-mcp-inbox --port 53317 --protocol https --verbose

When trustedDevices is configured, the inbox rejects upload requests from untrusted senders.

List recent inbox files:

{
  "name": "localsend_inbox_list",
  "arguments": {
    "limit": 10
  }
}

Read the latest small text/log file:

{
  "name": "localsend_inbox_read",
  "arguments": {
    "path": "latest"
  }
}

localsend_inbox_read refuses to read outside the configured inbox and rejects binary or oversized files.

Safe Chat Mode

Chat mode treats trusted text files received in the inbox as remote prompts. It is not an autonomous command daemon: the MCP client still reads the prompt, decides what to do, and explicitly replies.

Get the latest unread trusted prompt:

{
  "name": "localsend_chat_next_text",
  "arguments": {}
}

For a simple success response, send Done and mark the prompt handled:

{
  "name": "localsend_chat_done",
  "arguments": {
    "prompt_id": "<prompt id from localsend_chat_next_text>"
  }
}

For a custom response, reply to the sender and mark the prompt handled:

{
  "name": "localsend_chat_reply",
  "arguments": {
    "prompt_id": "<prompt id from localsend_chat_next>",
    "text": "Done"
  }
}

Chat replies do not wait in a long offline queue by default. If the phone or receiver is not accepting files, the reply is saved under the chat outbox, the prompt is marked handled, and the agent should stop instead of retrying in a loop. Only set queue_if_offline: true for chat replies when the user explicitly wants the session to wait.

Use localsend_chat_next instead of localsend_chat_next_text only when full sender metadata is needed.

Mark a prompt handled without replying:

{
  "name": "localsend_chat_mark_done",
  "arguments": {
    "id": "<prompt id>"
  }
}

Chat mode requires sender metadata written by localsend-mcp-inbox. It only returns trusted text prompts by default; configure trustedDevices before relying on it.

LocalSend Tips

  • LocalSend discovery uses UDP multicast 224.0.0.167:53317.
  • Some networks block multicast; direct IP or URL targets may be more reliable.
  • LocalSend HTTPS uses self-signed certificates. This server accepts those certificates for LAN transfers.
  • LocalSend Quick Save or auto-save can avoid manual receive prompts, but enable it only for devices you trust.

Troubleshooting

No LocalSend device matched alias

Run localsend_scan, confirm both devices are on the same network, and make sure LocalSend is open.

For phones, use queue_if_offline: true and open LocalSend when you are ready to receive. Mobile operating systems may suspend LocalSend when the screen is off or the app is backgrounded.

Refusing to send to untrusted LocalSend device

Add the device alias, IP, or fingerprint to trustedDevices.

Blocked by another session

The receiver is busy with a prior LocalSend transfer. The sender retries by default, but enabling LocalSend auto-save on trusted devices helps.

Read operation timed out

The receiver may be waiting for user approval or the network may be blocking the transfer. Accept the transfer in LocalSend or increase timeout.

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选