MCP-313 Support SONARQUBE_TOOLSETS and SONARQUBE_READ_ONLY headers#235
MCP-313 Support SONARQUBE_TOOLSETS and SONARQUBE_READ_ONLY headers#235nquinquenel wants to merge 2 commits intomasterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds HTTP per-request tool visibility narrowing by honoring SONARQUBE_TOOLSETS and SONARQUBE_READ_ONLY headers via a wrapper around the MCP SDK stateless handler, plus documentation and tests.
Changes:
- Introduce
ToolsListFilteringHandlerto filtertools/listresults based on per-request headers while delegating all other methods unchanged. - Extend
HttpServerTransportProvidercontext extraction to include toolset/read-only headers and add a capturing transport to wrap the SDK handler after server build. - Update docs/README and add unit tests covering tool list filtering behavior.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/org/sonarsource/sonarqube/mcp/transport/ToolsListFilteringHandler.java | New handler that filters tools/list results using per-request context. |
| src/test/java/org/sonarsource/sonarqube/mcp/transport/ToolsListFilteringHandlerTest.java | Tests for toolset/read-only filtering and delegation behavior. |
| src/main/java/org/sonarsource/sonarqube/mcp/transport/HttpServerTransportProvider.java | Extract new headers into context; add capturing transport and install filter hook. |
| src/main/java/org/sonarsource/sonarqube/mcp/SonarQubeMcpServer.java | Use capturing transport and install the tools/list filter after server build. |
| src/main/java/org/sonarsource/sonarqube/mcp/configuration/McpServerLaunchConfiguration.java | Expose header/env-var names for use in transport layer. |
| docs/http-authentication-architecture.md | Document per-request tool filtering and updated flow/headers. |
| README.md | Document per-request headers for narrowing tool visibility in HTTP(S) mode. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/main/java/org/sonarsource/sonarqube/mcp/transport/HttpServerTransportProvider.java
Outdated
Show resolved
Hide resolved
src/main/java/org/sonarsource/sonarqube/mcp/transport/ToolsListFilteringHandler.java
Show resolved
Hide resolved
src/main/java/org/sonarsource/sonarqube/mcp/transport/ToolsListFilteringHandler.java
Outdated
Show resolved
Hide resolved
58b7fe5 to
571c2b7
Compare
SonarQube reviewer guideSummary: Add per-request HTTP header filtering for MCP tools, allowing clients to narrow the visible toolset and enable read-only mode on individual requests without expanding server-level restrictions. Review Focus:
Start review at:
|




No description provided.