REST API & Model Context Protocol
Universal platform for programmatic micro-site generation, sequential Box Chains, client-side WebCrypto encryption, and Model Context Protocol (MCP) tool integration.
Model Context Protocol (MCP) Server
Bitty Box exposes an official MCP Server that grants AI agents the native ability to generate interactive code viewers, markdown reports, sandboxed web applications, and multi-step Box Chains on demand.
MCP Client Configurations
Add to your claude_desktop_config.json:
{
"mcpServers": {
"bittybox": {
"type": "http",
"url": "https://bittybox.org/mcp",
"headers": {
"Authorization": "Bearer ",
"Accept": "application/json, text/event-stream",
"MCP-Protocol-Version": "2025-06-18"
}
}
}
}
Add to .cursor/mcp.json or your global Cursor Settings > Features > MCP:
{
"mcpServers": {
"bittybox": {
"url": "https://bittybox.org/mcp",
"headers": {
"Authorization": "Bearer "
}
}
}
}
Run in your terminal using the Claude Code CLI:
claude mcp add --transport http bittybox https://bittybox.org/mcp --header "Authorization: Bearer "
Add to ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"bittybox": {
"serverUrl": "https://bittybox.org/mcp",
"headers": {
"Authorization": "Bearer "
}
}
}
}
Exposed MCP Tools Reference (17)
| Parameter | Type | Requirement | Description |
|---|---|---|---|
| content | string | required | The document body or code to compress. |
| title | string | optional | Document title or filename (e.g. "report.md", "app.py"). |
| format | enum | optional (default: auto) | "auto" | "markdown" | "code" | "html" | "json" | "svg" | "canvas" | "recipe" | "raw". |
| language | string | optional | Programming language for syntax highlighting (python, js, rust, go, bash, etc.). |
| theme | enum | optional (default: auto) | "auto" | "dark" | "light". |
| password | string | optional | AES-256-GCM encryption passcode. Payload will be encrypted client-side. |
| editable | boolean | optional | Open directly into the Bitty Box rich editor workspace. |
{
"content": "# Deploy Report
All 14 microservices passed canary verification.
- API: OK
- DB: OK",
"title": "deploy-report.md",
"format": "markdown",
"theme": "dark"
}
| Parameter | Type | Requirement | Description |
|---|---|---|---|
| title | string | required | Title of the entire box chain. |
| pages | array<object> | required | Array of pages (title, content, format, language, description, favicon, lockConfig). |
{
"title": "FastAPI Crash Course",
"pages": [
{ "title": "1. Introduction", "content": "# FastAPI Quickstart
Build robust APIs fast.", "format": "markdown" },
{ "title": "2. Main App", "content": "from fastapi import FastAPI
app = FastAPI()
@app.get('/')
def root(): return {'hello': 'world'}", "format": "code", "language": "python" },
{ "title": "3. Finish", "content": "You're all set!
", "format": "html" }
]
}
| Parameter | Type | Requirement | Description |
|---|---|---|---|
| code | string | required | The source code snippet or file contents. |
| language | string | optional | Programming language (python, typescript, rust, go, bash, sql, etc.). |
| title | string | optional | Filename with extension (e.g. "worker.ts"). |
| Parameter | Type | Requirement | Description |
|---|---|---|---|
| markdown | string | required | Markdown text document. |
| title | string | optional | Document title. |
| Parameter | Type | Requirement | Description |
|---|---|---|---|
| html | string | required | Complete HTML document string. |
| title | string | optional | App title. |
| Parameter | Type | Requirement | Description |
|---|---|---|---|
| url | string | required | The full Bitty Box URL to inspect and decompress. |
| password | string | optional | Passcode if the URL is AES-256-GCM encrypted. |
| Tool Name | Action | Key Arguments |
|---|---|---|
| create_box | Create server-gated box | title, bittyUrl or payload, lockConfig |
| set_password_lock | Attach password verification policy | boxId, password |
| set_time_lock | Set time release / expiration window | boxId, notBefore, notAfter |
| set_access_limit | Set maximum allowed opens | boxId, maxOpens |
| set_invite_only | Grant access to specific emails | boxId, allowedEmails[] |
| publish_box | Activate box for access | boxId |
| list_boxes | List user's active boxes | limit, offset |
| unlock_box | Evaluate locks and issue payload token | boxId, password, email |
| delete_box | Permanently delete and revoke box | boxId |
REST API Reference
๐ Authentication & API Keys
Public URL-native links can be created without authentication. For link attribution, credit balance tracking, and server-gated lockboxes, include your API key in either of the following headers:
Authorization: Bearer bb_live_...
X-API-Key: bb_live_...
X-Session-Id: <SESSION_ID>
Create a compressed, self-contained Bitty Link. Aliased as /api/agent/url and /api/bitty.
{
"content": "def add(a, b):
return a + b",
"title": "math.py",
"format": "code", // "auto" | "code" | "markdown" | "html" | "json" | "svg"
"language": "python", // optional language
"theme": "dark", // "auto" | "dark" | "light"
"password": "" // optional AES-256-GCM encryption passcode
}
{
"success": true,
"url": "https://bittybox.org/#math.py/data:text/html;charset=utf-8;format=gz;base64,7ZVNS8NAEIZ/...",
"title": "math.py",
"format": "code",
"language": "python",
"stats": {
"rawBytes": 38,
"renderedBytes": 7420,
"compressedBytes": 2390,
"urlLength": 3280,
"compressionRatio": "67%"
},
"markdownLink": "[math.py](https://bittybox.org/#math.py/...)"
}
curl -sS https://bittybox.org/api/bitty/create -H "Content-Type: application/json" -d '{"title":"demo.md","format":"markdown","content":"# Hello World
URL-native micro-sites."}'
Create a sequential multi-box Box Chain. Aliased as /api/agent/box-chain and /api/bitty/box-chain.
{
"title": "Product Walkthrough",
"pages": [
{ "title": "1. Overview", "content": "# Overview
Welcome!", "format": "markdown" },
{ "title": "2. Step 1", "content": "console.log('Step 1');", "format": "code", "language": "javascript" },
{ "title": "3. Summary", "content": "Complete
", "format": "html" }
]
}
{
"success": true,
"chainId": "bbc_82f10b...",
"total": 3,
"title": "1. Overview",
"primaryUrl": "https://bittybox.org/#/1.-Overview/ch/bbc_82f10b...~0~3/nx/.../data:...",
"urls": [
"https://bittybox.org/#/1.-Overview/ch/bbc_82f10b...~0~3/nx/.../data:...",
"https://bittybox.org/#/2.-Step-1/ch/bbc_82f10b...~1~3/nx/.../data:...",
"https://bittybox.org/#/3.-Summary/ch/bbc_82f10b...~2~3/data:..."
]
}
Decompress any Bitty Box URL back to its original raw content. Aliased as /api/agent/inspect.
{
"url": "https://bittybox.org/#demo.md/data:text/html;charset=utf-8;format=gz;base64,..."
}
{
"success": true,
"title": "demo.md",
"mediatype": "text/html",
"content": "...",
"byteLength": 7420
}
Returns supported formats (markdown, code, html, json, svg, canvas, recipe, text) and platform capabilities.
System health check, AI model status, and uptime verification.
Create a server-gated box with server-side policies (time window, view limits, password locks).
curl -sS https://bittybox.org/api/boxes -H "Content-Type: application/json" -H "Authorization: Bearer " -d '{
"title": "confidential-briefing",
"bittyUrl": "https://bittybox.org/#brief/data:...",
"lockConfig": {
"timeWindow": { "enabled": true, "notAfter": "2026-12-31T23:59:59Z" },
"openLimit": { "enabled": true, "maxOpens": 3 }
}
}'
Interactive API Playground
Status Codes & Errors
| Status Code | Reason | Description |
|---|---|---|
| 200 OK | Success | Payload compressed, decoded, or retrieved successfully. |
| 400 Bad Request | Validation Error | Missing required content, malformed JSON, or payload exceeding size limits. |
| 401 Unauthorized | Auth Failure | Missing or invalid API key on authenticated endpoints. |
| 402 Payment Required | Insufficient Credits | Account balance has exhausted free generation quota. Top up in Accounts. |
| 403 Forbidden | Policy Gated | Lock conditions not satisfied (e.g. invalid passcode, time expired, open limit reached). |
| 404 Not Found | Missing Box | Server box ID does not exist or has been deleted. |
| 429 Too Many Requests | Rate Limited | Exceeded request burst rate. Please backoff with jitter. |