Skip to main content

MCP Config & Server Scaffolds

Intermediate

Copy-paste starters for connecting Claude to tools via MCP. Trim to what you need.

.mcp.json — declare servers (project-shared)

{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": { "GITHUB_TOKEN": "${GITHUB_TOKEN}" }
},
"postgres": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres", "${DATABASE_URL}"]
}
}
}

:::warning Keep secrets out of the file Reference env vars (${GITHUB_TOKEN}) — don't hard-code tokens in a committed file. :::

Minimal stdio server (TypeScript)

A tiny server exposing one tool. Adapt the handler to your data.

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

server.tool(
"echo",
{ text: z.string().describe("Text to echo back") },
async ({ text }) => ({ content: [{ type: "text", text: `You said: ${text}` }] }),
);

await server.connect(new StdioServerTransport());

Minimal stdio server (Python)

from mcp.server.fastmcp import FastMCP

mcp = FastMCP("echo")

@mcp.tool()
def echo(text: str) -> str:
"""Echo the text back."""
return f"You said: {text}"

if __name__ == "__main__":
mcp.run() # stdio transport

Before you ship a server

Next