Skip to main content
Glama
KoboToolbox MCP Server

KoboToolbox MCP Server

by PYI-SOE-LTD
README.md
# KoboToolbox MCP Server

An MCP (Model Context Protocol) server that connects [KoboToolbox](https://www.kobotoolbox.org/) to AI assistants like Claude Desktop, Claude Code, and Microsoft Copilot Studio.

## Features

- **Dual Mode Support**: Works as both REST API and MCP Protocol server
- **Full KoboToolbox Integration**: List projects, query submissions, get form schemas, aggregate data
- **Multiple Client Support**: Claude Desktop, Claude Code, Copilot Studio, and any MCP-compatible client

## Available Tools

| Tool | Description |
|------|-------------|
| `listProjects` | List all KoboToolbox projects |
| `getProjectSummary` | Get submission count for a project |
| `getProjectSchema` | Get form questions/fields |
| `queryProjectData` | Query submissions with filters |
| `getCountsBy` | Aggregate counts by a field |
| `getTimeWindowSummary` | Summary for a date range |

## Quick Start

### 1. Clone and Install

```bash
git clone https://github.com/Admin-PSS/kobo-mcp-server.git
cd kobo-mcp-server
pip install -r requirements.txt
```

### 2. Configure Environment

Create a `.env` file:

```env
KOBO_TOKEN=your-kobo-api-token
KOBO_BASE=https://kf.kobotoolbox.org/api/v2
```

Get your API token from KoboToolbox: **Account Settings > Security > API Key**

### 3. Run the Server

**REST API mode:**
```bash
python server.py
# or
uvicorn server:app --reload --port 8000
```

**MCP stdio mode (for Claude Desktop):**
```bash
python mcp_server.py
```

## Client Configuration

### Claude Desktop

Add to `claude_desktop_config.json`:

**Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
**macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`

```json
{
  "mcpServers": {
    "kobo": {
      "command": "python",
      "args": ["C:\\path\\to\\mcp_server.py"],
      "env": {
        "KOBO_TOKEN": "your-kobo-api-token",
        "KOBO_BASE": "https://kf.kobotoolbox.org/api/v2"
      }
    }
  }
}
```

### Claude Code

```bash
claude mcp add kobo python /path/to/mcp_server.py -e KOBO_TOKEN=your-token
```

### Microsoft Copilot Studio

Import the OpenAPI spec from your deployed server:
```
https://your-server-url/openapi.json
```

## REST API Endpoints

| Endpoint | Method | Description |
|----------|--------|-------------|
| `/actions/listProjects` | GET | List all projects |
| `/actions/getProjectSummary` | GET | Get submission count |
| `/actions/getProjectSchema` | GET | Get form fields |
| `/actions/queryProjectData` | POST | Query with filters |
| `/actions/getCountsBy` | GET | Aggregate by field |
| `/actions/getTimeWindowSummary` | GET | Date range summary |

## MCP over HTTP/SSE

For remote MCP clients:

- **SSE Stream:** `GET /mcp/sse`
- **Messages:** `POST /mcp/message`
- **Tools List:** `GET /mcp/tools`

## Environment Variables

| Variable | Required | Default |
|----------|----------|---------|
| `KOBO_TOKEN` | Yes | - |
| `KOBO_BASE` | No | `https://kf.kobotoolbox.org/api/v2` |

## License

MIT

## Links

- [KoboToolbox](https://www.kobotoolbox.org/)
- [MCP Protocol](https://modelcontextprotocol.io/)