Add read-only mode for MCP tools in shared repositories#423
Conversation
…e mutation tools and updating initialization logging. Adjust MCPHandler to determine read-only status based on shared repository checks.
|
@claude please review this PR |
|
Claude finished @jfrench9's task in 1m 35s —— View job PR Review: Add read-only mode for MCP tools in shared repositories
Overall this is a clean, well-scoped change. The core logic is correct and the implementation is straightforward. A few observations below. What's GoodCorrect layering of read-only enforcement. The Implicit bug fix in # manager.py (old)
if self.create_workspace_tool is None:
return []would return an empty list even when Separation of concerns is maintained. The Issues1. self.build_fact_grid_tool = None
if env.FACT_GRID_ENABLED:
from .data_tools import BuildFactGridTool
self.build_fact_grid_tool = BuildFactGridTool(graph_client)The name "build" suggests a write/compute operation. If 2. Misleading error messages in When This is wrong — the real reason is if self.create_workspace_tool is None:
if self.read_only:
raise ValueError("create-workspace is not available: this graph is read-only.")
raise ValueError("create-workspace tool is not available. Set MCP_WORKSPACE_ENABLED=true.")3. Redundant After # handlers.py:153 (after _ensure_initialized)
is_shared_repo = is_shared_repository_or_subgraph(self.graph_id)
# Could be:
is_shared_repo = self.mcp_tools.read_onlyMinor efficiency nit — NitThe VerdictApprove with minor suggestions. The core behavior is correct, the bug fix in |
…duced a new method to generate context-aware error messages, improving code readability and maintainability. Updated existing error messages to utilize this new method for consistency.
Summary
Introduces read-only mode support for GraphMCPTools to prevent workspace mutation operations when accessing shared repositories. The MCP handler now evaluates whether a repository is shared and propagates that status to the tools manager, which conditionally restricts available tools accordingly.
Key Accomplishments
read_onlyflag. When enabled, workspace mutation tools (e.g., file creation, editing, deletion) are excluded from the available tool set, ensuring shared repositories remain unmodified.Breaking Changes
None. This is an additive behavioral change — repositories that are not shared continue to function with full read-write tool access as before.
Testing Notes
Infrastructure Considerations
🤖 Generated with Claude Code
Branch Info:
chore/remove-unused-mcp-tools-shared-repomainCo-Authored-By: Claude noreply@anthropic.com