From 0c54c83a977f9e59edbc0f5a1ec8f1ef3c28ab3b Mon Sep 17 00:00:00 2001 From: "elvandlie@gmail.com" Date: Tue, 12 May 2026 19:56:59 +0700 Subject: [PATCH] cmd/mcp: pass WithReadonly at construction to fix instructions desync The MCP server instructions were computed at New() time before Start() set the readonly flag. This meant the readonly warning was never included in instructions sent to MCP clients, even when the server was running in readonly mode. Pass WithReadonly(!writeEnabled) at construction time so the instructions correctly reflect the runtime readonly state. Signed-off-by: elvandlie@gmail.com --- cmd/mcp.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/mcp.go b/cmd/mcp.go index 53222092c0..b634250286 100644 --- a/cmd/mcp.go +++ b/cmd/mcp.go @@ -112,7 +112,9 @@ func runMCPStart(cmd *cobra.Command, args []string, newClient ClientFactory) err // Instantiate client, done := newClient(ClientConfig{}, - fn.WithMCPServer(mcp.New(mcp.WithPrefix(cmdPrefix)))) + fn.WithMCPServer(mcp.New( + mcp.WithPrefix(cmdPrefix), + mcp.WithReadonly(!writeEnabled)))) defer done() // Start