mcp-typescript — Claude Code rule: what it does, how to install
Sets boundaries for TypeScript MCP servers: sends logs to stderr, keeps input schemas strict, and guards destructive actions.
MIT ★ 1,198 updated 2026-10-23
.claude/rules/mcp-typescript.mdWhat mcp-typescript does
This rule targets the mcp/ path pattern, including TypeScript files, configuration files, and README.md. It keeps MCP tool names descriptive and enforces strict boundaries on input schemas.
Stdout is reserved for protocol messages, so all logging must go to stderr. The rule enforces loopback-only API destinations by default and demands guardrails around destructive operations.
Any code edits must pass verification with npm run mcp:typecheck and npm run mcp:build. Writing server logs directly to stdout will break the MCP JSON-RPC exchange.
What it helps with
- prevent MCP protocol corruption caused by logging to stdout
- enforce strict validation schemas on MCP tool inputs
- isolate API calls to loopback interfaces by default
- verify server builds with npm run mcp:typecheck and mcp:build
Example prompts for the agent
- Create a new tool handler inside mcp/src/
- Inspect logging setup in mcp/src/server.ts
- Run TypeScript verification checks on the mcp directory
How to install mcp-typescript
Manually: put the files in place
.claude/rules/mcp-typescript.mdThe paths frontmatter field limits the files
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.cursor/rules/mcp-typescript.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.github/instructions/mcp-typescript.instructions.mdThe applyTo field sets which files it applies to
Manually: put the files in place
.devin/rules/mcp-typescript.mdManually: put the files in place
.clinerules/mcp-typescript.mdStep by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use
Questions about mcp-typescript
How do I install mcp-typescript in Claude Code?
Place the rule file at .claude/rules/mcp-typescript.md in your repository.
What does the mcp-typescript rule do?
It enforces development guidelines for MCP servers, ensuring logs go to stderr, input schemas remain bounded, and code passes typecheck and build commands.
Why does the rule restrict logging to stderr?
MCP agents communicate with tools over stdout via protocol frames. Raw logs routed to stdout corrupt protocol communication.
Source text
mcp-typescript.md · MIT
--- paths: - "mcp/src/**/*.ts" - "mcp/package.json" - "mcp/tsconfig.json" - "mcp/.env.example" - "mcp/README.md" --- # MCP Server Rules - Keep MCP tool names stable and descriptive. - Keep destructive operations behind explicit guardrails. - Route all logs to stderr only; never write protocol logs to stdout. - Keep tool input schemas strict and bounded. - Preserve loopback-only API target enforcement unless security posture changes by request. - Verify MCP with `npm run mcp:typecheck` and `npm run mcp:build` after code edits.
© hoangsonww · MIT · hoangsonww/Claude-Code-Agent-Monitor