diff --git a/.mcp.json b/.mcp.json index 9e977ee..1550631 100644 --- a/.mcp.json +++ b/.mcp.json @@ -6,8 +6,6 @@ "run", "-i", "--rm", - "--entrypoint", - "torproxy", "hapheus/torproxy:latest", "mcp" ] diff --git a/CHANGELOG.md b/CHANGELOG.md index c80c85e..5f72956 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [2.7.7] — 2026-11-13 + +### Fixed +- **mcp**: Support standalone stdio MCP mode (`mcp` / `torproxy mcp`) directly in `docker/start.sh` with daemon logs routed to `stderr`, and remove `--entrypoint torproxy` from `.mcp.json`, `smithery.yaml`, and `docs/mcp.md` (#147, #148) + ## [2.7.6] — 2026-11-12 ### Changed @@ -248,7 +253,8 @@ Sprint 1 security & contract correctness release. --- -[Unreleased]: https://github.com/hapheus/torproxy/compare/v2.7.6...HEAD +[Unreleased]: https://github.com/hapheus/torproxy/compare/v2.7.7...HEAD +[2.7.7]: https://github.com/hapheus/torproxy/compare/v2.7.6...v2.7.7 [2.7.6]: https://github.com/hapheus/torproxy/compare/v2.7.5...v2.7.6 [2.7.5]: https://github.com/hapheus/torproxy/compare/v2.7.4...v2.7.5 [2.7.4]: https://github.com/hapheus/torproxy/compare/v2.7.3...v2.7.4 diff --git a/docker/Dockerfile b/docker/Dockerfile index fbd43c1..64b6c8a 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -7,7 +7,7 @@ ARG PYTHON_VERSION=3.14 LABEL org.opencontainers.image.title="torproxy" \ org.opencontainers.image.description="A minimal HTTP proxy routed through Tor" \ - org.opencontainers.image.version="2.7.6" \ + org.opencontainers.image.version="2.7.7" \ org.opencontainers.image.licenses="MIT" \ org.opencontainers.image.source="https://github.com/hapheus/torproxy" \ org.opencontainers.image.url="https://github.com/hapheus/torproxy" \ diff --git a/docker/start.sh b/docker/start.sh index f2e8042..8d72321 100644 --- a/docker/start.sh +++ b/docker/start.sh @@ -1,6 +1,13 @@ #!/usr/bin/env bash set -Eeuo pipefail +mcp_mode=0 +if [ "${1:-}" = "mcp" ] || { [ "${1:-}" = "torproxy" ] && [ "${2:-}" = "mcp" ]; }; then + mcp_mode=1 + # Preserve original stdout on FD 3 for JSON-RPC while routing all daemon logs to stderr. + exec 3>&1 1>&2 +fi + validate_configuration() { python3 -m torproxy.runtime.configure --check } @@ -39,6 +46,11 @@ su tor -s /bin/sh -c 'chmod 0750 /var/lib/tor' 2>/dev/null || true su privoxy -s /bin/sh -c 'exec privoxy --no-daemon /tmp/privoxy.config' & privoxy_pid=$! +if [ "$mcp_mode" -eq 1 ]; then + su torproxy -s /bin/sh -c 'exec torproxy mcp' >&3 3>&- + exit $? +fi + su torproxy -s /bin/sh -c 'exec python3 -m torproxy' & api_pid=$! diff --git a/docs/mcp.md b/docs/mcp.md index c1b31ae..17d83ba 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -81,7 +81,7 @@ The repository includes a root-level `.mcp.json` automatically detected by Curso "mcpServers": { "torproxy": { "command": "docker", - "args": ["run", "-i", "--rm", "--entrypoint", "torproxy", "hapheus/torproxy:latest", "mcp"] + "args": ["run", "-i", "--rm", "hapheus/torproxy:latest", "mcp"] } } } diff --git a/docs/releases.md b/docs/releases.md index 679443c..f4c3fd5 100644 --- a/docs/releases.md +++ b/docs/releases.md @@ -91,6 +91,10 @@ If an upgraded image exhibits unexpected behavior in your environment: ## 6. Release Notes +### 2.7.7 (Standalone stdio MCP mode in container entrypoint) + +- **Standalone Stdio MCP Container Mode (#147, PR #148):** Updated `docker/start.sh` to detect `mcp` or `torproxy mcp` arguments, route setup/Tor/Privoxy logs to `stderr` while keeping `stdout` strictly for JSON-RPC, and launch `torproxy mcp` with Tor and Privoxy running in the background. Removed `--entrypoint torproxy` from `.mcp.json`, `smithery.yaml`, and `docs/mcp.md`. + ### 2.7.6 (Developer Experience, Behavioral Psychology & Documentation Optimization) - **Documentation & DX Optimization (#144, #145):** Restructured `README.md`, `DOCKERHUB.md`, and `/docs` using developer psychology, cognitive load reduction (Hick's Law), and progressive disclosure. Added instant 2-step verification, zero-clone `docker run` quickstarts, honest boundaries ("When to use / when not to use"), explicit fail-closed guarantees, and rapid-navigation matrices across `docs/api.md` and `docs/configuration.md`. diff --git a/pyproject.toml b/pyproject.toml index 06b4a8b..6a79b7b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "torproxy" -version = "2.7.6" +version = "2.7.7" description = "A minimal HTTP and SOCKS5 proxy routed through the Tor network with local REST control API" readme = "README.md" requires-python = ">=3.10" diff --git a/server.json b/server.json index 515d6f7..ead42b2 100644 --- a/server.json +++ b/server.json @@ -3,7 +3,7 @@ "name": "io.github.hapheus/torproxy", "title": "torproxy", "description": "Tor HTTP and SOCKS5 proxy with REST API and built-in MCP server.", - "version": "2.7.6", + "version": "2.7.7", "repository": { "url": "https://github.com/hapheus/torproxy", "source": "github" @@ -11,7 +11,7 @@ "packages": [ { "registryType": "oci", - "identifier": "docker.io/hapheus/torproxy:2.7.6", + "identifier": "docker.io/hapheus/torproxy:2.7.7", "transport": { "type": "stdio" }, diff --git a/smithery.yaml b/smithery.yaml index e945744..66efb54 100644 --- a/smithery.yaml +++ b/smithery.yaml @@ -14,8 +14,6 @@ startCommand: "run", "-i", "--rm", - "--entrypoint", - "torproxy", ...(config?.torproxyApiToken ? ["-e", `TORPROXY_API_TOKEN=${config.torproxyApiToken}`] : []), "hapheus/torproxy:latest", "mcp" diff --git a/tests/unit/test_contracts.py b/tests/unit/test_contracts.py index a17198b..4c52fcc 100644 --- a/tests/unit/test_contracts.py +++ b/tests/unit/test_contracts.py @@ -342,8 +342,6 @@ def test_mcp_auto_discovery_manifests_contract(self): "run", "-i", "--rm", - "--entrypoint", - "torproxy", "hapheus/torproxy:latest", "mcp", ] @@ -357,7 +355,14 @@ def test_mcp_auto_discovery_manifests_contract(self): assert "configSchema:" in smithery_content assert "commandFunction:" in smithery_content assert "hapheus/torproxy:latest" in smithery_content - assert "--entrypoint" in smithery_content + assert "--entrypoint" not in smithery_content + + def test_start_script_supports_mcp_standalone_mode(self): + start_sh_path = os.path.join(DOCKER_DIR, "start.sh") + with open(start_sh_path, "r", encoding="utf-8") as f: + start_sh = f.read() + assert "torproxy mcp" in start_sh + assert "mcp" in start_sh def test_compiled_artifacts_ignored_everywhere(self): # ISSUE-16: no .pyc/__pycache__ may leak into the repo or the image. diff --git a/uv.lock b/uv.lock index 46fc4dc..50d9b95 100644 --- a/uv.lock +++ b/uv.lock @@ -842,7 +842,7 @@ wheels = [ [[package]] name = "torproxy" -version = "2.7.6" +version = "2.7.7" source = { editable = "." } [package.optional-dependencies]