Setting up MCP servers across Cursor, Claude Code, and Copilot
One MCP server, three clients — standardize your tool surface.
MCP — Model Context Protocol — is the 2025-onwards standard for exposing tools to LLMs. Write one MCP server; use it from Cursor, Claude Code, Copilot, and your own agents. Here's why that changes your build vs. wire calculus.
What MCP solves
Before MCP, each AI client had its own way of wiring custom tools:
- Cursor: extensions API.
- Claude Code: custom bash wrappers.
- Your agent: whatever framework you picked.
Same tool, three integrations. Now: one MCP server, all clients speak it.
The MCP mental model
An MCP server exposes:
- Tools — callable functions (think: API endpoints for the model).
- Resources — readable data (think: documents, configs, records).
- Prompts — template prompts the client can invoke.
Clients connect via stdio or HTTP. They auto-discover what's available.
What to build as an MCP server
Good candidates:
- Your internal API access.
get_customer(id),search_orders(filters). - Database introspection.
list_tables,describe_table,sample_rows. - Observability queries.
recent_errors(service),latency_p95(service, window). - Deployment tooling.
deploy_status,trigger_deploy. - Knowledge bases.
search_runbooks(query),read_architecture_doc(name).
Anything that a human engineer routinely looks up is a candidate.
Writing a minimal MCP server
Packages exist for TypeScript, Python, and Rust. A trivial TS example:
import { Server } from "@modelcontextprotocol/sdk/server";
const server = new Server(
{ name: "my-tools", version: "1.0.0" },
{ capabilities: { tools: {} } }
);
server.setRequestHandler("tools/list", async () => ({
tools: [{
name: "get_customer",
description: "Fetch customer by ID",
inputSchema: {
type: "object",
properties: { id: { type: "string" } },
required: ["id"]
}
}]
}));
server.setRequestHandler("tools/call", async (req) => {
const { name, arguments: args } = req.params;
if (name === "get_customer") {
const customer = await db.customers.findById(args.id);
return { content: [{ type: "text", text: JSON.stringify(customer) }] };
}
});
In practice you'll want proper error handling, pagination, auth.
Using the same server from multiple clients
Configure once per client:
Cursor: ~/.cursor/mcp.json adds the server.
Claude Code: ~/.config/claude-code/mcp.json or per-project .mcp.json.
Your own agent: import the MCP client library and connect.
One server, every client now has access.
Shared MCP server libraries
Already-available public MCP servers worth knowing:
- Filesystem — read/write files within scoped paths.
- Git — repo operations.
- PostgreSQL / Sqlite — database access.
- Slack / Linear / Jira / Notion — team tool integration.
- Cloudflare / Vercel / AWS — infrastructure operations.
Plus hundreds of community servers on GitHub. Before building, check what exists.
Security model
MCP tools run with the credentials you give them. Rules:
- Least privilege. Give each server the narrowest credentials that work.
- Separate servers for separate trust zones. Your "read-only analytics" server should run separately from "deploy production" — and the deploy one should require explicit user confirmation per action.
- Audit logs. MCP servers should log every call, because your clients may not.
The future-proofing angle
If you write your internal tooling as MCP servers, you're future-proofed:
- New client emerges (say, a new IDE with AI) → plug in the existing MCP server.
- You switch from Claude Code to some other CLI → same tools follow you.
- You spin up a custom agent → reuse the MCP server instead of re-wiring.
This is a meaningful architectural insurance policy for a fast-moving ecosystem.
The build-vs-reuse calculus
Before writing an MCP server:
- Check if a public one does 80% of what you need.
- Fork it rather than writing from scratch.
- Publish your server if it might be useful to others — the ecosystem is still building.
What breaks
- Schema drift. You update a tool; clients expect the old shape. Version your tools.
- Large responses. Some tools return too much data. Add pagination / filtering.
- Long-running tools. MCP is synchronous; long operations block. Use job-style patterns (start, poll, retrieve).
Check your understanding
2-question self-check
Optional. Your answers feed your knowledge score on the track certificate.
Q1.MCP (Model Context Protocol) lets you…
Q2.A good candidate to expose as an MCP server is…
Continue in this track
More lessons from AI Coding Tools Mastery.
Lesson 6
Windsurf and Cascade: flow-based AI engineering
How Windsurf's flow model differs from command-style pair-programming.
Lesson 7
JetBrains AI Assistant: IDE-native assistance done differently
What it does well, where it lags, and the IntelliJ-native integrations that matter.
Lesson 9
A prompt-engineering playbook for code
The patterns that make code-gen prompts actually reliable.