MCP servers in Claude Code -- setup guide
MCP (Model Context Protocol) is an open standard that lets Claude Code talk directly to external systems: databases, cloud platforms, APIs, and anything else you can wrap in a server. Instead of copy-pasting output between tools, Claude Code calls the MCP server and gets a structured result it can reason about and act on.
This guide covers how to configure MCP servers in a Claude Code project, with examples for the most common integrations.
How MCP works in Claude Code
MCP servers expose a set of named tools. Claude Code discovers available tools at session start and can call them during a conversation -- reading database records, deploying to Vercel, uploading files to Cloudinary, and so on.
You configure MCP servers in .mcp.json at the repo root. Claude Code reads this file automatically. Tools from all configured servers are available alongside Claude Code built-ins.
The .mcp.json format
{
"mcpServers": {
"server-name": {
"command": "npx",
"args": ["-y", "@some/mcp-package"],
"env": {
"API_KEY": "${SOME_API_KEY}"
}
}
}
}Each entry:
command+args: how to launch the server processenv: environment variables to pass; use${VAR}to pull from your shell environment
Commit .mcp.json to the repo. Every developer on the project gets the same tools. Store secrets in .env -- never in .mcp.json directly.
Neon DB
The Neon MCP server lets Claude Code inspect your database schema, run queries, create branches, and manage connection strings -- without you opening a terminal.
"neon": {
"command": "npx",
"args": ["-y", "@neondatabase/mcp-server-neon"],
"env": {
"NEON_API_KEY": "${NEON_API_KEY}"
}
}Get your API key from console.neon.tech -> Account -> API Keys.
With this configured, you can ask Claude Code things like "what tables exist in my database?" or "run this migration on a feature branch" and it will use the MCP tools directly.
Vercel
The Vercel MCP server exposes deployment status, build logs, environment variables, and project configuration.
"vercel": {
"command": "npx",
"args": ["-y", "@vercel/mcp-adapter"],
"env": {
"VERCEL_TOKEN": "${VERCEL_TOKEN}"
}
}Get your token from vercel.com -> Settings -> Tokens. This lets Claude Code check deployment status, read runtime logs, or list projects without leaving the editor.
Cloudinary
The Cloudinary MCP server handles media uploads, transformations, and asset management.
"cloudinary": {
"command": "npx",
"args": ["-y", "cloudinary-mcp-server"],
"env": {
"CLOUDINARY_CLOUD_NAME": "${CLOUDINARY_CLOUD_NAME}",
"CLOUDINARY_API_KEY": "${CLOUDINARY_API_KEY}",
"CLOUDINARY_API_SECRET": "${CLOUDINARY_API_SECRET}"
}
}With this, Claude Code can upload images directly during a session and return the resulting URL -- useful when populating seed data or generating blog post thumbnails.
Resend
The Resend MCP server can list domains, check API key status, and inspect sent emails.
"resend": {
"command": "npx",
"args": ["-y", "@resend/mcp-server"],
"env": {
"RESEND_API_KEY": "${RESEND_API_KEY}"
}
}Filesystem (built-in)
The official MCP filesystem server gives Claude Code access to directories outside the current repo -- useful for referencing shared config or design tokens.
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/Users/you/shared-config"
]
}Only pass directories you want Claude Code to access. The server enforces the boundary.
A full .mcp.json example
{
"mcpServers": {
"neon": {
"command": "npx",
"args": ["-y", "@neondatabase/mcp-server-neon"],
"env": { "NEON_API_KEY": "${NEON_API_KEY}" }
},
"vercel": {
"command": "npx",
"args": ["-y", "@vercel/mcp-adapter"],
"env": { "VERCEL_TOKEN": "${VERCEL_TOKEN}" }
},
"cloudinary": {
"command": "npx",
"args": ["-y", "cloudinary-mcp-server"],
"env": {
"CLOUDINARY_CLOUD_NAME": "${CLOUDINARY_CLOUD_NAME}",
"CLOUDINARY_API_KEY": "${CLOUDINARY_API_KEY}",
"CLOUDINARY_API_SECRET": "${CLOUDINARY_API_SECRET}"
}
},
"resend": {
"command": "npx",
"args": ["-y", "@resend/mcp-server"],
"env": { "RESEND_API_KEY": "${RESEND_API_KEY}" }
}
}
}Writing a custom MCP server
You can wrap any internal API as an MCP server using the @modelcontextprotocol/sdk package.
// mcp-servers/internal-api/index.ts
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { z } from "zod";
const server = new McpServer({ name: "internal-api", version: "1.0.0" });
server.tool(
"get_feature_flags",
"Returns all active feature flags from the internal config service",
{},
async () => {
const res = await fetch("https://internal.example.com/api/flags", {
headers: { Authorization: `Bearer ${process.env.INTERNAL_TOKEN}` },
});
const flags = await res.json();
return { content: [{ type: "text", text: JSON.stringify(flags, null, 2) }] };
}
);
server.tool(
"set_feature_flag",
"Enable or disable a feature flag by name",
{ name: z.string(), enabled: z.boolean() },
async ({ name, enabled }) => {
await fetch(`https://internal.example.com/api/flags/${name}`, {
method: "PUT",
body: JSON.stringify({ enabled }),
headers: { "Content-Type": "application/json" },
});
return { content: [{ type: "text", text: `Set ${name} to ${enabled}` }] };
}
);
const transport = new StdioServerTransport();
await server.connect(transport);Register it in .mcp.json:
"internal-api": {
"command": "npx",
"args": ["tsx", "mcp-servers/internal-api/index.ts"],
"env": { "INTERNAL_TOKEN": "${INTERNAL_TOKEN}" }
}Documenting MCP servers in CLAUDE.md
Add a section to your CLAUDE.md listing which servers are configured and what tokens they need. This prevents Claude Code from trying to find workarounds when a token is missing.
# MCP
MCP servers are configured in .mcp.json. Add missing tokens to .env:
- neon: NEON_API_KEY
- vercel: VERCEL_TOKEN
- cloudinary: CLOUDINARY_CLOUD_NAME, CLOUDINARY_API_KEY, CLOUDINARY_API_SECRET
- resend: RESEND_API_KEY
If an MCP tool fails due to a missing token, stop and ask
the user to add it before retrying.The last instruction -- "stop and ask" -- prevents Claude Code from falling back to direct DB queries or other workarounds that bypass your architecture.
Takeaway
MCP turns Claude Code from a code editor into a system operator. With the right servers configured, it can query your production DB schema, check deployment logs, upload assets, and call internal APIs -- all without leaving the conversation. The investment is a few lines in .mcp.json and the correct env vars in .env.