feat: separate token acquisition and application #21
+432
−21
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
feat: separate token acquisition and application (addressing #20)
Add support for a flexible authentication via the TokenSource option, letting you choose where API tokens come from. It allows explicit control over where authentication tokens are obtained: client, server, both, or none, making authentication behavior clearer and more adaptable to different ways of obtaining and passing tokens.
The current default mode is Hybrid (TokenSource.Both), which first attempts to use a token provided by the MCP client and automatically falls back to server-managed authentication when no client token is available. This provides maximum flexibility while remaining fully backward compatible with existing configurations.
Additional modes include Server-managed authentication, where MCPify exclusively handles OAuth flows, token storage, and refresh; Client-managed authentication, where the MCP client is responsible for acquiring and supplying tokens; and No authentication, for public APIs. Together, these options reduce duplicate auth logic, improve interoperability with MCP clients, and make authentication intent explicit per external API.