Tips & tricks9 min read

MCP: Model Context Protocol - Tips

SFEIR Institute•

TL;DR

The Model Context Protocol (MCP) connects Claude Code to external tools - GitHub, browsers, databases - via an open standard. Here are 18 tips organized by theme to configure, secure, and leverage your MCP servers on a daily basis. Each tip is directly applicable in session.

The Model Context Protocol (MCP) connects Claude Code to external tools (GitHub, browsers, databases) via an open standard. Here are 18 tips organized by theme to configure, secure, and leverage your MCP servers on a daily basis. Each tip is directly applicable in session.

The Model Context Protocol (MCP) is an open standard created by Anthropic that allows AI assistants like Claude Code to communicate with external tool servers via a unified protocol. MCP supports three transport modes (stdio, SSE, and Streamable HTTP) and provides access to a growing ecosystem of community servers. MCP standardizes integration so you configure tools once rather than per-assistant.

SFEIR Institute trainings

Claude Code Training

1 day · Fundamentals

View program

AI-Augmented Developer

2 days · Intermediate

View program

How does the MCP protocol work with Claude Code?

MCP (Model Context Protocol) is an abstraction layer that standardizes communication between an AI client and tool servers. Each server exposes "tools" that Claude Code automatically discovers at session startup.

The protocol relies on JSON-RPC 2.0. The client sends a request, the server responds with a structured result. This decoupled architecture allows adding or removing servers without modifying the assistant's code.

In practice, an MCP server launches locally (stdio) or over the network (SSE/HTTP). Claude Code detects the available tools and offers them in its function calls. You have no prompt-side configuration to do.

ComponentRoleExample
MCP ClientSends tool requestsClaude Code
MCP ServerExposes tools via JSON-RPCGitHub remote MCP server
TransportCommunication channelstdio, SSE, Streamable HTTP
ToolSingle exposed actioncreate_issue, brave_search

To understand the full protocol and its use cases, check the complete MCP: Model Context Protocol guide which covers the architecture in detail.

Key takeaway: MCP is a JSON-RPC 2.0 protocol that connects Claude Code to external tool servers in a standardized way.

What are the three available MCP transport modes?

Tip 1: Prefer stdio for local servers

The stdio transport launches the server as a child process. Communication goes through stdin/stdout. It is the simplest and lowest-latency mode because there is no network round-trip.

claude mcp add my-server -- npx -y @modelcontextprotocol/server-filesystem /path/folder

Tip 2: Use SSE only as a fallback for remote servers

SSE (Server-Sent Events) maintains a long-lived HTTP connection. Note that the SSE transport is deprecated in the official docs: prefer Streamable HTTP (--transport http) for remote and persistent servers, and reserve SSE only as a fallback when an HTTP endpoint is unavailable.

claude mcp add --transport sse remote-server https://my-server.example.com/sse

Tip 3: Adopt Streamable HTTP for cloud deployments

Streamable HTTP is the recommended transport for remote servers. It combines standard request/response with optional streaming, which avoids holding a long-lived connection open per client as SSE does.

claude mcp add --transport http cloud-server https://api.example.com/mcp
TransportTypical latencyUse casePersistence
stdioLowest, no network hopLocal servers, CLISession duration
SSENetwork-dependent (deprecated)Remote servers, fallbackLong connection
Streamable HTTPNetwork-dependentCloud, productionPer request

Check the context management tips to optimize the size of MCP responses in your context window.

Key takeaway: Choose stdio locally and Streamable HTTP for remote or cloud production deployments, keeping the deprecated SSE transport only as a fallback.

How to add and manage your MCP servers?

Tip 4: Declare servers at the right scope

Claude Code manages three configuration scopes: local (private to this project, stored in ~/.claude.json), project (shared via .mcp.json), and user (available across all your projects, stored in ~/.claude.json). Place shared servers in .mcp.json at the project root so the entire team benefits.

{
 "mcpServers": {
 "github": {
 "type": "http",
 "url": "https://api.githubcopilot.com/mcp/",
 "headers": {
 "Authorization": "Bearer ${GITHUB_TOKEN}"
 }
 }
 }
}

Tip 5: List your active servers at a glance

Run the claude mcp list command to display all configured servers with their status. In practice, this command shows the transport, scope, and connection state for each configured server.

claude mcp list

Tip 6: Remove a server cleanly

Run claude mcp remove server-name to remove a server from the configuration. The process is stopped and the reference is removed from the corresponding scope file.

For a list of checks before modifying your servers, check the complete MCP checklist which covers each step.

Key takeaway: Declare shared servers in .mcp.json at the project level, and use claude mcp list to check status at any time.

How to use MCP tools during a session?

Tip 7: Discover available tools with /mcp

In a Claude Code session, the /mcp slash command shows your connected MCP servers, their connection status, and the tool count next to each server. It is also where you authenticate remote servers that require OAuth. Use it to confirm a server is connected and its tools are available. Check the essential slash commands for other useful shortcuts.

Tip 8: Let Claude Code choose the tool automatically

You do not need to name the tool explicitly. Describe your intent in natural language: Claude Code selects the right MCP tool and crafts the call with the correct parameters.

In practice, if you say "create a GitHub issue for this bug", Claude Code will automatically call the create_issue tool from the GitHub MCP server.

Tip 9: Combine multiple MCP tools in a single request

Claude Code chains tool calls within a single conversation turn. For example: search with Brave Search, then create a file with the results.

To get the most out of your conversations with MCP, explore the tips for your first conversations.

Key takeaway: Claude Code discovers and selects MCP tools automatically: describe your need in natural language without naming the tool.

How to configure and secure your MCP servers?

Tip 10: Store tokens in environment variables

Never hardcode a token in .mcp.json. Use the ${VARIABLE_NAME} syntax to reference environment variables. The .mcp.json file can be safely versioned if secrets remain in .env.

{
 "env": {
 "API_KEY": "${MY_API_KEY}"
 }
}

Tip 11: Restrict permissions per tool

Claude Code allows configuring authorizations per MCP tool. You can define tools as "allow" or "deny" in the configuration file. This prevents a compromised server from calling sensitive tools.

Overly permissive tokens are a common cause of MCP security incidents. Apply the principle of least privilege.

Tip 12: Validate third-party servers before installation

Before adding a community server, check the source repository, the number of contributors, and the date of the last commit. A server without updates for more than 6 months presents increased risk.

The permissions and security tips detail access control best practices for Claude Code.

RiskMitigationPriority
Token in plain text in codeEnvironment variables ${VAR}Critical
Malicious third-party serverAudit the source repositoryHigh
Overly broad permissionsPer-tool restriction (allow/deny)High
Uncontrolled network accessLocal stdio transportMedium

Key takeaway: Store your secrets in environment variables and restrict permissions tool by tool: never hardcode a token.

What are the most useful MCP servers?

Tip 13: Install the GitHub server for project management

The GitHub server exposes tools for issues, pull requests, code search, and branch management. GitHub is now connected as a remote HTTP server, authenticated with a personal access token passed in an Authorization: Bearer header. Provide a GITHUB_TOKEN whose scopes cover the operations you need (for example repository and organization read access).

claude mcp add --transport http github https://api.githubcopilot.com/mcp/ --header "Authorization: Bearer $GITHUB_TOKEN"

Tip 14: Add Brave Search for web searching

The Brave Search server gives Claude Code direct access to the web. Each query returns a set of web results you can feed into the conversation. You need a free Brave API key (the free tier includes a monthly credit allotment, so check the current Brave Search API pricing for exact limits).

claude mcp add brave-search -- npx -y @modelcontextprotocol/server-brave-search

Tip 15: Use Playwright MCP for browser testing

The Playwright server allows Claude Code to navigate web pages, capture screenshots, and interact with forms. In practice, a complete test scenario can navigate, capture screenshots, and run assertions in a single Claude Code session.

To diagnose connection errors with these servers, refer to the MCP troubleshooting guide.

ServerCapabilitiesAPI key requiredPrimary use case
GitHubIssues, PRs, code search, branchesGITHUB_TOKENCode and issue management
Brave SearchWeb search resultsBRAVE_API_KEYContextual web search
PlaywrightNavigation, screenshots, assertionsNoUI testing and screenshots
FilesystemFile read/write operationsNoFile read/write
PostgreSQLSQL queries and schema accessDB connectionDatabase queries

Key takeaway: GitHub, Brave Search, and Playwright cover many common MCP use cases: start with these three servers.

How to debug an MCP server that is not responding?

Tip 16: Check the logs by launching the server manually

Launch the server manually to observe standard output and errors. Most problems come from a missing binary (npx not installed) or an expired token.

npx -y @modelcontextprotocol/server-filesystem /path/folder 2>&1 | head -20

Tip 17: Test the connection with a minimal call

Run claude mcp list and verify that the status shows "connected". If the server appears as "disconnected", use the in-session /mcp command to check its status and re-authenticate, or restart the Claude Code session entirely.

In practice, most MCP errors are resolved by checking three things: the binary is accessible, the token is valid, and the network port is open.

The MCP FAQ answers frequent questions about connection errors and timeouts.

Key takeaway: Launch the server manually to read the logs, then check binary, token, and network. These three points resolve most issues.

How to integrate MCP into a CI/CD workflow?

Tip 18: Use MCP in headless mode

Claude Code supports headless mode (claude -p "instruction") with MCP servers. Configure your servers in .mcp.json at the repository root and the CI pipeline launches them automatically.

claude -p "Analyze the last 5 GitHub issues and create a report" --allowedTools "mcp__github__*"

The --allowedTools flag restricts the MCP tools authorized in CI. This prevents an injected prompt from triggering unwanted actions. Restricting tools narrows the attack surface in automated AI pipelines.

To go further on automation, check the headless mode and CI/CD tips which cover advanced integration patterns.

SFEIR Institute offers the one-day Claude Code training, with hands-on labs on MCP configuration and CI/CD integration. For a complete skill-up, the two-day AI-Augmented Developer training covers all development assistance tools, including advanced MCP workflows. Experienced developers can continue with the one-day AI-Augmented Developer - Advanced training, focused on optimization and automated pipelines.

Key takeaway: In CI/CD, combine headless mode with --allowedTools to precisely control which MCP tools are accessible to the pipeline.

Can you customize MCP behavior with CLAUDE.md?

Bonus tip: Document your MCP servers in CLAUDE.md

Add an MCP section to your CLAUDE.md file to guide Claude Code in using the tools. Specify which servers to use for which types of tasks and the constraints specific to your project.

## MCP Servers
- GitHub: use for all issue and PR management
- Brave Search: limit to 5 searches per session
- Playwright: screenshots in 1280x720 only

The CLAUDE.md memory system guide explains how to structure this file to maximize Claude Code's effectiveness with your MCP tools.

Key takeaway: The CLAUDE.md file serves as persistent memory - document your MCP conventions so that Claude Code applies them automatically.


Recent articles about Claude

Recommended training

Claude Code Training

Master Claude Code fundamentals in 1 day with our expert instructors. 60% hands-on practice on real-world cases.

Discover the training