0.10.1: erlaubte HTTP-Hosts per MCP_ALLOWED_HOSTS statt fester LAN-Adresse; LICENSE ergänzt
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f40ae55671
commit
208067766a
10 files changed
+64
-6
No files matched your search
@@ -4,6 +4,13 @@ All notable changes to `syncthing-blade-mcp` will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
||||
|
||||
## [0.10.1] - 2026-11-23
|
||||
|
||||
### Changed
|
||||
|
||||
- Allowed HTTP hosts are configurable via `MCP_ALLOWED_HOSTS` instead of a
|
||||
hard-coded LAN address; LICENSE file added (MIT, as stated in the README).
|
||||
|
||||
## [0.10.0] - 2026-11-23
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2026 Piers Dawson-Damer / Groupthink (original syncthing-blade-mcp)
|
||||
Copyright (c) 2026 Michael Roll (fork additions)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -310,6 +310,12 @@ Bearer token auth (`MCP_AUTH_TOKEN`) secures the endpoint; `/health` is unauthen
|
||||
}
|
||||
```
|
||||
|
||||
## Allowed hosts (HTTP transport)
|
||||
|
||||
The Streamable HTTP transport only accepts requests whose `Host` header is
|
||||
`localhost`, `127.0.0.1` or `[::1]`. Add LAN names or addresses with
|
||||
`MCP_ALLOWED_HOSTS`, a comma-separated list such as `192.168.1.10:*,nas.lan:*`.
|
||||
|
||||
## Running Tests
|
||||
|
||||
```bash
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "syncthing-blade-mcp"
|
||||
version = "0.10.0"
|
||||
version = "0.10.1"
|
||||
description = "MCP server for Syncthing — token-efficient replication management, multi-instance, safe disk-space reclamation."
|
||||
requires-python = ">=3.11"
|
||||
dependencies = [
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
"""Syncthing MCP Server — manage Syncthing instances via MCP tools."""
|
||||
|
||||
__version__ = "0.10.0"
|
||||
__version__ = "0.10.1"
|
||||
@@ -337,7 +337,7 @@ class AddDeviceInput(WriteParams):
|
||||
device_id: str = Field(..., description=_DEVICE_ID_HELP, min_length=1)
|
||||
name: str = Field(..., description="Friendly device name", min_length=1)
|
||||
addresses: list[str] | None = Field(
|
||||
None, description="Optional addresses, e.g. ['tcp://192.168.1.20:22000']. Default: dynamic."
|
||||
None, description="Optional addresses, e.g. ['tcp://192.0.2.20:22000']. Default: dynamic."
|
||||
)
|
||||
confirm: bool = Field(False, description=_CONFIRM_DESCRIPTION)
|
||||
|
||||
|
||||
@@ -130,6 +130,20 @@ def compute_domain_hints_for_records(
|
||||
return out
|
||||
|
||||
|
||||
def _allowed_hosts() -> list[str]:
|
||||
"""Host headers accepted by the HTTP transport (DNS-rebinding protection).
|
||||
|
||||
Always localhost; extra hosts come from ``MCP_ALLOWED_HOSTS`` as a comma list,
|
||||
e.g. ``MCP_ALLOWED_HOSTS=192.168.1.10:*,nas.lan:*``.
|
||||
"""
|
||||
hosts = ["localhost:*", "127.0.0.1:*", "[::1]:*"]
|
||||
for item in os.environ.get("MCP_ALLOWED_HOSTS", "").split(","):
|
||||
item = item.strip()
|
||||
if item and item not in hosts:
|
||||
hosts.append(item)
|
||||
return hosts
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
async def app_lifespan(app):
|
||||
import sys
|
||||
@@ -162,7 +176,7 @@ mcp = FastMCP(
|
||||
json_response=True,
|
||||
transport_security=TransportSecuritySettings(
|
||||
enable_dns_rebinding_protection=True,
|
||||
allowed_hosts=["192.168.1.2:*", "localhost:*", "127.0.0.1:*", "[::1]:*"],
|
||||
allowed_hosts=_allowed_hosts(),
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name: syncthing-blade-mcp
|
||||
version: "0.10.0"
|
||||
version: "0.10.1"
|
||||
description: "Syncthing replication management MCP — multi-instance, token-efficient output, safe disk-space reclamation"
|
||||
author: groupthink-dev
|
||||
license: MIT
|
||||
|
||||
@@ -214,3 +214,12 @@ class TestJsonSafeTruncate:
|
||||
data = json.loads(out)
|
||||
assert isinstance(data["items"], list)
|
||||
assert "truncated" in data
|
||||
|
||||
|
||||
def test_allowed_hosts_from_env(monkeypatch):
|
||||
from syncthing_mcp import server
|
||||
|
||||
monkeypatch.delenv("MCP_ALLOWED_HOSTS", raising=False)
|
||||
assert server._allowed_hosts() == ["localhost:*", "127.0.0.1:*", "[::1]:*"]
|
||||
monkeypatch.setenv("MCP_ALLOWED_HOSTS", " 192.168.1.10:*, nas.lan:* ,,localhost:*")
|
||||
assert server._allowed_hosts()[-2:] == ["192.168.1.10:*", "nas.lan:*"]
|
||||
Reference in new issue
Block a user