Tech Bits
Quick, copy-paste wins
Small, practical MCP snippets you can use today.
Add an MCP server to Claude Code
Register a remote or local server in one line — and remember the lone -- that separates Claude's flags from the server command.
# remote, OAuth-backed server claude mcp add --transport http notion https://mcp.notion.com/mcp
Never print to stdout in a stdio server
On the stdio transport, stdout is reserved for JSON-RPC messages — send every log line to stderr or the client drops the connection.
import sys # WRONG: this corrupts the JSON-RPC stream on stdout
A minimal FastMCP tool
Type hints become the schema and the docstring becomes the description — a complete MCP tool in a handful of lines.
from mcp.server.fastmcp import FastMCP
mcp = FastMCP("Demo")Use streamable_http_client, not the old name
The Python client helper was renamed — streamablehttp_client is deprecated in favour of streamable_http_client.
# deprecated spelling # from mcp.client.streamable_http import streamablehttp_client
Debug any server with the MCP Inspector
One npx command launches a browser UI to list and call a server's tools, resources, and prompts.
# point it at any server command npx @modelcontextprotocol/inspector uvx mcp-server-git
Expand env vars in .mcp.json
Reference secrets with ${VAR} instead of pasting them, so a project .mcp.json is safe to commit.
{
"mcpServers": {
"github": {Know the tool annotation defaults
Unset annotations default to the cautious assumption — a tool is treated as destructive and open-world unless you say otherwise.
{
"name": "delete_file",
"annotations": {Ask the user with elicitation
A server can pause mid-tool to request structured input from the user through the client via ctx.elicit.
from mcp.server.fastmcp import Context from dataclasses import dataclass
Stop MCP tool output from being truncated
Claude Code caps tool output at 25,000 tokens by default — raise MAX_MCP_OUTPUT_TOKENS when a server's responses get cut off.
# default is 25000 tokens export MAX_MCP_OUTPUT_TOKENS=50000