Skip to content

feat(mcp): auto-generate and reuse local agent token - #88

Merged
benbenbang merged 1 commit into
mainfrom
feature/auto-mcp-token
Oct 11, 2026
Merged

benbenbang merged 1 commit into
mainfrom
feature/auto-mcp-token

Conversation

@benbenbang

Copy link
Copy Markdown
Member

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.

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
benbenbang enabled auto-merge (rebase) October 11, 2026 04:25
@github-actions github-actions Bot added documentation Improvements or additions to documentation triage labels Oct 11, 2026
@benbenbang
benbenbang merged commit f38de70 into main Oct 11, 2026
5 checks passed
@benbenbang
benbenbang deleted the feature/auto-mcp-token branch October 11, 2026 04:27
@ptah-bw-technical-app

Copy link
Copy Markdown

🎉 This PR is included in version 1.5.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Labels

documentation Improvements or additions to documentation released triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant