Skip to content
explainroo
Working with AI agents

How to Use MCP Servers in Claude Code

Updated 3 min read

With explainroo How to Prompt a Coding Agent to Make an Explainer Video
On this page
  1. Add a server from the command line
  2. Check the connection and use its tools
  3. Limit access and credentials
  4. Fix common connection problems

When you use Claude Code on a repository, an MCP server gives Claude access to tools or information outside the repository, such as a code-hosting service or an external API. MCP stands for Model Context Protocol, an open standard for connecting AI tools to services and data. An MCP server exposes capabilities for Claude Code to use. Claude Code connects to the server as a client.

To add a server, run claude mcp add with the server’s name and connection details. Then check the connection in Claude Code and ask Claude to use one of the server’s tools. Give the server only the permissions the task requires.

Add a server from the command line

Choose a server from a provider you trust. Follow the provider’s instructions for configuring the transport and authentication. Use the address and command it specifies. Claude Code supports local servers launched as processes and remote servers reached over HTTP. The command syntax depends on the type:

# Local server launched as a process
claude mcp add --transport stdio --scope project <name> -- <command> <arguments>

# Remote server reached over HTTP
claude mcp add --transport http --scope project <name> <server-url>

Replace the placeholders with the values supplied by the server provider. The -- in the local command separates Claude Code options from the server command and its arguments. Claude Code also supports SSE transport for compatible servers. The Claude Code MCP command overview describes the available transports and setup pattern.

With the project scope, Claude Code stores the server configuration in a .mcp.json file at the project root. Claude Code loads that project configuration when you open the project. Use this scope when the connection belongs to that repository, and keep credentials out of committed project files. For a server you want available across projects, use the user scope instead.

Check the connection and use its tools

After you add a server, run claude mcp list in a terminal to see which servers Claude Code has configured. In Claude Code, use /mcp to inspect MCP connections and complete any required authentication. If the server is connected, ask Claude for a task that clearly calls for one of its capabilities, such as checking an issue or retrieving information from a connected service.

MCP servers describe the tools they offer, including what each tool does and the inputs it needs. Claude uses those descriptions to decide whether a tool fits the request. Start with a read-only task. Confirm that Claude reaches the right server and uses the expected tool before you grant permission to make changes.

Limit access and credentials

An MCP server gives Claude another way to access your data and services. Give it a read-only role when reading is enough, and use a token restricted to the specific resources the server needs. Store secrets outside the repository and avoid granting write access unless the task requires it.

Review server configuration before trusting it. A malicious tool description can instruct Claude to take unintended actions. Information from one server can also influence how Claude interacts with another. The MCP security analysis discusses tool poisoning, cross-server prompt injection, and configuration risks. Connect only servers you trust, and remove servers you no longer need.

Keep the tool list focused, too. Each server adds tools for Claude to consider, so overlapping or unnecessary servers make tool selection harder. Before installing a server, check whether Claude Code already provides the capability you need.

Fix common connection problems

If Claude Code cannot connect, compare the server’s name and transport with the provider’s instructions. Check the address and command against those instructions as well. For a local server, confirm that the command exists on your machine and that required environment variables are available. A missing executable often produces an ENOENT error. For a remote server, verify the URL and authentication details.

If the configuration looks correct, run the server command outside Claude Code. Check the MCP logs for startup or JSON-RPC errors. The MCP troubleshooting reference covers configuration checks, manual testing, and common connection failures.

Free and open source

Let your AI agent make the video

explainroo lets a coding agent like Claude Code or Codex make narrated explainer videos and product demos. The voice, the word timing and the rendering run on your own computer, with no API key and no cost per video. Optional outside services use your own key.

Copy this into your AI agent

Make me a short explainer video about [your topic]. Use explainroo for it: run npx --yes explainroo docs and follow what it prints.

Getting started Example videos GitHub

Made with explainroo: How explainroo makes a video

More on working with ai agents

All guides on working with ai agents