Metadata-Version: 2.4
Name: bonito-mcp
Version: 1.4.2
Summary: MCP server for the Bonito AI Platform – manage providers, models, agents, and gateway routing.
Project-URL: Homepage, https://getbonito.com
Project-URL: Documentation, https://getbonito.com/docs
Project-URL: Repository, https://github.com/ShabariRepo/bonito
Author-email: Bonito AI <hello@getbonito.com>
License-Expression: MIT
Keywords: ai,bonito,gateway,llm,mcp
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.10
Requires-Dist: httpx>=0.25.0
Requires-Dist: mcp<2,>=1.14
Description-Content-Type: text/markdown

# Bonito MCP Server

A [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server that wraps the **Bonito AI Platform** REST API. Use it from Claude Desktop, Cursor, or any MCP-compatible client to manage your multi-provider AI infrastructure.

## Features

- **Provider Management** – Connect and verify AWS Bedrock, Azure, Google Vertex, OpenAI, Anthropic, Groq, OpenRouter and DeepInfra
- **Model Management** – List (by provider, search, chat-only), sync, and activate models
- **Unified Gateway** – Chat completions through Bonito's OpenAI-compatible gateway; gateway keys limited to providers or models (create, update, revoke)
- **Projects** – List and create projects (budget, retention)
- **Agents** – Create, update, run (with sessions) and disable agents
- **Knowledge Bases** – Create KBs, upload text documents, list their status, search them, link and unlink them to agents
- **Cost & Observability** – Gateway usage, request logs, and cloud billing per provider
- **Data Residency** – Keep model calls in one geography (CA, US, EU) and see which providers can serve (`get_data_residency`, `set_data_residency`)
- **Agents in your clouds** – List agents running in your own AWS and Google accounts (AgentCore, Bedrock Agents, Agent Registry, Agent Engine) with findings, let Bonito agents call them, and manage the relay that lets cloud agents call each other (`list_cloud_agents`, `connect_cloud_agent`, `agent_relay`, Pro+)

Total: 35 tools. 1.4.2 fixes the write tools: `create_agent` sent fields the API rejects (422), `create_knowledge_base` left out `source_type`, `upload_to_kb` posted JSON to a file-upload endpoint, `link_kb_to_agent` called a route that does not exist, and several tools sent parameters the API ignores (`create_project` budget, `list_models` filters, `gateway_usage` and `get_costs` periods). Errors now carry the API's own message, and empty (204) replies no longer crash. New: `update_agent`, `delete_agent`, `unlink_kb_from_agent`, `search_knowledge_base`, `list_kb_documents`, `revoke_gateway_key`. 1.4.1 fixed every tool failing with "ctx: Field required".

Use a `bp-` personal access token as `BONITO_API_KEY`: it works on both the management API and the gateway (`chat_completion`, `ask_decision`). A sign-in token works for management calls only.

Still missing (next pass): access-token CRUD, image and video generation, agent-to-agent connections, and applying a whole `bonito.yaml` in one call.

## Quick Start

### Install from source

```bash
git clone https://github.com/ShabariRepo/bonito.git
cd bonito/mcp-server
pip install -e .
```

### Set your API key

```bash
export BONITO_API_KEY="your-bonito-api-key"
```

### Run (stdio – for Claude Desktop)

```bash
bonito-mcp
```

### Run (SSE – for network clients)

```bash
bonito-mcp --transport sse --port 8080
```

## Claude Desktop Configuration

Add to your `claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "bonito": {
      "command": "bonito-mcp",
      "env": {
        "BONITO_API_KEY": "your-bonito-api-key"
      }
    }
  }
}
```

## Docker

```bash
docker build -t bonito-mcp .
docker run -e BONITO_API_KEY="your-key" -p 8080:8080 bonito-mcp
```

## Available Tools

| Tool | Description |
|------|-------------|
| `list_providers` | List connected AI providers |
| `connect_provider` | Connect a provider (credentials as an object) |
| `verify_provider` | Verify provider credentials |
| `list_models` | List models: provider type, search, chat only |
| `sync_models` | Refresh models from one or all providers |
| `activate_model` | Enable a model on your cloud account |
| `chat_completion` | Chat completion through the gateway (needs a bp- token) |
| `ask_decision` | TypeSafe Jev typed decisions (needs a bp- token) |
| `list_gateway_keys` | List gateway keys |
| `create_gateway_key` | Create a gateway key, optionally limited to providers or models |
| `update_gateway_key` | Change a key's name, rate limit, or limits |
| `revoke_gateway_key` | Revoke a gateway key |
| `gateway_usage` | Usage statistics for the last N days |
| `get_gateway_logs` | Gateway request logs |
| `get_data_residency` | Residency setting and which providers can serve |
| `set_data_residency` | Keep model calls in CA, US or EU |
| `list_projects` | List projects |
| `create_project` | Create a project (budget, retention) |
| `list_agents` | List agents in a project |
| `get_agent` | Agent details, including its knowledge bases |
| `create_agent` | Create an agent |
| `update_agent` | Change an agent (only what you pass) |
| `delete_agent` | Disable an agent |
| `execute_agent` | Run an agent, optionally continuing a session |
| `list_knowledge_bases` | List knowledge bases |
| `create_knowledge_base` | Create a knowledge base |
| `upload_to_kb` | Upload text documents (one file each) |
| `list_kb_documents` | A knowledge base's documents and their status |
| `search_knowledge_base` | Search a knowledge base |
| `link_kb_to_agent` | Let an agent search a knowledge base |
| `unlink_kb_from_agent` | Stop an agent searching a knowledge base |
| `list_cloud_agents` | Agents in your AWS and Google accounts, with findings |
| `connect_cloud_agent` | Let a Bonito agent call a cloud agent |
| `agent_relay` | Routes and call records for cloud agents calling each other |
| `get_costs` | Cloud billing for a provider over a date range |

## Environment Variables

| Variable | Required | Default | Description |
|----------|----------|---------|-------------|
| `BONITO_API_KEY` | Yes | – | A Bonito personal access token (`bp-`) |
| `BONITO_API_URL` | No | `https://api.getbonito.com` | API base URL |

## License

MIT
