TeleBotHost MCP Server
Allows managing Telegram bots via the TeleBotHost API, providing tools for bot lifecycle, storage, broadcasts, commands, community store, binary import/export, and more.
Click on "Install 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 all my Telegram 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 production-ready Model Context Protocol server for the TeleBotHost Developer API.
Expose 48 tools covering 100% of the TeleBotHost Developer API (47/47 endpoints) β bot lifecycle, storage, broadcasts, commands, community store, binary import/export, and more β to any MCP-compatible AI client (Claude Desktop, Cursor, Continue, Cline, etc.).
β¨ Features
π§ 48 Tools β 100% coverage of the TeleBotHost Developer API (47/47 endpoints + 1 quota helper)
π 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_botπ‘οΈ Safe by Design β Broadcast tool requires explicit
confirm: trueflagπ§ͺ Tested β 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: agent-telegram-mcp
π 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 β β 46 tools β β β
β Continue β ββββββββββββββββββββ β JSON-RPC router β ββββββββββββββββββββ β 40 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.7 Β· @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/sahilxteam/telebothost-mcp.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/sahilxteam/telebothost-mcp.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-mcpNote: Create a
Dockerfileif you need container builds β the Node server is runtime-agnostic.
π 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 (48)
π©Ί Health (1)
Tool | Description |
| API health & version probe |
π Public Discovery (8) β 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) |
π€ 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 (5)
Tool | Description |
| List commands & folders |
| Create a new command |
| Batch delete commands |
| List soft-deleted commands (7-day recovery) |
| Recover a deleted command |
ποΈ Community Store (2)
Tool | Description |
| Browse store (authenticated) |
| Install a store bot |
π Quota (1)
Tool | Description |
| Check daily / per-minute / monthly limits |
π 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 48 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
Compliance Test Suite
The repo includes a bash-based compliance test suite that verifies MCP spec adherence:
# Test against local server
npm start &
sleep 2
MCP_URL=http://localhost:3000/api/mcp ./scripts/test-mcp.sh
# Test against production
MCP_URL=https://tbh-mcp.vercel.app/api/mcp ./scripts/test-mcp.sh
# With auth token
MCP_URL=https://your-url/api/mcp MCP_TOKEN=xxx ./scripts/test-mcp.shWhat it verifies:
initializehandshake returns correct protocol version & server infopingreturns a resulttools/listreturns exactly 48 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)
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 | 9 | 9 | β 100% |
Bot Lifecycle | 20 | 20 | β 100% |
Bot Storage | 4 | 4 | β 100% |
Broadcasts | 6 | 6 | β 100% |
Commands | 5 | 5 | β 100% |
Community Store | 2 | 2 | β 100% |
Quota (helper) | β | 1 | N/A (reuses |
Total | 47 | 48 | β 100% |
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 48 MCP tool definitions
β βββ docs.ts # HTML docs page generator
βββ scripts/
β βββ test-mcp.sh # Compliance test suite
βββ server.ts # Generic Node HTTP server (Render/Railway/Fly)
βββ 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.mdπ Endpoints
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: added
download_bot&import_bot(binary base64), compliance test suite, multi-platform deploy configsv1.3.0 β Per-request API key via
X-Tbh-Api-Keyheader (no more hardcoded keys!) β multi-user support, each user uses own TBH quotav1.4.0 β Docker support, GitHub Actions CI, automated coverage check in CI
v1.5.0 β SSE streaming transport for stateful deployments (Render/Railway)
v2.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 `` prefix, clear description, JSON-Schema input
Run
npm run typecheckOpen a PR
π License
π Links
TeleBotHost: telebothost.com
Developer API Docs: api.telebothost.com/api/v1/docs
MCP Specification: modelcontextprotocol.io
Issues: GitHub Issues
Built with β€οΈ for the TeleBotHost community
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/animexteam/telebothost-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server