From c3733efea6529e82e20deef110029b979329c8b1 Mon Sep 17 00:00:00 2001 From: Ankitsinghsisodya Date: Sun, 24 May 2026 17:34:26 +0530 Subject: [PATCH 1/2] feat(mcp): add readonly mode check in buildHandler Implement a check in the buildHandler method to prevent build operations when the server is in readonly mode. This ensures that users are informed to enable write access before proceeding with builds, enhancing server state management. Signed-off-by: [Your Name] --- pkg/mcp/tools_build.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/mcp/tools_build.go b/pkg/mcp/tools_build.go index 52576187aa..bb0e3c643a 100644 --- a/pkg/mcp/tools_build.go +++ b/pkg/mcp/tools_build.go @@ -20,6 +20,11 @@ var buildTool = &mcp.Tool{ } func (s *Server) buildHandler(ctx context.Context, r *mcp.CallToolRequest, input BuildInput) (result *mcp.CallToolResult, output BuildOutput, err error) { + if s.readonly.Load() { + err = fmt.Errorf("the server is currently in readonly mode. Please set FUNC_ENABLE_MCP_WRITE and restart the client") + return + } + out, err := s.executor.Execute(ctx, "build", input.Args()...) if err != nil { err = fmt.Errorf("%w\n%s", err, string(out)) From 11b41e1041ba6019cc32646e61a50ded8719d7e3 Mon Sep 17 00:00:00 2001 From: Ankit sisodya <118156935+Ankitsinghsisodya@users.noreply.github.com> Date: Sun, 24 May 2026 17:39:45 +0530 Subject: [PATCH 2/2] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- pkg/mcp/tools_build.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/mcp/tools_build.go b/pkg/mcp/tools_build.go index bb0e3c643a..e1f6a6758f 100644 --- a/pkg/mcp/tools_build.go +++ b/pkg/mcp/tools_build.go @@ -21,7 +21,7 @@ var buildTool = &mcp.Tool{ func (s *Server) buildHandler(ctx context.Context, r *mcp.CallToolRequest, input BuildInput) (result *mcp.CallToolResult, output BuildOutput, err error) { if s.readonly.Load() { - err = fmt.Errorf("the server is currently in readonly mode. Please set FUNC_ENABLE_MCP_WRITE and restart the client") + err = fmt.Errorf("the server is currently in read-only mode; to enable write operations, set FUNC_ENABLE_MCP_WRITE in the server environment and restart the server") return }