Quick Start
Prerequisites
Section titled “Prerequisites”- Deno 2.x or Node.js 20+
- A Telegram Bot token (from @BotFather)
- An existing MCP server with
ui://resources
Installation
Section titled “Installation”# Denodeno add jsr:@casys/mcp-bridge
# Node.jsnpx jsr add @casys/mcp-bridge-
Create the bridge server
bridge.ts import { startResourceServer } from "@casys/mcp-bridge";const server = startResourceServer({assetDirectories: { "my-app": "./ui-dist" },platform: "telegram",telegramBotToken: Deno.env.get("TELEGRAM_BOT_TOKEN")!,onMessage: async (_session, message) => {// Forward tool calls to your MCP server and return the responseconsole.log("Received:", message);return null;},options: { resourceServerPort: 4000, debug: true },});console.log(`Bridge ready at ${server.baseUrl}`); -
Expose your server
For development, use a tunnel like ngrok:
Terminal window ngrok http 4000 -
Configure your Telegram Bot
Set the Mini App URL in @BotFather:
- Send
/setmenubutton - Select your bot
- Set the URL to your ngrok/production URL
- Send
-
Test it
Open your bot in Telegram and tap the menu button. Your MCP App UI should appear inside Telegram!
What happens under the hood
Section titled “What happens under the hood”- Telegram loads your bridge URL in a WebView
- The Resource Server serves your
ui://HTML withbridge.jsinjected - When your MCP App calls
postMessage, bridge.js intercepts it - The message is routed via WebSocket to the Resource Server
- The Resource Server forwards
tools/callrequests to your MCP Server - Results flow back through the same path