npm package: @smashsend/mcp-server
Description: SMASHSEND Model Context Protocol Server - Official MCP server for SMASHSEND API
Author: SMASHSEND
Latest version: 1.0.0

# 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

```bash
npm install @smashsend/mcp-server
# or
pnpm add @smashsend/mcp-server
# or
yarn add @smashsend/mcp-server
```

### For Development

```bash
git clone https://github.com/smashsend/mcp-server.git
cd mcp-server
pnpm install
```

## 🚀 Usage

### Using as an npm Package

```typescript
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

```typescript
// 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

```typescript
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:

```bash
SMASHSEND_API_KEY=your_smashsend_api_key_here
```

## 🌐 Vercel Deployment

### One-Click Deploy

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/smashsend/mcp-server&env=SMASHSEND_API_KEY)

### Manual Deployment

1. **Install Vercel CLI**:

   ```bash
   npm install -g vercel
   ```

2. **Deploy**:

   ```bash
   vercel
   ```

3. **Set Environment Variables**:

   ```bash
   vercel env add SMASHSEND_API_KEY
   ```

4. **Deploy to Production**:
   ```bash
   vercel --prod
   ```

### Configuration

The project includes a `vercel.json` for optimal configuration:

```json
{
  "functions": {
    "app/[transport]/route.ts": {
      "maxDuration": 800
    }
  }
}
```

## 🧪 Local Development

### Running the Development Server

```bash
npm run dev
```

The server will be available at `http://localhost:3000`.

### Testing

Test your MCP server locally:

```bash
# 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:

```typescript
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

```bash
npm run build:npm
```

This creates:

- `dist/index.js` - CommonJS build
- `dist/index.mjs` - ESM build
- `dist/index.d.ts` - TypeScript definitions

### Build for Vercel

```bash
npm run build:next
```

### Build Everything

```bash
npm run build
```

## 📝 Publishing

### Publish to npm

```bash
# Beta release
npm run publish-beta

# Stable release
npm run publish-stable
```

## 🤝 Contributing

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

## 📄 License

MIT © SMASHSEND

## 🔗 Links

- [SMASHSEND Website](https://smashsend.com)
- [API Documentation](https://docs.smashsend.com)
- [Model Context Protocol](https://modelcontextprotocol.io)
- [npm Package](https://www.npmjs.com/package/@smashsend/mcp-server)