# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Project Overview
This is a Model Context Protocol (MCP) server that provides AI assistants with standardized access to the Resend email API. It's written in TypeScript and uses stdio transport for direct integration with Claude Code.
## Development Commands
### Building and Running
- `npm run build` - Compile TypeScript to JavaScript in `/dist`
- `npm run dev` - Start server in development mode with hot reloading
- `npm start` - Run the production build
### Code Quality
- `npm run lint` - Run both ESLint and Prettier checks
- `npm run fix` - Auto-fix all linting issues
## Architecture
### Core Structure
The server follows a schema-driven design pattern:
1. **Request/Response Schemas** (`src/schemas.ts`):
- All Resend API interactions are validated with Zod schemas
- Request schemas define input parameters
- Response schemas filter API responses
2. **Main Server** (`src/index.ts`):
- Stdio-only transport for CLI integration
- Tool registration and request handling
- Environment variable validation
### Available Tools
- `resend_send_email` - Send a single email to one or more recipients
- `resend_send_batch_emails` - Send up to 100 emails in a single API call
### Environment Requirements
Must set in environment or `.env` file:
- `RESEND_API_KEY`: Resend API key for authentication
- `RESEND_FROM_EMAIL`: Default sender email address (e.g., `Bugzy <notifications@bugzy.ai>`)
## Key Implementation Notes
1. **Platform-controlled From Address**: The `from` field is set via environment variable, not exposed to the AI agent (security measure)
2. **Type Safety**: All API requests are validated through Zod schemas
3. **Error Handling**: Returns structured error responses with clear messages
4. **ES Modules**: Project uses `"type": "module"` - use ES import syntax
## Common Tasks
### Adding a New Tool
1. Define request/response schemas in `src/schemas.ts`
2. Add tool registration in `src/index.ts` server setup
3. Implement handler following existing pattern: validate -> API call -> return
4. Update README.md with new tool documentation
## Publishing
```bash
npm run build
npm publish
```
Package is published to npmjs as `@bugzy-ai/resend-mcp-server`.