claude-code-setup
v1.0.2
Published
Export Claude Code credentials for Docker/CI usage
Maintainers
Readme
claude-code-setup
Export and configure Claude Code credentials for Docker/CI usage.
Usage
On your host machine: Export credentials
npx claude-code-setup env > .envThis extracts your Claude Code OAuth credentials from:
- macOS Keychain (if on macOS)
~/.claude/.credentials.json(fallback)
In Docker: Generate config files
npx claude-code-setupThis reads environment variables and generates:
~/.claude/.credentials.json- OAuth credentials~/.claude.json- Config with/workspacepre-trusted
Environment Variables
| Variable | Required | Description |
|----------|----------|-------------|
| CLAUDE_OAUTH_ACCESS_TOKEN | Yes | OAuth access token |
| CLAUDE_OAUTH_REFRESH_TOKEN | Yes | OAuth refresh token |
| CLAUDE_OAUTH_EXPIRES_AT | No | Token expiration timestamp |
⚠️ SECURITY WARNING
These environment variables contain sensitive OAuth credentials that provide full access to your Claude account.
- DO NOT commit
.envfiles to version control- DO NOT share these credentials with others
- DO NOT expose them in logs, screenshots, or public repositories
Add
.envto your.gitignorefile to prevent accidental commits.
Example
See the example/ directory for a complete Docker setup:
# Export credentials
npx claude-code-setup env > example/.env
# Build and run
./example/run.shOr manually:
docker build -t claude-code-example example/
docker run -it --rm --env-file example/.env -v $(pwd):/workspace claude-code-exampleLicense
MIT
