Skip to main content
Glama
harishnethi
by harishnethi
README.md
# Brevo FastMCP

A FastMCP server for integrating with the Brevo API. It allows GitHub Copilot to manage Brevo contacts and import/export leads using TSV files.

---

# Features

- List Brevo contacts
- Create or update Brevo contacts
- Export Brevo contacts to TSV
- Import TSV contacts into Brevo
- Pydantic models
- Logging
- FastMCP Integration
- GitHub Copilot MCP

---

# Project Structure

```text
brevo-fastmcp-v2/
│
├── server.py
├── requirements.txt
├── README.md
├── .env
│
└── src/
    ├── __init__.py
    ├── brevo.py
    ├── config.py
    ├── models.py
    ├── tools.py
    ├── tsv.py
    └── utils.py
```

---

# Requirements

- Python 3.12+
- Git
- VS Code
- GitHub Copilot
- Brevo Account
- Brevo API Key

---

# Installation

## Clone Repository

```bash
git clone <repository-url>
```

Go to the project directory

```bash
cd brevo-fastmcp-v2
```

---

## Create Virtual Environment

Windows

```bash
python -m venv .venv
```

Activate

Command Prompt

```bash
.venv\Scripts\activate
```

PowerShell

```powershell
.\.venv\Scripts\Activate.ps1
```

---

## Install Dependencies

```bash
pip install -r requirements.txt
```

or

```bash
pip install fastmcp requests python-dotenv pydantic
```

---

## Verify Installation

```bash
python --version
```

```bash
pip --version
```

```bash
fastmcp version
```

---

# Environment Variables

Create a file named

```text
.env
```

Add

```env
BREVO_API_KEY=your_brevo_api_key
```

---

# Verify API Key

```bash
python -c "import os,requests; from dotenv import load_dotenv; load_dotenv(); r=requests.get('https://api.brevo.com/v3/account', headers={'api-key': os.getenv('BREVO_API_KEY'),'accept':'application/json'}); print(r.status_code); print(r.text)"
```

Expected

```text
200
```

---

# Run MCP Server

```bash
python server.py
```

Expected Output

```text
FastMCP 3.x.x

Starting MCP server 'Brevo FastMCP'

Discovered 4 tools
```

---

# Available MCP Tools

| Tool | Description |
|------|-------------|
| list_contacts | List Brevo contacts |
| add_contact | Create or update a contact |
| export_brevo_to_tsv | Export Brevo contacts to TSV |
| import_tsv_to_brevo | Import TSV contacts into Brevo |

---

# Example Prompts

### List Contacts

```
List my Brevo contacts
```

---

### Add Contact

```
Create a contact

Email: john@example.com
First Name: John
Last Name: Doe
```

---

### Export Contacts

```
Export all Brevo contacts to contacts.tsv
```

---

### Import Contacts

```
Import contacts from contacts.tsv
```

---

# Troubleshooting

## Unauthorized (401)

If you receive

```text
401 Unauthorized
```

Run

```bash
python -c "import os,requests; from dotenv import load_dotenv; load_dotenv(); r=requests.get('https://api.brevo.com/v3/account', headers={'api-key': os.getenv('BREVO_API_KEY'),'accept':'application/json'}); print(r.status_code); print(r.text)"
```

If the response says

```text
Unrecognised IP Address
```

Go to

```
Brevo
→ Settings
→ Security
→ Authorized IPs
```

Add your current public IP address.

Restart the MCP server.

---

# Useful Commands

Activate Virtual Environment

```bash
.venv\Scripts\activate
```

Deactivate

```bash
deactivate
```

Upgrade pip

```bash
python -m pip install --upgrade pip
```

Upgrade FastMCP

```bash
pip install --upgrade fastmcp
```

List Installed Packages

```bash
pip list
```

Check FastMCP Version

```bash
fastmcp version
```

Run Server

```bash
python server.py
```

---

# Tech Stack

- Python 3.12
- FastMCP
- Brevo REST API
- Pydantic
- Requests
- Python Dotenv
- GitHub Copilot MCP
- TSV (Tab Separated Values)

---

# Author

Harish Nethi# brevo-mcp
# brevo-mcp