Skip to content

feat: Add support for Bearer token (access token) authentication#68

Open
egorpavlikhin wants to merge 1 commit intomainfrom
egorp/user-token-auth
Open

feat: Add support for Bearer token (access token) authentication#68
egorpavlikhin wants to merge 1 commit intomainfrom
egorp/user-token-auth

Conversation

@egorpavlikhin
Copy link
Copy Markdown
Contributor

Summary

  • Adds support for short-lived access tokens (Bearer tokens) as an alternative to API key authentication
  • New CLI option --access-token / -t and environment variable OCTOPUS_ACCESS_TOKEN
  • Access token takes precedence when both credentials are provided
  • The @octopusdeploy/api-client SDK already supports this via the accessToken property on ClientConfiguration

Note: Bearer token auth is intended only for automated scenarios (CI/CD pipelines, orchestration, machine-to-machine workflows) where the issued token is short-lived.

Files changed

  • src/helpers/getClientConfigurationFromEnvironment.ts — Core auth logic supporting both credential types
  • src/index.ts — New --access-token CLI option
  • src/helpers/errorHandling.ts — Updated auth error messages
  • src/tools/__tests__/testSetup.ts — Test config supports access tokens
  • README.md — New Authentication section documenting both methods
  • .env.example — Documents OCTOPUS_ACCESS_TOKEN

Test plan

  • npm run build compiles cleanly
  • Start server with --access-token flag and verify it connects
  • Set OCTOPUS_ACCESS_TOKEN env var and verify it connects
  • Provide neither API key nor access token — verify clear error message
  • Provide both — verify access token is used

🤖 Generated with Claude Code

The MCP server now supports short-lived access tokens as an alternative
to API keys, intended for automated scenarios such as CI/CD pipelines
and machine-to-machine workflows.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant