ASK KNOX
beta
LESSON 57

MCP Servers — Extending Claude's Reach

Model Context Protocol is the plugin architecture that lets Claude touch anything — databases, browsers, APIs, memory layers, custom tools. Understand it, install it, and build your first server.

11 min read·Advanced Claude Code

Out of the box, Claude Code can read files, write files, run bash commands, and search codebases. That is powerful. MCP makes it limitless. Model Context Protocol is the plugin architecture that lets Claude reach into any system — a Postgres database, a running browser, a Slack workspace, a memory layer holding 2,000 indexed documents, a custom API that does not exist yet. If you can write a server, you can give Claude access to it.

This is the lesson where Claude Code becomes a platform, not just a tool.

MCP Servers — Extending Claude's Reach

What MCP Is

Model Context Protocol is an open standard — published by Anthropic, implemented by the community — for connecting AI models to external systems. The architecture is simple: a Claude Code session (the client) speaks JSON-RPC to one or more MCP servers. Each server exposes capabilities via three primitive types.

Tools are functions Claude can call. They can have side effects. query_database, click_button, send_message, create_file_on_remote_server — anything a function can do, a tool can do. Claude decides when to invoke tools based on what it needs to accomplish the task.

Resources are data sources Claude can read. Think of them as addressable context — a database table, a file on a remote server, a document from a CMS, a schema definition. Resources do not execute code; they provide data.

Prompts are reusable prompt templates that the server exposes. An MCP server for a code review tool might expose a detailed_review prompt that formats input in the specific way that tool needs. Claude can use these templates rather than writing the prompt from scratch.

Installing and Configuring MCP Servers

Configuration lives in ~/.claude.json (global, available in every session) or in a .mcp.json file at the project root (project-scoped).

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "${HOME}/Documents"]
    },
    "postgres": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-postgres"],
      "env": {
        "POSTGRES_URL": "postgresql://user:pass@localhost:5432/mydb"
      }
    },
    "my-custom-server": {
      "command": "node",
      "args": ["${HOME}/my-mcp-server/index.js"]
    }
  }
}

Each entry under mcpServers is a named server. The command and args define how Claude Code launches the server process. Environment variables go in env. Claude Code starts these processes at session launch and they stay alive for the session.

To inspect what is available: run /mcp inside a Claude Code session to see all connected servers and their tools.

The Ecosystem Today

The MCP ecosystem has grown rapidly since the standard was published. Available servers span:

The @modelcontextprotocol npm namespace contains the official reference implementations. The broader ecosystem is on GitHub and grows weekly. Search mcp-server on npm or GitHub for current options.

Building a Simple MCP Server

Understanding how to build one gives you the mental model for how the whole system works. A minimal MCP server in Node.js:

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-tools", version: "1.0.0" },
  { capabilities: { tools: {} } }
)

// Declare what tools this server provides
server.setRequestHandler(ListToolsRequestSchema, async () => ({
  tools: [{
    name: "get_server_time",
    description: "Returns the current server timestamp",
    inputSchema: { type: "object", properties: {}, required: [] }
  }]
}))

// Handle tool invocations from Claude
server.setRequestHandler(CallToolRequestSchema, async (request) => {
  if (request.params.name === "get_server_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)

That is a complete, working MCP server. Claude Code launches it as a subprocess, lists its tools, and calls them when needed. The inputSchema is standard JSON Schema — Claude uses it to know what parameters to pass.

Know your tools. An MCP server you understand deeply is a force multiplier. A black-box npm package you grabbed without reading is a liability.

Security Considerations

MCP servers run with the permissions of the user who launched Claude Code. A server that exposes run_arbitrary_sql against your production database is dangerous. A few rules:

Read-only by default. When you first expose a database via MCP, expose read queries only. Add write capability only after you have validated the tool works as intended.

Environment variable hygiene. Database URLs, API tokens, and service credentials go in the env block of the config — never hardcoded in the server source if the source is committed to a repo.

Trust boundaries. An MCP server you wrote and host locally is trusted. An MCP server from a third party with write access to your filesystem is an attack surface. Vet before installing.

Scope tightly. A server that gives Claude access to one specific database table is safer than one that gives access to the entire database server. Principle of least privilege applies here.

Lesson 57 Drill

Install one MCP server you do not currently have. The Playwright browser server (@modelcontextprotocol/server-playwright) is high-value and takes five minutes to configure. Once installed, ask Claude to open a URL, take a screenshot, and describe what it sees. You will immediately understand what a well-designed tool primitive feels like from the user side.

Then: write the 20-line custom MCP server above. Modify it to expose one tool that is specific to your work — get the latest git log, ping a URL you monitor, read a file you reference constantly. Make it yours.

Bottom Line

MCP servers are Claude Code's plugin architecture. Tools, resources, and prompts are the three primitives. Configure servers in ~/.claude.json. The official ecosystem covers the common cases. Your edge comes from custom servers built for your specific context. Build them tight, vet them before installation, and scope permissions to the minimum required. Every MCP server that works is one less round-trip through manual copy-paste — and those compound.