Repository navigation
Description
Summary
The documented artemis mcp --transport sse --host ... --port ... path crashes at startup with mcp >= 1.29: mcp_server/server.py forwards host/port to FastMCP.run(), which no longer accepts them. The MCP server therefore cannot be bound to a LAN address at all, and there is no supported workaround inside the repo.
Environment
- Artemis:
351ca84(main, 2026-09-28), installed editable in a venv - Python: 3.13.5, Debian 13 (headless server, no IDE on the host)
mcp: 1.29.0 (pulled bymcp>=1.26.0inpyproject.toml)
Reproduction
uv sync --dev
uv run artemis mcp --transport sse --host 0.0.0.0 --port 8001artemis mcp --help advertises all three options:
--transport <str> MCP transport protocol ('stdio' or 'sse'). [default: stdio]
--host <str> Host address when running with SSE transport. [default: 127.0.0.1]
--port -p <int> Port number when running with SSE transport. [default: 8001]
Expected
The server listens on 0.0.0.0:8001 and answers initialize with serverInfo.
Observed
TypeError: FastMCP.run() got an unexpected keyword argument 'host'
Root cause
mcp_server/server.py:93-100:
def main(transport: str = "stdio", host: str = "127.0.0.1", port: int = 8001):
...
mcp.run(transport="sse", host=host, port=port)In mcp 1.29.0 the signature is:
FastMCP.run(self, transport: Literal['stdio','sse','streamable-http'] = 'stdio',
mount_path: str | None = None) -> Nonehost/port moved to FastMCP.settings (defaults 127.0.0.1:8000). Verified on the installed package:
>>> inspect.signature(FastMCP.run)
(self, transport: "Literal['stdio', 'sse', 'streamable-http']" = 'stdio', mount_path: 'str | None' = None) -> 'None'
>>> FastMCP("t").run(transport="sse", host="0.0.0.0", port=8001)
TypeError: FastMCP.run() got an unexpected keyword argument 'host'Because pyproject.toml pins mcp>=1.26.0 without an upper bound, a fresh install is always broken on this path.
Second blocker once host/port are fixed
Binding a non-loopback address still fails the DNS-rebinding guard of mcp 1.29: TransportSecuritySettings.allowed_hosts only whitelists loopback by default, so a LAN client gets 403 Invalid Host header. Any fix needs to extend allowed_hosts for the requested host, not disable the protection.
Impact
The MCP server can only be used over stdio, i.e. with an IDE/agent running on the same machine as Artemis. It cannot be reached over the network — which is exactly the headless / remote-device topology described in #102.
Workaround used
A launcher outside the repo sets the settings and then runs the transport, leaving Artemis sources untouched:
import sys
sys.path.insert(0, "/opt/artemis")
from mcp_server.base import mcp
from mcp.server.transport_security import TransportSecuritySettings
mcp.settings.host = "0.0.0.0"
mcp.settings.port = 8001
hosts = ["0.0.0.0:*", "0.0.0.0", "127.0.0.1:*", "localhost:*", "<lan-ip>:*", "<hostname>:*"]
mcp.settings.transport_security = TransportSecuritySettings(
enable_dns_rebinding_protection=True,
allowed_hosts=hosts,
allowed_origins=[f"http://{h}" for h in hosts],
)
mcp.run(transport="streamable-http")This works, but it is a hack that must be re-validated after every upgrade and that keeps the project from being usable headless out of the box.
Suggested fix
Make --host/--port write to mcp.settings before calling run(), keep run(transport=...) argument-free, and extend transport_security.allowed_hosts/allowed_origins with the requested host when it is not loopback. A minimal, version-safe helper:
mcp.settings.host = host
mcp.settings.port = port
if host not in ("127.0.0.1", "localhost"):
ts = mcp.settings.transport_security
ts.allowed_hosts += [f"{host}:*", host]
ts.allowed_origins += [f"http://{host}:*", f"http://{host}"]
mcp.run(transport=transport)Guarding mcp.run() kwargs on inspect.signature would additionally keep mcp 1.26–1.28 working.
Activity