Files
mcp-sonarqube-proxy/pyproject.toml
T
marcus d76c16d9a7 feat(auth): forward SONARQUBE_TOKEN to upstream as Bearer header
The upstream MCP container requires a SonarQube user token in the
Authorization header. Without one, every call returns 401.

- proxy: read SONARQUBE_TOKEN via sonarqube_token() at session-open
  time; raise TokenMissingError when unset/blank. upstream_session()
  attaches the token as "Authorization: Bearer <token>" via
  streamablehttp_client(headers=...).
- cli: fail fast in serve and check with a clear stderr message and
  exit 1 when the token is missing, before any network attempt. All
  exception text written to stderr passes through _redact() so an
  accidentally-leaked token from a third-party exception is replaced
  with [REDACTED] before display.
- The token is never stored on any object, never logged, and the
  TokenMissingError message contains no token material (it only
  describes how to generate one in SonarQube).
- Tests: header forwarding via mocked streamablehttp_client, missing-
  token exit code, redaction in CLI error paths, whitespace stripping
  on the token. Total: 25 tests.
- Docs: README/CLAUDE updated with the new env-var, Claude Desktop
  config snippet, and the security guarantees. CHANGELOG added.

Bumps version to 0.2.0.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 20:42:51 +02:00

44 lines
856 B
TOML

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "mcp-sonarqube-proxy"
version = "0.2.0"
description = "Stdio MCP server that proxies tools from an upstream SonarQube MCP server over streamable HTTP."
readme = "README.md"
requires-python = ">=3.12"
license = { text = "MIT" }
authors = [
{ name = "Marcus" },
]
dependencies = [
"mcp>=1.27.0,<2",
"click>=8.1",
"anyio>=4.0",
]
[project.scripts]
mcp-sonarqube-proxy = "mcp_sonarqube_proxy.cli:main"
[dependency-groups]
dev = [
"ruff>=0.1",
"pytest>=8.0",
"pytest-asyncio>=0.23",
]
[tool.hatch.build.targets.wheel]
packages = ["src/mcp_sonarqube_proxy"]
[tool.ruff]
line-length = 100
target-version = "py312"
[tool.ruff.lint]
select = ["E", "F", "I", "UP", "B"]
[tool.pytest.ini_options]
asyncio_mode = "auto"
testpaths = ["tests"]