Straight Connect

Straight Connect

An MCP server for communication service connectors that currently provides multi-account Telegram integration with granular tool access and security controls. It allows AI models to manage messages, chats, and media across various accounts through a flexible, extensible routing architecture.

Category
访问服务器

README

Straight Connect

MCP server for communication service connectors. Currently supports Telegram with multi-account configuration. Designed for extensibility — more services (Slack, Discord, email, etc.) can be added later.

Architecture

mcp/
├── server.py          # FastMCP entry point + ASGI middleware
├── telegram.py        # Telegram config, API client, tool definitions
├── requirements.txt   # Server dependencies
└── Dockerfile

src/
├── config.py          # Generates mcp.json from .env
└── chat.py            # Gradio + LangChain ReAct chat app

docker-compose.yaml
pyproject.toml
.env                   # Your configuration (not committed)
.env.example           # Configuration template

Setup

  1. Copy the environment template and fill in your values:
cp .env.example .env
  1. Get bot tokens from @BotFather on Telegram and add them to .env.

  2. Start the MCP server:

docker compose up --build -d
  1. Verify it's running:
docker compose logs mcp

Configuration

All configuration lives in .env. See .env.example for the full template.

Telegram Accounts

# Comma-separated account labels
TELEGRAM_ACCOUNTS=nietzsche,aurelia

# Per-account bot tokens (label uppercased)
TELEGRAM_NIETZSCHE_BOT_TOKEN=your-token-here
TELEGRAM_AURELIA_BOT_TOKEN=your-token-here

Tool Levels

Control which Telegram tools are available per account. Set a global default and optionally override per account:

# Global default
TELEGRAM_LEVEL=basic

# Per-account override
TELEGRAM_NIETZSCHE_LEVEL=standard
TELEGRAM_AURELIA_LEVEL=full
Level Tools (cumulative)
basic get_me, send_message, get_updates
standard + forward_message, edit_message_text, delete_message, send_photo, send_document
advanced + get_chat, send_location, send_poll, pin_chat_message, unpin_chat_message, get_chat_member_count, get_chat_member
full + send_audio, send_video, send_voice, send_sticker, copy_message, set_message_reaction, leave_chat, send_contact, send_venue

Allowed Chats

Optionally restrict which chats a bot account can interact with. If set, any tool call targeting a chat not in the list will be rejected. If not set, all chats are allowed.

# Comma-separated chat IDs (user IDs, group IDs, @channel_usernames)
TELEGRAM_NIETZSCHE_ALLOWED_CHATS=123456789,-1001234567890
TELEGRAM_AURELIA_ALLOWED_CHATS=987654321,@mychannel

This applies to all tools that take a chat_id parameter. For forward_message and copy_message, both source and destination chats are checked.

Allowed User IDs

Restrict which Telegram users a bot account will interact with. Incoming updates from non-listed users are silently filtered out by get_updates. If not set, all users are allowed and a warning is logged at startup.

TELEGRAM_NIETZSCHE_ALLOWED_USER_IDS=123456789
TELEGRAM_AURELIA_ALLOWED_USER_IDS=5138099108,987654321

MCP Port

MCP_PORT=9831

Chat Model

Used by uv run chat for the Gradio test interface:

OPENAI_API_BASE=http://localhost:8000/v1
OPENAI_API_KEY=not-needed
CHAT_MODEL=openai:your-model-name

MCP Endpoints

Each account gets its own endpoint scoped by service and account label:

http://localhost:9831/mcp/telegram/<account>

Examples:

  • http://localhost:9831/mcp/telegram/nietzsche
  • http://localhost:9831/mcp/telegram/aurelia

There is no shared /mcp endpoint — each URL is exclusive to one account. This enables MCP clients to connect per-account with distinct tool namespaces.

Client Tools

Generate mcp.json

Print the MCP client configuration derived from your .env:

uv run config

Output:

{
  "mcpServers": {
    "nietzsche": {
      "url": "http://localhost:9831/mcp/telegram/nietzsche"
    },
    "aurelia": {
      "url": "http://localhost:9831/mcp/telegram/aurelia"
    }
  }
}

Chat Interface

Launch a Gradio web UI that connects to all configured MCP servers with a LangChain ReAct agent:

uv run chat

On startup it will:

  1. Connect to each configured MCP server
  2. List all available tools per account
  3. Test the configured chat model
  4. Launch the Gradio interface

Tool names are prefixed with the account label for disambiguation (e.g., nietzsche_telegram_send_message, aurelia_telegram_get_updates).

How It Works

  • URL routing: ASGI middleware rewrites /mcp/<service>/<account> to the internal FastMCP endpoint and sets the account context via contextvars
  • Dynamic registration: Only configured services register their tools. If TELEGRAM_ACCOUNTS is empty, no Telegram tools exist
  • Level gating: Tools are registered based on the maximum level across all accounts. Per-account level checks happen at call time, returning an error if the account's level is insufficient
  • Chat whitelisting: Optional per-account ALLOWED_CHATS restricts which chats the bot can interact with
  • User filtering: Optional per-account ALLOWED_USER_IDS filters incoming updates to only include messages from specified users
  • Extensibility: New services follow the same pattern — add a config class, register tools conditionally, and the middleware routes automatically via /mcp/<service>/<account>

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选