Skip to content

refactor: hide the three credential-migration MCP tools from agent sessions that can never call them, and say who may #3435

Closed

Description

@vybe

Summary

Two MCP tools for moving agent credentials between instances, import_credentials and get_credential_encryption_key, are reported to fail on every recorded call. If that holds, the documented way to move an agent's credentials from one instance to another does not work through the MCP surface.

Context

An operations audit of MCP tool calls found no successful call to either tool. This has not been reproduced on current dev, so the first step is to reproduce. Both tools are defined in src/mcp-server/src/tools/agents.ts; their access entries are in src/mcp-server/src/access.ts.

The pair matters together: export_credentials produces an encrypted file, get_credential_encryption_key supplies the key to carry out of band, and import_credentials loads the file on the target. A migration that depends on this flow cannot complete if the last two steps fail.

Acceptance Criteria

  • Each tool is exercised on current dev with a user-scoped key and with an agent-scoped key, and the result is recorded on this issue
  • If a tool fails for a caller that is meant to have access, it is fixed and covered by a test that calls it end to end against the backend route
  • If the failure is an intended access refusal, the tool's description and error message say who may call it, and it is not listed for callers who can never use it
  • An export on one agent followed by an import on another round-trips a credential set
  • If either tool is judged not worth keeping, it is removed from the catalog and the credential-migration docs are updated to the supported path

Technical Notes

  • The audit data cannot distinguish a broken request from a permission refusal; access.ts marks import_credentials admin-only, which may explain part of it.

Activity

  1. added
    status-readyGreenlit and ready for development (vetted; counterpart to status-incubating)
    on Oct 9, 2026
  2. changed the title [-]bug: import_credentials and get_credential_encryption_key MCP tools are reported failing on every call[/-] [+]refactor: hide the three credential-migration MCP tools from agent sessions that can never call them, and say who may[/+] on Oct 9, 2026
  3. added
    complexity-lowComplexity: low (board points 1-3)
    and removed on Oct 9, 2026
  4. vybe commented on Oct 9, 2026

    @vybe
    ContributorAuthor

    Diagnosis and ruling (operator, 2026-10-09). Not a defect. Static trace of import_credentials, export_credentials and get_credential_encryption_key from the MCP tool through to the backend routes found the path, method, body, auth header and response parsing all correct. Calls from an agent-scoped key are refused by design: import and export are owner-or-admin and human-only, and the key route is admin-only. A user-scoped owner or admin key passes. An audit with no successful call is therefore the expected shape when only agents tried.

    Ruled: keep all three tools; list them only for user and system sessions, state in each description who may call it, and return a backend refusal as a typed denial. No backend change and no change to who can read an encryption key. Retitled and relabelled accordingly. The live exercise (admin, non-admin and agent keys, plus an export → import round trip between two agents) is required before merge.

  5. vybe commented on Oct 9, 2026

    @vybe
    ContributorAuthor

    Draft PR: #3484 — the three tools are listed only for user and system sessions, descriptions say who may call them, no backend change. Reviewed MERGEABLE. Before merge: the live exercise (three key types × three tools, results recorded here) and one export → import round trip between two agents.

  6. removed
    status-readyGreenlit and ready for development (vetted; counterpart to status-incubating)
    on Oct 12, 2026
  7. removed
    status-in-devMerged to dev, awaiting release cut to main
    on Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions