Skip to content

[FEATURE]: {cmd:} config placeholder for credential helpers #12710

Closed as duplicate

Description

@taulfsime

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Config placeholder for credential helpers

Problem Im soving

Currently, config files support {env:VAR} and {file:path} placeholders for injecting values. However, there's no way to securely fetch credentials from credential managers like macOS Keychain, 1Password,
pass, or custom credential helpers (like git credential helpers).

Users who want to configure MCP server authentication must either:
- Hardcode tokens in config files (insecure)
- Store tokens in environment variables (requires manual setup)
- Store tokens in plain text files (insecure)

Solution

A {cmd:command} placeholder that executes a shell command and uses its stdout (trimmed) as the value. This enables integration with any credential manager or helper that can output secrets to stdout.

Use Cases

 macOS Keychain:
 Authorization: Bearer {cmd:security find-generic-password -s mcp-token -w}

 1Password CLI:
 Authorization: Bearer {cmd:op read op://vault/mcp-api/token}

 pass (password-store):
 Authorization: Bearer {cmd:pass show api/token}

 Custom credential helper (git-style host:token format):
 Authorization: Bearer {cmd:grep '^api.example.com:' ~/.credentials | cut -d: -f2}

 Encrypted secrets:
 Authorization: Bearer {cmd:openssl enc -aes-256-cbc -d -a -pass pass:$KEY -pbkdf2 -in secret.enc}

Example

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "internal-api": {
      "type": "remote",
      "url": "https://api.internal.example.com/mcp",
      "headers": {
        "Authorization": "Bearer {cmd:security find-generic-password -s mcp-token -w}"
      }
    }
  }
}

I already have working implementation, if this is accepted I can open a PR.

Activity

  1. added
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    on Feb 8, 2026
  2. github-actions commented on Feb 8, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if none of these address your specific case.

  3. malikwirin commented on Apr 9, 2026

    @malikwirin

    How do the {file:path} placeholders work?

  4. assigned and unassigned on Apr 26, 2026
  5. removed
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    on May 3, 2026
  6. kfox1111 commented on Jun 5, 2026

    @kfox1111

    Would love to be able to use this. Static credentials are problematic and it would be great to solve it by plugging in one of our existing dynamic identity generators such as spire or k8s projected service account tokens.

  7. laiweihwa commented on Jun 12, 2026

    @laiweihwa

    What is the main blocker for this?

  8. tthoma24 commented on Aug 3, 2026

    @tthoma24

    +1 would use this. Not sure why the PR was just auto closed and never reviewed.

  9. tkoop commented on Sep 26, 2026

    @tkoop

    This is a good idea. We should do this. I would up-vote this if I could.

  10. neriousy commented on Oct 1, 2026

    @neriousy
    Member

    Closing as a duplicate of #7487, which tracks running a command in config variable substitution (for example to fetch credentials from a helper). Please add your use case and 👍 there.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions