Clients, Hosts, MCP Inspector and Debugging
The host is the AI application. It creates one MCP client per server, owns consent and approvals, and decides how tools reach the model. Know how the main hosts are configured (Claude Desktop, Claude Code, VS Code), how to debug a server that will not connect, how to use the MCP Inspector (web, CLI and TUI) and its security model, and the client best practices for scaling to many servers: progressive discovery, prompt caching and code mode.
Key points
- 1
Claude Desktop reads
claude_desktop_config.jsonfrom~/Library/Application Support/Claude/on macOS or%APPDATA%\Claude\on Windows. Servers go undermcpServers, keyed by name, withcommand,argsand optionalenv. Fully quit and restart after any change; closing the window is not enough. Remote servers are added in Claude as Custom Connectors (Settings > Connectors > Add custom connector), then authenticated, usually with OAuth. - 2
Claude Desktop logs live in
~/Library/Logs/Claudeor%APPDATA%\Claude\logs.mcp.logcovers connections and failures, andmcp-server-NAME.logholds that server's stderr (all of its logging, not just errors). Stdio servers get an undefined working directory (possibly/) and only a limited set of environment variables, so use absolute paths and put the variables a server needs inenv. - 3
Claude Code:
claude mcp add --transport http <name> <url>adds a remote server, andclaude mcp add [options] <name> -- <command> [args]adds a stdio server.--separates Claude Code's options from the server command.claude mcp list,getandremovemanage servers,/mcp(orclaude mcp login) runs OAuth, andclaude mcp add-from-claude-desktopimports Claude Desktop entries. - 4
Claude Code scopes: local (the default;
~/.claude.jsonunder the current project, private), project (.mcp.json, committed, needs approval before first use) and user (~/.claude.json, all projects). Precedence runs local > project > user > plugin > claude.ai connectors, and the whole entry from the winning source is used, with no field merging. Organisation-managed servers rank above all of them. - 5
Claude Code's
.mcp.jsonexpands${VAR}and${VAR:-default}incommand,args,env,urlandheaders. An unset variable without a default stays literal and triggers a warning. Claude Code's own and cloud credentials read as empty in remoteurlandheaders, to stop exfiltration. An entry with aurlbut notypeis read as stdio and skipped, so add"type": "http". - 6
VS Code's
.vscode/mcp.jsonusesservers(notmcpServers) plus an optionalinputsarray. ApromptStringinput withpassword: true, referenced as${input:id}, prompts once and stores the secret securely, so shared files hold no credentials. - 7
MCP Inspector (
npx @modelcontextprotocol/inspector, Node 22.19+) is one package with three clients: web (default),--cliand--tui. The web backend can spawn processes, so/api/*needs a per-launch token, it binds127.0.0.1by default, andDANGEROUSLY_OMIT_AUTHremoves the guard. Tabs: Console (stdio stderr), Network (HTTP), Protocol (JSON-RPC), plus Tools, Resources, Prompts, Tasks and Apps when the server supports them. - 8
Inspector CLI:
--method tools/list|tools/call|resources/read|prompts/get,--format jsonforjq, and exit codes 3 (auth required), 4 (unreachable), 5 (tool error or tool not found) with a JSON error line on stderr.--stored-auth-onlymakes CI fail fast instead of opening a browser. The CLI treats everything after--as Inspector options, while web and TUI pass it to the server.--configis read-only;--catalogis the writable server list. - 9
Inspector protocol era is set per server:
legacy(the default, plaininitialize),auto(probeserver/discover, then fall back) ormodern(pin 2026-07-28). Secrets go to the OS keychain, or else to~/.mcp-inspector/secrets.json, which is plaintext unless keyed. Stdio servers run as you, with an environment allowlist plus theirenv. - 10
Host and client duties: one client and connection per server, which isolates failures. Disambiguate colliding tool names with a host-controlled server prefix, never
serverInfo.name. Keep prefixed names within 128 characters. Confirm sensitive operations, show inputs before calling, validate results before the model sees them, and passisErrorresults back to the model rather than raising. An agent loop keeps calling the model until it stops requesting tools. - 11
Client best practices: switch to progressive discovery (a
search_toolsmeta-tool, then fetch full schemas) once definitions pass a threshold such as 1 to 5% of the context window. Group tools by server, cache definitions, and re-index onlist_changed. Preserve prompt caching by appending new tools after the cache breakpoint or routing calls through a stablecall_toolmeta-tool. Connect servers on demand, and disconnect only at conversation boundaries. - 12
Code mode (programmatic tool calling): the host turns tool schemas into typed functions in a sandbox that has no network and no credentials. The broker routes calls as
tools/calland still applies per-call authorization. Treat cross-server data as untrusted, set time and memory limits, filter output, and convertisErrorinto exceptions.
Common traps
Pasting a Claude Desktop
mcpServersblock into VS Code'smcp.json, which expectsservers.Using relative paths, or relying on shell-exported variables, in a host config. The host's working directory and environment differ from your terminal's.
Closing the Claude Desktop window instead of quitting it, then concluding that the config is broken.
Assuming project
.mcp.jsonservers connect silently. Interactive Claude Code asks for approval first, and a cloned repository cannot approve its own servers.Writing
"url"without"type"in Claude Code JSON config: the entry is read as stdio and skipped.Exposing the Inspector with a bare
docker -p 6274:6274,0.0.0.0orDANGEROUSLY_OMIT_AUTH. The backend can spawn processes as you.Treating a script approval in code mode as blanket approval for every tool call the script makes.
Expecting the Inspector to speak 2026-07-28 by default. Its default protocol era is
legacy.
Read the source
Further reading
Suggest a resourceNo extra reading for Clients, Hosts, MCP Inspector and Debugging yet. Found a guide, video or cheat sheet that made it click? Share it and help the next learner.
Test yourself on Clients, Hosts, MCP Inspector and Debugging
Ten questions, with the answer and explanation after each one.