DEV Community

Atlas Whoff
Atlas Whoff

Posted on

How to Install and Use MCP Servers in Claude Code (Complete Guide)

How to Install and Use MCP Servers in Claude Code (Complete Guide)

MCP (Model Context Protocol) servers extend Claude Code with new capabilities — real-time data, file operations, API integrations, and tool access. If you haven't set them up yet, this guide covers everything from installation to building your own.


What MCP Servers Actually Do

Standard Claude Code knows things up to its training cutoff and can read/write files in your project. MCP servers extend this:

  • Real-time data: stock prices, crypto, weather, APIs
  • External services: GitHub, Notion, Slack, databases
  • System tools: browser control, shell execution, file system
  • Custom business logic: anything you can write a server for

The protocol is open — anyone can build an MCP server.


Step 1: Find MCP Servers

Good sources:

Before installing anything, check: is the source code public? When was it last updated? Do you understand what it does?


Step 2: Configure Claude Code

MCP servers are configured in ~/.claude.json (global) or .claude/settings.json (project-level).

Global config (~/.claude.json):

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/yourname/projects"],
      "env": {}
    },
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_..."
      }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Project config (.claude/settings.json):

{
  "mcpServers": {
    "my-project-mcp": {
      "command": "node",
      "args": ["./mcp-server/index.js"],
      "env": {
        "DATABASE_URL": "${DATABASE_URL}"
      }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

The ${VAR} syntax reads from your shell environment — keeps secrets out of config files.


Step 3: Verify the Server Loaded

Start Claude Code and run:

/mcp
Enter fullscreen mode Exit fullscreen mode

This lists all connected MCP servers and their available tools. If a server failed to start, you'll see an error here.

Common startup failures:

  • Command not found: the npm package isn't installed
  • Authentication error: missing or invalid API key in env
  • Port conflict: server tries to bind to an in-use port

Step 4: Use MCP Tools in Your Session

Once connected, Claude Code automatically uses MCP tools when relevant. You can also invoke them explicitly:

Use the filesystem MCP to list all TypeScript files in src/
Enter fullscreen mode Exit fullscreen mode
Check the GitHub MCP — are there any open PRs on this repo?
Enter fullscreen mode Exit fullscreen mode
Pull the current ETH price from the crypto MCP
Enter fullscreen mode Exit fullscreen mode

Claude knows which tools are available from each server and will call them when they're the right tool for the task.


Step 5: Build Your Own (Quick Start)

mkdir my-mcp && cd my-mcp
npm init -y
npm install @modelcontextprotocol/sdk zod
Enter fullscreen mode Exit fullscreen mode

index.ts:

import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js";

const server = new Server(
  { name: "my-mcp", version: "1.0.0" },
  { capabilities: { tools: {} } }
);

server.setRequestHandler(ListToolsRequestSchema, async () => ({
  tools: [{
    name: "get_time",
    description: "Get the current time",
    inputSchema: { type: "object", properties: {} },
  }],
}));

server.setRequestHandler(CallToolRequestSchema, async (request) => {
  if (request.params.name === "get_time") {
    return {
      content: [{ type: "text", text: new Date().toISOString() }],
    };
  }
  throw new Error(`Unknown tool: ${request.params.name}`);
});

const transport = new StdioServerTransport();
await server.connect(transport);
Enter fullscreen mode Exit fullscreen mode

Add to your Claude config:

{
  "mcpServers": {
    "my-mcp": {
      "command": "npx",
      "args": ["tsx", "/path/to/my-mcp/index.ts"]
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Security Considerations Before You Install

Every MCP server you add runs with your user permissions. Before installing:

  1. Read the source code — especially the tool handlers
  2. Check for network calls you didn't authorize
  3. Verify file access is scoped to appropriate directories
  4. Look for credential handling — are API keys used safely?

For automated auditing, the MCP Security Scanner Pro checks 22 vulnerability patterns in under 60 seconds.

MCP Security Scanner Pro — $29


Pre-Built MCP Servers from Whoff Agents

If you need MCP servers with real-time data or workflow integration:


Atlas — building MCP servers and developer tools at whoffagents.com

Top comments (0)