-
Notifications
You must be signed in to change notification settings - Fork 10
Integrate template tools #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
narekhovhannisyan
wants to merge
29
commits into
railsware:main
Choose a base branch
from
narekhovhannisyan:integrate-template
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 23 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
cf49bdf
Enhance Mailtrap client configuration to conditionally set accountId …
narekhovhannisyan 7ef5169
Update README.md to include new Mailtrap template management operatio…
narekhovhannisyan d48c223
Add email template management operations to the server
narekhovhannisyan 4685d70
Add email template management functions: create, delete, list, and up…
narekhovhannisyan 8925fa8
Add index file for email template management functions
narekhovhannisyan b4b09f0
Add unit tests for email template management functions
narekhovhannisyan 19dd35f
Add schemas for email template management operations
narekhovhannisyan 0a93350
Add interfaces for email template management requests
narekhovhannisyan ac0f7f2
Fix typo in README.md by correcting "MAILTRA_ACCOUNT_ID" to "MAILTRAP…
narekhovhannisyan 58ddacf
Enhance Mailtrap client configuration to validate MAILTRAP_ACCOUNT_ID…
narekhovhannisyan dfd0606
Implement validation for updateTemplate function to ensure at least o…
narekhovhannisyan 7f60905
Add test for updateTemplate function to reject updates with no fields…
narekhovhannisyan 3c20f57
Update README.md to clarify requirements for update-template function
narekhovhannisyan e9a5127
improve readme
yanchuk 5585290
Update Mailtrap dependency to version 4.2.0 and add yarn.lock file fo…
narekhovhannisyan de31afe
Update Mailtrap dependency to version 4.2.0 and remove yarn.lock file…
narekhovhannisyan 9e6bdae
bump version
yanchuk e3eefec
fix cursor and vs code links
yanchuk 7b495ed
add claude.md
yanchuk d250419
add agent.md
yanchuk 1fe652e
Update SendMailToolRequest interface to require category field
narekhovhannisyan ed84ae3
Refactor category field in sendEmail schema to be required for tracking
narekhovhannisyan c344b54
Clarify requirements for email template fields in README.md
narekhovhannisyan 0f8516c
Update README.md to change category field from optional to required f…
narekhovhannisyan 62f8727
Update sendEmail tests to include required category field in email data
narekhovhannisyan 6ec93c5
Implement validation for email template creation to ensure at least o…
narekhovhannisyan f2264aa
Enhance validation in updateTemplate function to ensure that when bot…
narekhovhannisyan 5533355
Make 'html' field optional in createTemplate schema to allow for more…
narekhovhannisyan 5c33992
Make 'html' field optional in CreateTemplateRequest interface to enha…
narekhovhannisyan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# AGENT.md | ||
|
||
## Build/Lint/Test Commands | ||
- `npm run build` - Compile TypeScript to dist/ | ||
- `npm run lint` - Run ESLint and TypeScript checks | ||
- `npm test` - Run all Jest tests | ||
- `npm run test:watch` - Run tests in watch mode | ||
- `jest src/tools/sendEmail/__tests__/sendEmail.test.ts` - Run single test file | ||
- `npm run dev` - Run MCP server with inspector for testing | ||
|
||
## Architecture | ||
- MCP (Model Context Protocol) server integrating with Mailtrap email service | ||
- Main entry point: `src/index.ts` registers tools and handles server lifecycle | ||
- Tools located in `src/tools/` with pattern: each tool has subdirectory with index.ts, schema.ts, implementation.ts, and __tests__/ | ||
- Client configuration: `src/client.ts` handles Mailtrap API initialization | ||
- Configuration: `src/config/index.ts` for server constants | ||
|
||
## Code Style | ||
- Uses Airbnb TypeScript ESLint config with Prettier | ||
- TypeScript strict mode enabled, targeting ES2022 with CommonJS | ||
- Zod schemas for all tool input validation | ||
- Error handling: catch and re-throw with descriptive messages | ||
- Import style: ES modules syntax, grouped with external first | ||
- Naming: camelCase for functions/variables, PascalCase for types/interfaces | ||
- No console.log allowed in production code (use proper error handling) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# CLAUDE.md | ||
|
||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. | ||
|
||
## Development Commands | ||
|
||
### Build and Development | ||
- `npm run build` - Compile TypeScript to JavaScript in the `dist/` directory | ||
- `npm run dev` - Run the MCP server with the MCP Inspector for testing | ||
- `npm run prepublish` - Build the project and make the executable script executable | ||
|
||
### Code Quality | ||
- `npm run lint` - Run both ESLint and TypeScript checks | ||
- `npm run lint:eslint` - Run ESLint for code style checking | ||
- `npm run lint:tsc` - Run TypeScript compiler for type checking | ||
|
||
### Testing | ||
- `npm test` - Run all Jest tests | ||
- `npm run test:watch` - Run tests in watch mode during development | ||
- `npm run test:coverage` - Run tests with coverage reporting | ||
|
||
## Project Architecture | ||
|
||
This is an MCP (Model Context Protocol) server that integrates with Mailtrap's email service. The architecture follows a modular pattern: | ||
|
||
### Core Components | ||
- **src/index.ts**: Main MCP server entry point that registers all tools and handles the server lifecycle | ||
- **src/client.ts**: Mailtrap client configuration and initialization | ||
- **src/config/index.ts**: Server configuration constants | ||
|
||
### Tool Architecture | ||
All tools follow a consistent pattern in the `src/tools/` directory: | ||
- Each tool has its own subdirectory (e.g., `sendEmail/`, `templates/`) | ||
- Tools export both their implementation function and Zod schema for validation | ||
- Template operations are grouped under `templates/` with individual files for each CRUD operation | ||
|
||
### Tool Structure Pattern | ||
``` | ||
src/tools/{toolName}/ | ||
├── index.ts # Main tool export | ||
├── schema.ts # Zod validation schema | ||
├── {toolName}.ts # Tool implementation | ||
└── __tests__/ # Jest test files | ||
``` | ||
|
||
### Environment Variables Required | ||
- `MAILTRAP_API_TOKEN`: Required API token from Mailtrap | ||
- `DEFAULT_FROM_EMAIL`: Default sender email address | ||
- `MAILTRAP_ACCOUNT_ID`: Optional account ID for multi-account setups | ||
|
||
### Testing Setup | ||
- Uses Jest with TypeScript support via ts-jest | ||
- Test files are located in `__tests__/` directories within each tool | ||
- Environment variables are set up via `jest/setEnvVars.js` | ||
- Coverage reports exclude test files and type definitions | ||
|
||
### Build Configuration | ||
- TypeScript compilation targets ES2022 with CommonJS modules | ||
- Separate build config (`tsconfig.build.json`) excludes test files from distribution | ||
- Output goes to `dist/` directory with proper executable permissions | ||
|
||
### Available MCP Tools | ||
1. **send-email**: Send transactional emails through Mailtrap | ||
2. **create-template**: Create new email templates | ||
3. **list-templates**: List all email templates | ||
4. **update-template**: Update existing email templates | ||
5. **delete-template**: Delete email templates | ||
|
||
Each tool uses Zod schemas for input validation and follows the MCP protocol for response formatting. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.