Skip to content

Secure credential storage for HTTP MCP OAuth tokens #2783

Description

@SqlBenjamin

Describe the feature or problem you'd like to solve

The Copilot CLI currently persists OAuth access and refresh tokens as plaintext JSON files on disk (~/.copilot/mcp-oauth-config/*.tokens.json) when authenticating to HTTP-based MCP servers. This introduces several security concerns:

  1. Plaintext exposure - Tokens stored as unencrypted JSON can be read by any process or user with filesystem access. This violates the principle of least privilege for credential storage.
  2. Cloud sync risk - Many enterprise users sync their home directory or profile folders via OneDrive, Dropbox, or similar tools. Plaintext tokens in synced directories get uploaded to cloud storage, expanding the attack surface and triggering DLP/security policy violations.
  3. Credential persistence - File-based tokens survive beyond their intended session lifetime. If a machine is compromised, an attacker gains access to cached tokens without needing to re-authenticate.
  4. Inconsistency with VS Code - VS Code already handles MCP OAuth tokens securely through the OS Secret Storage API (Windows Credential Manager, macOS Keychain, libsecret on Linux). The CLI should follow the same pattern for consistency and security.

Proposed solution

Leverage the OS-native credential/secret manager on each platform rather than writing tokens to disk. This aligns with security best practices, avoids DLP policy conflicts, and provides a consistent security posture across the Copilot toolchain.

Example prompts or workflows

No response

Additional context

No response

Activity

  1. added
    area:mcpMCP server configuration, discovery, connectivity, OAuth, policy, and registry
    area:authenticationLogin, OAuth, device auth, token management, and keychain integration
    and removed on Apr 17, 2026
  2. SqlBenjamin commented on Jun 4, 2026

    @SqlBenjamin
    Author

    I believe this may only be an issue with mcp servers that use oauth options. JFYI

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

    area:authenticationLogin, OAuth, device auth, token management, and keychain integrationarea:mcpMCP server configuration, discovery, connectivity, OAuth, policy, and registry

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions