@smashsend/mcp-server
v1.0.0
Published
SMASHSEND Model Context Protocol Server - Official MCP server for SMASHSEND API
Downloads
5
Maintainers
Readme
SMASHSEND MCP Server
A Model Context Protocol (MCP) server for SMASHSEND email marketing platform. Available as an npm package and deployable to Vercel.
📦 Installation
As an npm Package
npm install @smashsend/mcp-server
# or
pnpm add @smashsend/mcp-server
# or
yarn add @smashsend/mcp-serverFor Development
git clone https://github.com/smashsend/mcp-server.git
cd mcp-server
pnpm install🚀 Usage
Using as an npm Package
import { createSmashsendMcpServer } from "@smashsend/mcp-server";
// Create MCP server with default options
const mcpHandler = createSmashsendMcpServer();
// Or with custom configuration
const mcpHandler = createSmashsendMcpServer({
basePath: "/api/mcp",
verboseLogs: true,
maxDuration: 1000,
});Next.js App Router Integration
// app/api/mcp/[transport]/route.ts
import { createSmashsendMcpServer } from "@smashsend/mcp-server";
const handler = createSmashsendMcpServer({
basePath: "/api/mcp",
});
export { handler as GET, handler as POST, handler as DELETE };Express Integration
import express from "express";
import { createSmashsendMcpServer } from "@smashsend/mcp-server";
const app = express();
const mcpHandler = createSmashsendMcpServer();
app.all("/mcp/*", mcpHandler);Environment Variables
Set your SMASHSEND API key:
SMASHSEND_API_KEY=your_smashsend_api_key_here🌐 Vercel Deployment
One-Click Deploy
Manual Deployment
Install Vercel CLI:
npm install -g vercelDeploy:
vercelSet Environment Variables:
vercel env add SMASHSEND_API_KEYDeploy to Production:
vercel --prod
Configuration
The project includes a vercel.json for optimal configuration:
{
"functions": {
"app/[transport]/route.ts": {
"maxDuration": 800
}
}
}🧪 Local Development
Running the Development Server
npm run devThe server will be available at http://localhost:3000.
Testing
Test your MCP server locally:
# Test connection
npm run test:connection
# Test tools manually
npm run test:tools
# Full MCP protocol test
npm run test:mcp:full
# Test against local server
npm run test:local📚 Available Tools
The MCP server provides the following tools:
1. createOrUpdateContact
Create or update a contact in SMASHSEND (updates if email exists).
2. searchContact
Find a contact by email address.
3. listContactProperties
List all available contact properties (default and custom).
4. createContactProperty
Create a custom contact property.
5. sendEmail
Send an email (raw or templated).
🔧 Configuration Options
When creating the MCP server, you can provide the following options:
interface McpServerOptions {
basePath?: string; // Base path for the MCP server (default: "")
verboseLogs?: boolean; // Enable verbose logging (default: false in production)
maxDuration?: number; // Maximum request duration in ms (default: 800)
}🏗️ Building
Build for npm Package
npm run build:npmThis creates:
dist/index.js- CommonJS builddist/index.mjs- ESM builddist/index.d.ts- TypeScript definitions
Build for Vercel
npm run build:nextBuild Everything
npm run build📝 Publishing
Publish to npm
# Beta release
npm run publish-beta
# Stable release
npm run publish-stable🤝 Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📄 License
MIT © SMASHSEND
