1. cheat-sheets
  2. /mcp

MCP Quick Reference

Last reviewed: June 2026

Full guide: Building MCP Servers · Config: MCP Config Cheat Sheet · Security: MCP Security · Tutorial: MCP Server from Scratch

Cursor Config (.cursor/mcp.json)

{
  "mcpServers": {
    "my-dev-tools": {
      "command": "node",
      "args": ["./mcp-server/dist/index.js"],
      "env": {
        "DATABASE_URL": "${env:DATABASE_URL}"
      }
    },
    "my-python-tools": {
      "command": "uv",
      "args": ["run", "mcp-server/main.py"]
    }
  }
}
FieldNotes
commandExecutable the client spawns (node, python, uv, npx)
argsPath to built entry file
envUse ${env:VAR} — never commit secrets
Settings UICursor → Settings → MCP (same shape)

Tool Schema (TypeScript + Zod)

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: "my-dev-tools", version: "1.0.0" });

server.tool(
  "lookup_user",
  {
    email: z.string().email().describe("User email to look up"),
    limit: z.number().int().min(1).max(10).default(1),
  },
  async ({ email, limit }) => {
    const users = await db.users.findByEmail(email, { limit });
    return {
      content: [{ type: "text", text: JSON.stringify(users, null, 2) }],
    };
  }
);

const transport = new StdioServerTransport();
await server.connect(transport);

Tool Schema (Python + FastMCP)

from mcp.server.fastmcp import FastMCP

mcp = FastMCP("my-dev-tools")

@mcp.tool()
def lookup_user(email: str, limit: int = 1) -> str:
    """Look up a user by email. Read-only staging DB."""
    users = db.find_users(email=email, limit=min(limit, 10))
    return json.dumps(users)

if __name__ == "__main__":
    mcp.run()

Tool Design Checklist

DoDon't
One action per tool (lookup_user)One tool that does everything
Zod / type hints on every paramRaw user strings → SQL
Return small JSON textReturn megabytes
Read-only for explorationProd writes without guardrails
Clear description on each paramCryptic param names

Test Commands

# Build TypeScript server
cd mcp-server && npm run build

# Run MCP Inspector (official dev tool)
npx @modelcontextprotocol/inspector node ./mcp-server/dist/index.js

# Smoke test in Cursor
# 1. Restart Cursor after editing mcp.json
# 2. Ask mode: "Use lookup_user to find email [email protected]"
# 3. Confirm tool appears in MCP panel (green = connected)

Troubleshooting

SymptomFix
Server not listedCheck JSON syntax; restart Cursor
Red / disconnectedRun server manually; check args path and node version
Tool never calledName tool clearly; describe when to use it in the description
Empty responseLog inside handler; validate env vars are set
TimeoutReturn less data; add pagination param

Pre-Prod Security

  • [ ] Read-only DB credentials for dev tools
  • [ ] Inputs validated with schema
  • [ ] No secrets in tool responses
  • [ ] Audit log of tool invocations
  • [ ] .cursorignore excludes .env*