TeleBotHost MCP Server
OfficialProvides tools to manage Telegram bots via the TeleBotHost Developer API, including creating, updating, and listing bots, as well as broadcast and download/import functionality.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@TeleBotHost MCP Serverlist my active bots"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
TeleBotHost MCP Server
A Model Context Protocol server for the TeleBotHost Developer API — 68 tools to manage Telegram bots from AI assistants like Claude, Cursor, and Copilot.
Features
68 Tools — Full coverage of the TeleBotHost Developer API + 3 docs search tools
Multi-Platform — Deploys on Vercel, Render, Railway, Fly.io, or any Node host
Secure — Bearer token auth, optional MCP endpoint protection, key-tier awareness (
sk_*vspub_*)Resilient — Automatic 429 retry with exponential backoff, rate-limit header tracking
Binary-Safe — Base64-encoded ZIP download/upload for
download_botandimport_botSafe by Design — Broadcast tool requires explicit
confirm: trueflagTested — Compliance test suite verifies MCP spec adherence (
scripts/test-mcp.sh)Type-Safe — Strict TypeScript throughout, clean compile
Zero-Config — Single env var (
TELEBOTHOST_API_KEY) to get started
Related MCP server: Telegram Bot MCP Server
Table of Contents
Architecture
┌─────────────────┐ POST /api/mcp ┌─────────────────────┐ Bearer sk_* ┌─────────────────────┐
│ │ JSON-RPC 2.0 │ MCP Server │ HTTPS │ TeleBotHost API │
│ Claude Desktop │ ───────────────────▶ │ (stateless) │ ───────────────────▶ │ api.telebothost.com│
│ Cursor │ │ 68 tools │ │ │
│ Continue │ ◀─────────────────── │ JSON-RPC router │ ◀─────────────────── │ 64 endpoints │
│ Cline │ JSON response │ TBH API client │ JSON │ │
└─────────────────┘ └─────────────────────┘ └─────────────────────┘
│
▼
┌─────────────────┐
│ Vercel │ ← api/mcp.ts (serverless)
│ OR Render │ ← server.ts (Node HTTP)
│ OR Railway │
│ OR Fly.io │
└─────────────────┘Transport: Streamable HTTP (stateless JSON-RPC 2.0 over HTTP POST) Runtime: Node.js 20+ · TypeScript 5.9 · @modelcontextprotocol/sdk 1.x
Quick Start
1. Get your TeleBotHost API key
Log in to TeleBotHost
Go to Developer Settings → API Keys
Generate a key:
sk_*— Secret key (full write access) — keep privatepub_*— Public key (read-only) — safe for client-side
2. Deploy (pick a platform)
Platform | One-click | Difficulty |
Vercel | Easiest | |
Render | Easy | |
Railway |
| Medium |
Fly.io |
| Medium |
Self-host |
| Medium |
3. Connect your AI client
See Connecting Your AI Client below.
Deployment
Vercel (Recommended)
One-click deploy:
Manual deploy:
# Clone
git clone https://github.com/telebothost/mcp-server.git
cd telebothost-mcp
npm install
# Set env var
vercel env add TELEBOTHOST_API_KEY production
# Paste your sk_* key when prompted
# Deploy
vercel --prodYour MCP endpoint: https://your-project.vercel.app/api/mcp
Render
This repo includes a render.yaml blueprint.
Option A — Dashboard (easiest):
Push this repo to your GitHub
Go to Render Dashboard → New → Blueprint
Select your repo — Render auto-detects
render.yamlAdd
TELEBOTHOST_API_KEYas a secret env varClick Apply
Option B — CLI:
# Install Render CLI
npm i -g @render-ai/render-cli
# Link & deploy
render blueprint deployYour MCP endpoint: https://telebothost-mcp.onrender.com/api/mcp
Railway / Fly.io / Self-Host
These platforms use the generic Node server (server.ts) via npm start.
# Clone & install
git clone https://github.com/telebothost/mcp-server.git
cd telebothost-mcp
npm install
# Set env vars
export TELEBOTHOST_API_KEY=sk_your_key_here
# Optional: export MCP_AUTH_TOKEN=your_mcp_protection_token
# Start
npm start
# → [telebothost-mcp v1.0.0] MCP server listening on :3000Railway:
railway init
railway up
# Set TELEBOTHOST_API_KEY in Railway dashboardFly.io:
fly launch --no-deploy
fly secrets set TELEBOTHOST_API_KEY=sk_your_key_here
fly deployDocker (any host):
docker build -t telebothost-mcp .
docker run -p 3000:3000 -e TELEBOTHOST_API_KEY=sk_xxx telebothost-mcpEndpoint: http://localhost:3000/api/mcp
Connecting Your AI Client
Once deployed, point any MCP-compatible client at your endpoint. Pass your TeleBotHost API key in the X-Tbh-Api-Key header so each call uses your own TBH quota — the server never stores your key.
Claude Desktop
Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"telebothost": {
"url": "https://your-deployed-url/api/mcp",
"transport": "http",
"headers": {
"X-Tbh-Api-Key": "sk_your_telebothost_key_here"
}
}
}
}Cursor
Settings → MCP → Add Server:
{
"mcpServers": {
"telebothost": {
"url": "https://your-deployed-url/api/mcp",
"headers": {
"X-Tbh-Api-Key": "sk_your_telebothost_key_here"
}
}
}
}VS Code (with Cline / Continue)
Add to your MCP settings:
{
"mcp.servers": {
"telebothost": {
"url": "https://your-deployed-url/api/mcp",
"headers": {
"X-Tbh-Api-Key": "sk_your_telebothost_key_here"
}
}
}
}With MCP_AUTH_TOKEN protection (server-side access control)
If the server has MCP_AUTH_TOKEN set (to restrict WHO can call the MCP), add both headers:
{
"mcpServers": {
"telebothost": {
"url": "https://your-deployed-url/api/mcp",
"headers": {
"Authorization": "Bearer your-mcp-auth-token",
"X-Tbh-Api-Key": "sk_your_telebothost_key_here"
}
}
}
}Authorization: Bearer ...→ authenticates you to the MCP server (theMCP_AUTH_TOKEN)X-Tbh-Api-Key: ...→ your TeleBotHost API key (forwarded to TBH API)
Test with curl
# List all tools (no TBH key needed)
curl -X POST https://your-deployed-url/api/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'
# Call a public tool (no TBH key needed)
curl -X POST https://your-deployed-url/api/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"get_status","arguments":{}}}'
# Call an authenticated tool (pass your TBH key)
curl -X POST https://your-deployed-url/api/mcp \
-H "Content-Type: application/json" \
-H "X-Tbh-Api-Key: sk_your_key_here" \
-d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"list_bots","arguments":{}}}'API Key Resolution (Priority Order)
When a tools/call request arrives, the server resolves the TBH API key in this order:
Priority | Source | When to use |
1 |
| Recommended — each user passes their own key per-request |
2 |
| Only used if |
3 |
| Server-side fallback for single-user / self-hosted setups |
Best practice: Don't set TELEBOTHOST_API_KEY on the server. Let each client pass X-Tbh-Api-Key so everyone uses their own TBH quota.
Available Tools (68)
Health (1)
Tool | Description |
| API health & version probe |
Public Discovery (9) — no auth required
Tool | Description |
| Get a user's public profile |
| List a user's published bots & templates |
| Get a published bot by Telegram username |
| Get published bot README only |
| Browse shareable bot templates |
| Get a template by ID |
| Get template README |
| Browse community store (public) |
| Get a store listing (public) |
| Fetch active ads feed (public) |
Bot Lifecycle (20) — sk_* key required for writes
Tool | Description |
| List your bots + statistics |
| Register a new bot |
| Soft-delete bots (10-day backup) |
| List soft-deleted bots |
| Recover a soft-deleted bot |
| Permanently delete from backup |
| Pin / unpin bots |
| Get single bot details |
| Update bot config |
| Generate temp JWT download URL |
| Download bot ZIP (base64-encoded binary) |
| Import bot from base64-encoded ZIP |
| Clone a bot or template |
| Clone as child (inherits env/commands) |
| List child bots of a parent |
| Transfer bot to another user |
| Reset logs & sessions |
| Toggle template status |
| Get bot README (owner) |
| Update README (template only) |
Bot Storage (4)
Tool | Description |
| Sync/async storage size & metrics |
| List storage keys (no values) |
| Clear all storage (irreversible) |
| Migrate sync → async storage |
Broadcasts (6)
Tool | Description |
| Start a broadcast ( |
| Real-time broadcast progress |
| Stop an active broadcast |
| Modify message body mid-run |
| Delete broadcast history record |
| List broadcasts for a bot |
Commands (13) — full CRUD + folder management
Tool | Description |
| List commands & folders |
| Create a new command |
| Get a single command by ID |
| Update command code, answer, aliases, folder |
| Soft-delete a command (7-day recovery) |
| Batch soft-delete commands |
| Permanently delete a soft-deleted command |
| List soft-deleted commands |
| Recover a deleted command |
| List command folders |
| Create a command folder |
| Rename a command folder |
| Delete a folder (unassigns commands) |
Environment Variables (5)
Tool | Description |
| List all env vars for a bot |
| Create an env var |
| Get a single env var |
| Update an env var |
| Delete an env var |
Logs & Analytics (3)
Tool | Description |
| Get runtime/error logs |
| Clear all logs (irreversible) |
| User growth, activity & chat-type stats |
Community Store (2)
Tool | Description |
| Browse store (authenticated) |
| Install a store bot |
Quota (1)
Tool | Description |
| Check daily / per-minute / monthly limits |
Docs Search (3) — no auth required
Tool | Description |
| Search TeleBotHost Developer API (OpenAPI spec) by keyword |
| Search TBL scripting language documentation |
| Search Telegram Bot API docs at core.telegram.org |
MCP Protocol
This server implements the Model Context Protocol Streamable HTTP transport in stateless mode — perfect for serverless platforms.
JSON-RPC 2.0 Methods Supported
Method | Behavior |
| Returns |
| Returns HTTP 202 (acknowledged, no body) |
| Returns empty |
| Returns all 68 tool definitions (name, description, inputSchema) |
| Executes a tool by name with arguments; returns |
Stateless Design
Each HTTP request creates a fresh server instance — no session persistence, no in-memory state. This means:
Works on Vercel serverless, AWS Lambda, Cloudflare Workers
Horizontally scalable (any number of replicas)
No cold-start session affinity issues
No server-initiated notifications (clients must poll)
No SSE streaming (single JSON response per request)
Request/Response Format
Request:
POST /api/mcp HTTP/1.1
Content-Type: application/json
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "list_bots",
"arguments": {}
}
}Success response:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"content": [{ "type": "text", "text": "{...bot data as JSON...}" }]
}
}Error response (tool-level):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"content": [{ "type": "text", "text": "TeleBotHost API error 403: ..." }],
"isError": true
}
}Error response (protocol-level):
{
"jsonrpc": "2.0",
"id": 1,
"error": { "code": -32601, "message": "Method not found: foo/bar" }
}Error Handling
The server implements a layered error handling strategy:
Layer 1: Protocol Errors (JSON-RPC)
Returned as {error: {code, message}} per the JSON-RPC 2.0 spec:
Code | Meaning | When |
| Parse error | Invalid JSON in request body |
| Invalid Request | Missing |
| Method not found | Unknown JSON-RPC method |
| Invalid params | Unknown tool name |
| Internal error | Unexpected exception in handler |
Layer 2: Tool Errors (MCP isError)
When a tool executes but the upstream TBH API returns an error, the response includes isError: true with the error details in the content text field. The AI client can read this and decide how to proceed (retry, ask user, etc.).
{
"content": [{
"type": "text",
"text": "TeleBotHost API error 429: Rate limit exceeded. Retry after 60s."
}],
"isError": true
}Layer 3: Automatic Retry
HTTP 429 responses from the TBH API are automatically retried up to 3 times with exponential backoff:
Attempt | Delay |
1 | 2s (or |
2 | 4s |
3 | 8s |
After 3 retries, the 429 is surfaced as a tool error.
Layer 4: Cloudflare Detection
The TBH API is behind Cloudflare, which may challenge datacenter IPs. The client detects Cloudflare challenge responses (HTTP 403 + cf_chl in body) and returns a user-friendly message instead of the raw HTML challenge page.
Testing
Tool Coverage Check
npm run test:coverage
# → Asserts exactly 68 tools, unique snake_case names, required tools presentCompliance Test Suite
The repo includes a bash-based compliance test suite that verifies MCP spec adherence:
# Test against local server
npm start &
sleep 2
npm run test:mcp
# Test against production
MCP_URL=https://tbh-mcp.vercel.app/api/mcp npm run test:mcp
# With auth token
MCP_URL=https://your-url/api/mcp MCP_TOKEN=xxx npm run test:mcp
# Bash variant (optional)
MCP_URL=http://localhost:3000/api/mcp ./scripts/test-mcp.shWhat it verifies:
initializehandshake returns correct protocol version & server infopingreturns a resulttools/listreturns exactly 68 toolsAll tools have
name+description+inputSchemaAll tools use clean names (no
telebothost_prefix)tools/callrejects unknown tools with error-32602Invalid JSON returns
-32700parse errorGET method returns HTTP 405 (only POST allowed)
All required tools are present (10 critical tools checked)
CI (.github/workflows/ci.yml) runs typecheck, coverage, smoke tests, and a Docker build on every push/PR to main.
Type Safety
npm run typecheck
# → tsc --noEmit (strict mode, zero errors)Manual Smoke Test
# Initialize
curl -X POST $MCP_URL -H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}'
# List tools
curl -X POST $MCP_URL -H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}'
# Call a tool
curl -X POST $MCP_URL -H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"get_status","arguments":{}}}'API Coverage
This MCP server covers 100% of the TeleBotHost Developer API — every endpoint in the OpenAPI 3.0.3 spec is mapped to a tool.
Group | Endpoints | Tools | Coverage |
Health | 1 | 1 | 100% |
Public Discovery | 10 | 10 | 100% |
Bot Lifecycle | 20 | 20 | 100% |
Bot Storage | 4 | 4 | 100% |
Broadcasts | 6 | 6 | 100% |
Commands + Folders | 13 | 13 | 100% |
Env Vars | 5 | 5 | 100% |
Logs & Analytics | 3 | 3 | 100% |
Community Store | 2 | 2 | 100% |
Quota (helper) | — | 1 | N/A (reuses |
Docs Search | — | 3 | N/A (fetches external docs) |
Total | 64 | 68 | Full coverage |
Binary Endpoints (Expert Implementation)
Two endpoints involve binary data (ZIP files) which MCP's JSON model doesn't natively support. They're handled via base64 encoding:
Endpoint | Tool | Approach |
|
| Downloads ZIP as |
|
| Accepts base64-encoded ZIP, decodes to |
Example download_bot response:
{
"success": true,
"content_type": "application/zip",
"filename": "my-bot.zip",
"size_bytes": 4523,
"size_kb": 4.42,
"encoding": "base64",
"base64": "UEsDBBQACAgA..."
}The AI client can then write the base64 to a file and decode it to get the actual ZIP.
Environment Variables
Variable | Required | Description |
| No (optional) | Server-side fallback TBH API key. Recommended: leave unset — let each client pass |
| No | If set, clients must send |
| No | Override API base URL (default: |
| No | Port for |
Two Layers of Auth (Important!)
This MCP has two independent auth layers — don't confuse them:
Layer | Header | Env Var | Purpose |
MCP access control |
|
| Restrict WHO can call your MCP endpoint |
TeleBotHost API auth |
|
| Authenticate to the upstream TBH API |
Typical setups:
Public MCP, per-user TBH keys (recommended for shared deployments):
Don't set
MCP_AUTH_TOKEN, don't setTELEBOTHOST_API_KEYEach client passes
X-Tbh-Api-Key: sk_their_own_keyin their MCP configServer stores no secrets
Protected MCP, per-user TBH keys (recommended for team deployments):
Set
MCP_AUTH_TOKENon serverDon't set
TELEBOTHOST_API_KEYClients pass both
Authorization: Bearer <mcp_token>ANDX-Tbh-Api-Key: sk_their_own_key
Personal MCP, server-side key (simplest for solo use):
Set
TELEBOTHOST_API_KEYon serverDon't set
MCP_AUTH_TOKENClients don't need any headers (server uses its env var for all calls)
Rate Limits
The TeleBotHost API enforces plan-based limits. This MCP server automatically retries on HTTP 429 with exponential backoff (up to 3 retries).
Plan | Daily | Per-min | Monthly |
FREE / FREEMIUM | 1,000 | 15 | 15,000 |
PREMIUM | 5,000 | 60 | 75,000 |
ELITE | 10,000 | 120 | 150,000 |
pub_*keys are always capped at 1,000/day, 15/min, 15,000/month regardless of plan.
Use get_quota to check remaining quota at any time.
Local Development
# Install deps
npm install
# Set env vars
cp .env.example .env
# Edit .env with your TELEBOTHOST_API_KEY
# Run locally (generic Node server)
npm run dev
# → http://localhost:3000/api/mcp
# OR run as Vercel dev (simulates serverless)
npm run vercel:dev
# Type-check
npm run typecheck
# Test
curl -X POST http://localhost:3000/api/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}'Project Structure
telebothost-mcp/
├── api/
│ ├── index.ts # GET / → Docs page (root)
│ ├── docs.ts # GET /docs → Docs page (alias)
│ ├── health.ts # GET /api/health → JSON health probe
│ └── mcp.ts # POST /api/mcp → MCP JSON-RPC endpoint
├── lib/
│ ├── types.ts # Shared types & TbhApiError
│ ├── client.ts # TeleBotHost API client (auth, retry, binary, errors)
│ ├── tools.ts # All 68 MCP tool definitions
│ └── docs.ts # HTML docs page generator
├── scripts/
│ ├── test-mcp.mjs # Compliance test suite (cross-platform)
│ ├── test-mcp.sh # Compliance test suite (bash)
│ └── check-coverage.ts # Asserts tool count / uniqueness
├── .github/
│ └── workflows/
│ └── ci.yml # Typecheck + coverage + smoke tests
├── server.ts # Generic Node HTTP server (Render/Railway/Fly)
├── Dockerfile # Container image for any host
├── .dockerignore
├── render.yaml # Render.com Blueprint config
├── vercel.json # Vercel serverless config + routes
├── .env.example # Environment variable template
├── .nvmrc # Node version pin
├── package.json
├── tsconfig.json
├── LICENSE
├── CONTRIBUTING.md
└── README.mdEndpoints
Method | Path | Description |
|
| Documentation page (HTML) — tool list, quick start, configs |
|
| Alias for |
|
| JSON health probe — |
|
| MCP JSON-RPC endpoint (initialize, tools/list, tools/call) |
Roadmap
v1.0.0 — Initial release: 46 tools, Vercel deployment
v1.1.0 — Cleaner tool names (dropped
telebothost_prefix)v1.2.0 — 100% API coverage:
download_bot&import_bot(binary base64), compliance test suite, multi-platform deploy configsv1.3.0 — Per-request API key via
X-Tbh-Api-Keyheader — multi-user support, each user uses own TBH quotav2.0.0 — 68 tools: full CRUD for commands + folders, env vars, logs, analytics, docs search (TBH API, TBL lang, Telegram Bot API)
v2.1.0 — Docker support, GitHub Actions CI, automated coverage check in CI
v2.2.0 — SSE streaming transport for stateful deployments (Render/Railway)
v3.0.0 — Tool-level RBAC, audit logging, multi-region deployment guide
Contributing
Contributions welcome! See CONTRIBUTING.md for setup, conventions, and PR guidelines.
Adding a new tool
Open
lib/tools.tsAdd a
ToolDefto the appropriate groupUse a clear
snake_casename, short description, JSON-Schema inputRun
npm run typecheckOpen a PR
Acknowledgements
Special thanks to Cyber (@CyberXCoding) for creating the base version of this MCP server that this project was built upon.
License
MIT © Muiz Ahmed (mmuizahmed)
Links
TeleBotHost: telebothost.com
Developer API Docs: api.telebothost.com/api/v1/docs
MCP Specification: modelcontextprotocol.io
Issues: GitHub Issues
Built for the TeleBotHost community by Muiz Ahmed
This server cannot be deployed
Maintenance
Related MCP Connectors
Multi-tenant Telegram gateway for AI agents — HTTP+stdio, 8 tools, MTProto User API
Run WhatsApp and Telegram AI assistants: projects, prompts, leads, chats, analytics.
Manage Telegram drafts, media, schedules and publications from AI clients.
Messaging tools for AI agents: send messages, manage chats, groups and channels.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI agents to send and receive messages, media, and files on Telegram, and manage chats via a bot token.17MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to interact with the Telegram Bot API, supporting messaging, user management, and bot configuration with intelligent message splitting and error handling.72 npm7MIT
- AlicenseAqualityDmaintenanceExposes the Telegram Bot API as tools for Claude Code or any MCP client, enabling message sending, chat management, file handling, and bot information retrieval.201MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with the Telegram Bot API, allowing them to send messages, forward messages, get bot information, and receive updates.11 npm3MIT