Skip to content

Code mode: saved code tools (McpTool endpointMapping.method = 'code') #1363

Closed

Description

@helpcodeai

Summary

Saved code tools: a tool whose endpointMapping.method = 'code' runs a stored program through the code-runner instead of calling one upstream endpoint. Depends on #1361 and the schema issue.

Scope

  • Execution: a code branch in DynamicMcpTools.executeTool / executeWithEngine (dynamic-mcp-tools.ts, next to the static branch) that calls CodeExecutorService with a bridge scoped to the tool's uses connectors and the caller's role. Fields on endpointMapping: code, uses: [{connectorId, tools}], runAs: 'invoker' | 'definer' (definer = admin-only, stored-procedure semantics), allowWrites.
  • Read/write: a code tool's own annotation derives from allowWrites; writes are only allowed in an admin-approved code tool, never inline.
  • Tool editor: add code to METHODS_BY_TYPE and an editor panel (code + uses + runAs + allowWrites). Reuse assertCanWriteConnector (VIEWER blocked; owner/ADMIN only) and the secret guard.
  • Offered only on servers whose connectors cover all uses. ToolRoleAccess, isEnabled, audit toolId, export/import work unchanged because it is an McpTool.
  • Agent proposal: code_propose_tool → pending KgSkillSuggestion kind code → ADMIN approval.

Governance

Respect McpServerConfig.codeMode; policy never read from tool args; shared-endpoint exclusions reused; assertEnterprise for definer/writes where the plan gate requires it (see the gating issue).

Activity

  1. helpcodeai commented on Oct 31, 2026

    @helpcodeai
    ContributorAuthor

    Implemented (commits 6d872de, 700ad0d): saved code tools (endpointMapping.method = 'code') with the bridge enforcing uses/read-write/invoker-vs-definer and no nested code tools; save-time validation and authority gates (definer = admin, allowWrites = Enterprise, uses must be same-workspace); the Code tool type in the editor (en/it/de); and exclusion from the shared /mcp endpoint. Remaining: the agent-proposal flow (code_propose_tool → pending kind='code' suggestion → admin materializes it into an McpTool) needs extra columns to store the proposed code/uses, so it will come as its own schema change/issue; and a richer connectors picker in the editor (today it takes the uses list as JSON).

  2. helpcodeai commented on Oct 31, 2026

    @helpcodeai
    ContributorAuthor

    Delivered in PR #1366 (merged into main as be4742a). Code mode ships off by default; the agent-proposal follow-up is tracked in #1369, and the Cloud runner operations in this issue remain operational/out-of-repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions