Repository navigation
feat(mcp): auto-generate and reuse local agent token - #88
Merged
Merged
Conversation
Previously `jevwise mcp` required an explicit agent bearer token via `JEVWISE_MCP_TOKEN` or `--token-file`. Now, when no token override is supplied, the server generates a random 256-bit token stored privately in `<runtime-dir>/agent.token` and reuses it across restarts, so only the upstream API key needs manual setup. **New capability:** * `jevwise mcp` ensures an automatic token when no environment value or `--token-file` override is present, validating the provider and API key before creating it, and preparing the default cache parent on fresh accounts. * Added `jevwise mcp token-path` to print only the automatic token file path without reading secrets, creating files, or reporting explicit overrides. * Override precedence is preserved: `--token-file` > `JEVWISE_MCP_TOKEN` (and aliases) > automatic token, and explicit values are never copied into the automatic file. **Tests:** * Added `managed_token_test.go` covering automatic token resolution. * Updated background process tests to assert the runtime retains only `agent.token` after stop rather than being empty. **Docs:** * Updated README, `docs/mcp.md`, and `docs/mcp-agents.md` to describe automatic token generation, storage permissions, rotation, and loading the token via `token-path`.
benbenbang
enabled auto-merge (rebase)
October 11, 2026 04:25
|
🎉 This PR is included in version 1.5.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Previously
jevwise mcprequired an explicit agent bearer token viaJEVWISE_MCP_TOKENor--token-file. Now, when no token override is supplied, the server generates a random 256-bit token stored privately in<runtime-dir>/agent.tokenand reuses it across restarts, so only the upstream API key needs manual setup.New capability:
jevwise mcpensures an automatic token when no environment value or--token-fileoverride is present, validating the provider and API key before creating it, and preparing the default cache parent on fresh accounts.jevwise mcp token-pathto print only the automatic token file path without reading secrets, creating files, or reporting explicit overrides.--token-file>JEVWISE_MCP_TOKEN(and aliases) > automatic token, and explicit values are never copied into the automatic file.Tests:
managed_token_test.gocovering automatic token resolution.agent.tokenafter stop rather than being empty.Docs:
docs/mcp.md, anddocs/mcp-agents.mdto describe automatic token generation, storage permissions, rotation, and loading the token viatoken-path.