Configuring Claude Code
20 Jun 2025
•
Patrick Debois
Tired of configuring Claude Code by hand? We got you covered
While Claude code is a terminal CLI, it surprisingly took me some time to automate the configuration. Sharing my experiences here as it can be useful for people scripting it on CI/CD systems or other scripts.
Note: I’ll be using the linux commands and syntax here
The recommended Installation is easy:
npm install -g @anthropic-ai/claude-code
This installs the claude
command globally. Now the fun can begin!
Claude Max or API Key setup
As part of the manual setup you need to choose between a Claude Max subscription or the Claude API. For both it starts an OAuth flow which is not easy to automate regardless of if you have the ANTHROPIC_API_KEY
configured in your shell.
Through this Reddit post I came across the use of an ApiKeyHelper which allows Claude Code to get the keys from a script. We simply have it output the env var of our existing API Key. We’ll configure this script further in the settings.
Claude config vs settings.json
The CLI has a simple claude config
command, which manages things into ~/.claude/claude.json
. I found it to be a bit buggy at times and it seems the team is deprecating this command anyway.
Therefore we write a skeleton to ~/.claude.json
ourselves:
shiftEnterKeyBindingInstalled
configures the ask for terminal installhasCompletedOnboarding
indicates configuration is doneset the theme to dark here
We also configure the trust of our API key, the syntax seems to be the last 20 characters of your API_KEY
Now we can configure the API Key Helper we set up earlier. We do this after the skeleton otherwise it would be overwritten.
claude config set --global apiKeyHelper ~/.claude/anthropic_key_helper.sh
Trust & Onboarding
The next step is to get rid of the ask if we want to trust Claude Code on the current directory and also avoid having the onboarding wizard popup:
claude config set hasTrustDialogAccepted true
claude config set hasCompletedProjectOnboarding true
Setting up MCP servers
Claude Code has good support for MCP, now even for remote MCP servers.
The example mostly show the use of claude mcp add
I tend to use the add-json
option as it makes things a lot more configurable. Also I tend to run the npx install
or docker pull
before adding the mcp server because there is no progress output when Claude runs it for you.
Also note that the file ~/.claude/claude.json
now may contain sensitive secrets. Make sure to set the right permissions if you are on a shared system.
Here’s an example of installing the mcp puppeteer container:
docker pull mcp/puppeteer
Setting permissions
When the Claude Code agent is running, it by default asks you if you approve various commands and if you want to save the decision. This is how you can set up the permissions for different tools. Note that mcp servers use the mcp__ prefix for it.
claude config add allowedTools "Edit,Bash"
claude config add allowedTools "mcp__puppeteer"
Claude VScode Extension
Claude Code has a VSCode extension that you can install in your favorite IDE. It is not available through the regular VSCode extension marketplace but is part of the npm install of the package. We can manually install it after we’ve downloaded it.
Note that this will not work in devcontainer postCreate, it needs to be executed inside a terminal. I set it up in a .bashrc that gets executed on first shell execution.
Interesting (undocumented settings)
I’m sure there are many but as Claude Code is not opensource it’s hard to guess. The most interesting I found was parallelTasksCount that seems to control the number of subtasks Claude Code works on, helpful if you want to unleash even more power. Have you discovered others? Let us know!
claude config set --global parallelTasksCount 3
Handy env vars
And finally Claude Code has a lot of environment variables you can configure. Here’s the most interesting for setting up a build environment, like setting timeouts and disabling telemetry.
Pfffew - DevOps Experience
Setting up Claude Code feels a bit like being the first DevOps on Mars. While everyone’s raving about agentic UX, some of us are just trying to get it to work in CI. Hopefully this guide saves you a few hours. Feel free to fork my claude_code_init script gist and share your setup tips!