Claude Code Config File Location (2026)
TL;DR: Global settings live at
~/.claude/settings.json. Project settings at.claude/settings.jsonin your repo root. MCP servers are configured separately in~/.claude.json(user scope) or.mcp.json(project scope).
The Problem
You need to customize Claude Code’s behavior but are unsure where configuration files are stored, or your changes to settings are not taking effect.
Why This Happens
Claude Code uses a layered configuration system with multiple file locations. Settings are merged in order of precedence, and changes to the wrong file is overridden by a higher-priority source.
The Fix
Step 1 — Understand the Configuration Hierarchy
Claude Code reads settings from these locations, in order of precedence (highest first):
| Priority | Location | Scope |
|---|---|---|
| 1 | CLI flags | Current session only |
| 2 | ~/.claude/settings.local.json |
Local (machine-specific, not committed) |
| 3 | .claude/settings.json |
Project (committed to repo) |
| 4 | ~/.claude/settings.json |
User (all projects) |
Note: Enterprise deployments may also have a “Managed” policy layer that sits above CLI flags and cannot be overridden by users.
Step 2 — Find Your Config Files
# User settings (applies to all projects)
ls -la ~/.claude/settings.json
# Local settings (machine-specific overrides, not committed)
ls -la ~/.claude/settings.local.json
# Project settings (from your repo root, committed to version control)
ls -la .claude/settings.json
# MCP server config — user scope
ls -la ~/.claude.json
# MCP server config — project scope
ls -la .mcp.json
# Memory files
ls -la ~/.claude/CLAUDE.md
ls -la CLAUDE.md
# Credentials (macOS uses Keychain, Linux uses this file)
ls -la ~/.claude/credentials.json
Step 3 — Edit User Settings
# Create the directory if needed
mkdir -p ~/.claude
# Edit settings
${EDITOR:-nano} ~/.claude/settings.json
Common user settings (~/.claude/settings.json):
{
"defaultMode": "acceptEdits",
"skipDangerousModePermissionPrompt": false,
"permissions": {
"allow": [
"Bash(git *)",
"Read(*)"
],
"deny": [
"Bash(rm -rf *)"
]
},
"hooks": {
"PreToolUse": [],
"PostToolUse": []
}
}
Valid
defaultModevalues:default(plan/ask mode),acceptEdits(auto-accept file edits),fullAuto(no prompts).
Step 4 — Edit Project Settings
# From your project root
mkdir -p .claude
${EDITOR:-nano} .claude/settings.json
Common project settings (.claude/settings.json):
{
"permissions": {
"allow": [
"Bash(npm test)",
"Bash(npm run build)"
]
}
}
Step 5 — Configure MCP Servers
MCP servers are not configured inside settings.json. They have their own dedicated config files:
- User scope (
~/.claude.json): MCP servers available in all projects. - Project scope (
.mcp.jsonin your repo root): MCP servers for a specific project, committed to version control.
User-scoped MCP config (~/.claude.json):
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/home/user"]
}
}
}
Project-scoped MCP config (.mcp.json):
{
"mcpServers": {
"project-db": {
"command": "node",
"args": ["./tools/mcp-server.js"]
}
}
}
Step 6 — Configure Memory Files
Claude Code reads CLAUDE.md files for persistent context:
# Global memory (loaded in every session)
cat > ~/.claude/CLAUDE.md << 'EOF'
# Global Preferences
- I prefer TypeScript over JavaScript
- Always use pnpm as package manager
- Follow NASA Power of 10 coding rules
EOF
# Project memory (loaded when in this project)
cat > CLAUDE.md << 'EOF'
# Project: My App
- This is a Next.js 14 app with App Router
- Database: PostgreSQL via Prisma
- Tests: Vitest + Playwright
EOF
Step 7 — Verify Settings Are Loaded
# Use /config command inside Claude Code to see active settings
claude
> /config
Common Variations
| Scenario | Cause | Quick Fix |
|---|---|---|
| Settings not taking effect | Wrong file location | Check both user and project paths |
| MCP servers not loading | Config placed in settings.json instead of ~/.claude.json or .mcp.json |
Move MCP config to the correct file |
| Project MCP servers not found | Running Claude from a different directory | Use absolute paths in MCP server command args |
/config freezes terminal |
Known bug in v2.1.104 | Do not run /config twice; restart session |
| Settings reset after update | npm reinstall overwrites defaults | Settings files are not overwritten by updates |
Prevention
- Version control project settings: Commit
.claude/settings.json,CLAUDE.md, and.mcp.jsonso all team members share the same config. - Use
settings.local.jsonfor machine-specific overrides: This file is not committed to version control and sits above project settings in priority. - Use environment variables for secrets: Never put API keys in settings files; use
ANTHROPIC_API_KEYandGITHUB_TOKENenv vars.
Configure it → Build your MCP config with our MCP Config Generator.
Related Issues
Configure permissions → Build your settings with our Permission Configurator.
- Set Up MCP Servers in Claude Code — MCP configuration details
- Claude Code Permission Modes Explained — Permission configuration
- Claude Code Install Guide — Browse all setup guides
Last verified: 2026-04-15. Found an issue? Open a GitHub issue.
- Claude Desktop config.json guide — How to configure Claude Desktop with config.json
See Also
Try it: Paste your error into our Error Diagnostic for an instant fix.
- Claude Code Config YAML Parse Error — Fix (2026)
- Config File JSON Parse Error — Fix (2026)
- XDG Config Directory Permissions Fix
- Configuration Reference. Complete Claude Code settings and configuration guide