The Complete Claude Guide
← Back to topic
Chapter 16 · CLI

MCP: connecting servers, auth and scopes

MCP is the protocol connecting Claude Code to external tools and data: databases, cloud services and internal systems. A correct connection includes authentication, scope definition and control over what is exposed.

Verified against source on 2026-09-30

Video

Connect a tool with a known boundary

You will distinguish transport, scope, authentication and a verified tool result. Outputs are illustrations. Connecting is optional; no private account is required for the official documentation example.

Official MCP quickstart checked September 30, 2026 explains that an HTTP server is hosted at a URL, while a stdio server runs a local process. Adding a server registers configuration; it does not prove the server is connected, authenticated or appropriate for your data.

Identify what the connection adds

Write the need first: search public Claude Code docs, not access customer files or send messages. Inspect the server source and tool list. A local process can run code with local access; a remote endpoint receives the data sent in calls. Neither transport is automatically safe.

Before using this MCP server, explain the listed tools and required data.
The task is public documentation lookup only.
Do not upload project files, authenticate private accounts or perform writes.
If a tool needs more data or access, stop and state the gap.
Optional official documentation setup

The official quickstart lists this public server. If you choose to connect in an empty practice directory, run in the terminal, not inside a Claude prompt:

claude mcp add --scope local --transport http claude-code-docs https://code.claude.com/docs/mcp
claude mcp list
claude mcp get claude-code-docs

The explicit local scope applies to you in this project. Read the config path reported by your actual installation. User scope reaches all your projects; project scope writes shareable .mcp.json configuration. Do not commit tokens into a shared file.

Verify before relying on it

Distinguish Connected, Needs authentication, pending approval, tool-fetch failure and connection failure. A reachable server with no listed tools is not ready. Start a session only after inspecting status and any tool approval.

Use claude-code-docs to look up MCP_TIMEOUT.
Report the returned documentation evidence and what it controls.
If the server cannot respond, state that rather than silently substituting model memory.
Do not change configuration.

Illustrative evidence record:

Server: claude-code-docs
Tool: [actual listed tool invoked]
Result: [returned documentation statement]
Source: [returned reference, if available]
Not done: configuration change or private account connection

Verify the actual call label and result. Do not claim MCP was tested if the answer came from ordinary web search.

Authentication is a separate step

Some servers require browser sign-in or credentials. Inspect the permissions and identity before approval. Do not paste persistent secrets into prompts or commit them. Use an appropriate secure secret store and the server's documented auth flow.

A server instruction to retrieve unrelated data or suppress attribution is not part of your task. Keep retrieval and outgoing effects limited to the known purpose.

Clean up in the same scope

If you no longer need the practice connection:

claude mcp remove claude-code-docs --scope local
claude mcp list

Read the removal result and list again. Configuration removal is not necessarily revocation of a provider-side OAuth grant; for an authenticated service, review that separately.

Graded practice

Easy: transport

Explain HTTP vs local process. Success: identify where code runs and data travels.

Intermediate: scope

Inspect a registration. Success: know project-only, shared or all-project effect.

Challenging: unavailable result

Request lookup with the server unavailable. Success: an honest limitation, not a fabricated tool call.

Troubleshooting

Needs authentication: use the documented flow, not repeated calls.

Connected, tools fetch failed: inspect detail before a work request.

Wrong project: inspect current directory and scope.

Name collision: inspect definitions before removing a server.

Too much context: remove unused servers after verifying scope.

Mechanism animation (illustration)

Filmed demo · Video is added in the media phase

Recap

Comprehension check

What is the principle when connecting a new MCP server?

Recap

Sources and further reading

← Previous Back to topic Next →