Scope MCP server reads to the calling application and seed optional tool inputs with null

Merged
AB
15h ago
+232-13

What

Two follow-ups from the review of #29668.

  • mcpServers and mcpServer reads now only return servers whose application the caller can reach (canCallerReachApplication with the read operation, like the logic function, front component and agent reads). An application token sees its own servers; sessions, API keys and the workspace custom application see all of them. The reads still need no permission flag, since the workflow picker lists from them, as will the upcoming MCP servers settings page, and the catalog exposes no secrets. Mutations are unchanged behind API_KEYS_AND_WEBHOOKS.
  • Optional tool inputs are seeded with null instead of [] or the first enum value, through getDefaultMcpToolInputFromJsonSchema in twenty-shared, both when the server builds the step from the picker and when the editor merges the tool's schema into saved settings. Every field of the schema shows in the form, and an unset optional value is an explicit null that the server strips before calling the tool. Required fields get [] for arrays, the first value for enums, and null otherwise. Required fields inside an optional object stay null, so an untouched optional object is left out of the call.

Test

  • getDefaultMcpToolInputFromJsonSchema unit spec: required fields get their default, optional ones null, and required fields inside an optional object stay null.
  • Step operations spec: a picker-created MCP_TOOL step stores null for an untouched optional input. It fails against the old seeding.
  • Typecheck, lint and unit tests green in CI on server, front and shared.