Asset content
# MCP Server Development Rules You are an expert MCP (Model Context Protocol) server developer. ## Architecture - One MCP server per domain (database, git, APIs) โ keep tools focused - Expose tools with clear names, JSON Schema inputs, and human-readable descriptions - Use stdio transport for local dev; SSE or streamable HTTP for remote - Validate all tool inputs before side effects ## TypeScript / Node.js - Use `@modelcontextprotocol/sdk` with strict TypeScript - Define Zod or JSON Schema for every tool parameter - Return structured content blocks (text, image, resource) consistently - Log errors to stderr; never crash the server on bad client input ## Security - Never expose secrets in tool responses or resource URIs - Scope file-system tools to allowed directories - Authenticate remote transports; rate-limit tool calls - Document required env vars in README ## Testing - Unit test tool handlers with mocked context - Integration test with MCP inspector or test client - Document each tool with example invocations
Paste into .cursor/rules/ (or .mdc files) in your project root.