claude_desktop_config.json Guide: Where to Put the API Key, Custom Base URL, and Common Fixes
Author: CodeGateway Team | Published: 2026-10-27 | Reading time: 2 minutes 中文原文(完整版):https://www.codegateway.dev/blog/claude-desktop-config-json-guide
Short version: claude_desktop_config.json does one job — configuring MCP servers. It has no apiKey field and no baseURL field, so the key and the custom base URL do not go in that file. To connect Claude Desktop to a third-party inference provider, the real entry point is developer mode: you enter the base URL and the key as a pair in the inference window.
The full guide is published in Chinese as the primary version — it walks through every field of the file, shows copy-paste ready examples, and lists the six most common errors with their fixes.
What the Chinese version covers
Where the config file lives on macOS and Windows, and what a valid
mcpServersblock looks like.Field by field: what each MCP server entry accepts, and which fields simply do not exist in this file.
Six recurring errors (invalid JSON, server not starting, wrong transport, missing env vars, permission failures) and how to fix each one.
Point Claude Desktop at CodeGateway instead
No official key, or you would rather not bind an overseas card? Sign up on CodeGateway and a key is issued to you — then enter the gateway base URL and that key in developer mode:
Getting started: https://www.codegateway.dev/docs/quick-setup-claude-code
Billing and how usage is charged: https://www.codegateway.dev/docs/billing-guide
Model catalog and per-model pricing: https://www.codegateway.dev/models
Related guide (developer mode + proxy, in Chinese): https://www.codegateway.dev/blog/claude-desktop-developer-mode-api-proxy
Sources
MCP configuration reference: https://modelcontextprotocol.io/
Claude Desktop developer mode: https://www.codegateway.dev/tools/config-generator