Bale MCP Server
Production-grade MCP server exposing 32 tools that let an LLM authenticate to and operate a Bale Messenger user account.
Auth & sessions: list local
.balesessions, connect/switch accounts, get active profile, request/verify SMS code and 2FA password, disconnect.Dialogs & history: fetch recent chats, groups, and channels with unread counts and last messages, search dialogs by name or chat ID, read chat history.
Messaging: send text (with optional reply), edit, delete (for self or everyone), forward, pin, and mark chats as read.
Contacts & users: list and import contacts, search users/bots/groups/channels by username or phone, get user profiles, block/unblock and list blocked users.
Groups & channels: get group info, list members, create groups/channels, invite users, get permanent invite URLs, leave.
Reactions & presence: add/remove emoji reactions and send typing indicators.
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., "@Bale MCP Server send a message to Mom on Bale saying I'll be late"
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.
Bale MCP Server ๐
Production-grade Model Context Protocol (MCP) server for Bale Messenger.
Empowers Large Language Models (LLMs) to authenticate, inspect dialogs, read histories, send messages, interact with groups, and manage contacts on Bale user accounts.
๐ Key Highlights
โก Native Async Performance: Powered by
aiobale-pyand official Python MCP SDK (mcp.server.mcpserver).๐ Multi-Account Sessions: Auto-discovers and switches between
.balesessions on disk with zero credentials re-prompting.๐ฑ Interactive & Tool-based Auth: Support for interactive phone SMS login via CLI (
bale-mcp login) or programmatically via MCP tools (bale_auth_request_code,bale_auth_verify_code,bale_auth_verify_password).๐ฌ Complete Messaging Ecosystem: Send, reply, edit, delete, forward, pin, and mark read across private chats, groups, and channels.
๐ฅ Contacts & Profile Search: Query users by
@usernameor phone number, fetch full profiles, manage contacts, and block/unblock.๐ข Groups & Channels Management: Inspect settings, member counts, invite users, generate invite URLs, and manage participant states.
โก Reactions & Presence: Send and remove emoji reactions (
๐,โค๏ธ,๐ฅ) and broadcast typing indicators.๐ก๏ธ Zero Data Leakage: Session keys and
.baletokens remain strictly local and are protected by.gitignore.
Related MCP server: Telegram MCP Server
๐ฆ Architecture
LLM Client (Claude Desktop / Cursor / Antigravity / Cline)
โ
โ JSON-RPC (STDIO / SSE / Streamable HTTP)
โผ
Bale MCP Server
โ
Session Connection Pool
โ
aiobale Async Client (WebSockets / Protobuf)
โผ
Bale Messenger Network๐ ๏ธ Complete MCP Tools Catalog (34 Tools)
๐ Authentication & Session Management
Tool Name | Description |
| List all available Bale user sessions/accounts stored locally on disk. |
| Connect or switch to a specific Bale account using session name or phone. |
| Get profile information and connection status of the active account. |
| Request an SMS/Bale verification code for a new account login. |
| Verify SMS/Bale authentication code to save a new |
| Submit Two-Factor Authentication (2FA) cloud password if required. |
| Disconnect the active account session. |
๐ฌ Messaging & Dialogs
Tool Name | Description |
| Retrieve recent chats, groups, and channels with resolved titles/names, unread counts, and last messages. |
| Search dialogs and groups by title/name (in Persian or English) or chat ID. |
| Fetch recent message history from a chat, group, or channel. |
| Send a text message to a user, group, or channel with optional reply support. |
| Edit an existing text message or media caption (automatic media fallback). |
| Update caption of existing media (photos, videos, GIFs, docs) with metadata sanitization. |
| Batch edit multiple messages/captions in a single call with anti-flood throttling. |
| Delete a message from a chat (for self or everyone). |
| Forward an existing message to another chat or user. |
| Mark all messages in a chat or group as read. |
| Pin a message in a private chat or group. |
๐ฅ Contacts & Users
Tool Name | Description |
| Retrieve the saved contact list from the active account. |
| Search for a user, bot, group, or channel by username or phone number. |
| Get detailed profile information (name, about, username) by user ID. |
| Import one or more contacts by phone number and name into the address book. |
| Block a user by user ID. |
| Unblock a previously blocked user by user ID. |
| List all users currently blocked by the active account. |
๐ข Groups & Channels
Tool Name | Description |
| Retrieve full information, settings, member count, and permissions for a group. |
| Retrieve the list of members in a group or channel. |
| Create a new group or broadcast channel with initial members. |
| Invite one or more users to an existing group or channel. |
| Get the permanent invitation link (URL) for a group or channel. |
| Leave a group or channel. |
โก Reactions & Presence
Tool Name | Description |
| Add an emoji reaction ( |
| Remove an emoji reaction from a message. |
| Send a typing indicator to a chat or group. |
๐ Installation & Setup
1. Prerequisites
Python 3.10 or higher
uv(recommended) or standardpip
2. Install from Repository
git clone https://github.com/aminmadaniofficial/bale-mcp-server.git
cd bale-mcp-server
uv venv
source .venv/bin/activate
uv pip install -e .3. Log In to Your Bale Account
You can authenticate directly using the built-in CLI:
bale-mcp login --phone 989XXXXXXXXXThis requests an SMS code and saves the session securely in ./sessions/<phone>.bale.
To view existing sessions:
bale-mcp list-sessions๐ MCP Client Configuration
Claude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"bale": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/bale-mcp-server",
"run",
"bale-mcp",
"run"
],
"env": {
"BALE_SESSIONS_DIR": "/absolute/path/to/bale-mcp-server/sessions"
}
}
}
}Antigravity IDE (mcp_config.json)
{
"mcpServers": {
"bale": {
"command": "/absolute/path/to/bale-mcp-server/.venv/bin/bale-mcp",
"args": ["run"],
"env": {
"BALE_SESSIONS_DIR": "/absolute/path/to/bale-mcp-server/sessions"
}
}
}
}๐งช Testing
Run the automated test suite:
pytest -v๐ License
This project is licensed under the MIT License.
Available Tools
32 toolsbale_auth_request_codeB
Initiate interactive phone login by requesting an SMS/Bale verification code for a new account.
Inputs: phone_number (required). Returns: result
bale_auth_verify_codeB
Verify the authentication code received via SMS/Bale to complete login and save session.
Inputs: code (required), transaction_hash. Returns: result
bale_auth_verify_passwordB
Submit Two-Factor Authentication (2FA) cloud password if required during login.
Inputs: password (required), transaction_hash. Returns: result
bale_block_userC
Block a user by user ID.
Inputs: user_id (required). Returns: result
bale_connect_sessionC
Connect to or switch to a specific Bale user account using session name or phone number.
Inputs: session_name (required). Returns: result
bale_create_groupC
Create a new group or channel on Bale with initial members.
Inputs: title (required), user_ids, username, is_channel. Returns: result
bale_delete_messageC
Delete a message from a chat.
Inputs: chat_id (required), message_id (required), just_me, chat_type. Returns: result
bale_disconnectB
Disconnect the currently active Bale user account.
Inputs: no named parameters. Returns: result
bale_edit_messageC
Edit an existing text message sent previously in a chat.
Inputs: chat_id (required), new_text (required), message_id (required), chat_type. Returns: result
bale_forward_messageC
Forward an existing message to another chat or user.
Inputs: message_id (required), to_chat_id (required), from_chat_id (required), from_chat_type (required), +1 more. Returns: result
bale_get_blocked_usersA
List all users currently blocked by the active account.
Inputs: no named parameters. Returns: result
bale_get_chat_historyC
Fetch recent message history from a specific chat, group, or channel.
Inputs: chat_id (required), limit, chat_type, offset_date. Returns: result
bale_get_contactsA
Retrieve the list of saved contacts from the active Bale account.
Inputs: no named parameters. Returns: result
bale_get_dialogsC
Retrieve the list of recent chats, groups, and channels with resolved titles/names, unread counts, and last messages.
Inputs: limit, offset_date, exclude_pinned, resolve_titles. Returns: result
bale_get_group_infoB
Retrieve full information, settings, member count, and permissions for a group or channel.
Inputs: group_id (required). Returns: result
bale_get_group_invite_urlB
Get the permanent invitation link (URL) for a group or channel.
Inputs: group_id (required). Returns: result
bale_get_group_membersC
Retrieve the list of members in a group or channel.
Inputs: group_id (required), limit. Returns: result
bale_get_meA
Get profile information and connection status of the currently active Bale account.
Inputs: no named parameters. Returns: result
bale_get_user_infoB
Get detailed profile information (name, about, username, avatar) for a user by user_id.
Inputs: user_id (required). Returns: result
bale_import_contactsB
Import one or more contacts by phone number and name into Bale address book.
Inputs: contacts (required). Returns: result
bale_invite_to_groupC
Invite one or more users to an existing group or channel.
Inputs: group_id (required), user_ids (required). Returns: result
bale_leave_groupC
Leave a group or channel.
Inputs: group_id (required). Returns: result
bale_list_sessionsB
List all available Bale user sessions/accounts stored locally on disk.
Inputs: no named parameters. Returns: result
bale_mark_chat_readC
Mark all messages in a chat or group as read (seen).
Inputs: chat_id (required), chat_type. Returns: result
bale_pin_messageC
Pin a message in a private chat or group.
Inputs: chat_id (required), message_id (required), just_me, chat_type. Returns: result
bale_remove_reactionC
Remove an emoji reaction from a message in a chat.
Inputs: emoji (required), chat_id (required), message_id (required), chat_type. Returns: result
bale_search_dialogsB
Search active dialogs, groups, and conversations by name/title (supports Persian or English) or chat ID.
Inputs: query (required), limit. Returns: result
bale_search_userB
Search for a Bale user, bot, group, or channel by username or phone number.
Inputs: query (required). Returns: result
bale_send_messageC
Send a text message to a user, group, or channel with optional reply support.
Inputs: text (required), chat_id (required), chat_type, reply_to_message_id. Returns: result
bale_send_reactionB
Add an emoji reaction (e.g. ๐, โค๏ธ, ๐ฅ) to a specific message in a chat.
Inputs: emoji (required), chat_id (required), message_id (required), chat_type. Returns: result
bale_send_typingC
Send a typing action indicator to a chat or group.
Inputs: chat_id (required), chat_type. Returns: result
bale_unblock_userB
Unblock a previously blocked user by user ID.
Inputs: user_id (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogโฆ
TDQS
Scored across 32 tools
Most tools have clearly distinct purposes (send vs edit vs delete, block vs unblock), but a few pairs like search_dialogs vs search_user and get_me vs get_user_info could be confused. Descriptions help clarify the boundaries, but the overlap is not fully eliminated.
All tools use the bale_ prefix and snake_case, following a consistent verb_noun pattern (list_sessions, send_message, block_user). Minor variations like auth_ prefix are still predictable and readable.
32 tools exceeds the recommended 3-15 range and falls into the 25+ category, which the rubric marks as too many for the apparent scope. While each operation serves a purpose, the surface is heavy and could be consolidated.
Core text messaging, contacts, groups, and authentication are covered, but notable gaps exist: no media/file sending, no message search, no group member removal, no join-by-invite, and no unpin message. These omissions limit full messenger workflows.
Maintenance
Related MCP Connectors
Messaging tools for AI agents: send messages, manage chats, groups and channels.
ERC-8004 agent identity, on-chain subscriptions, reputation, A2A tasks and chat over 53 tools.
Messaging infrastructure for AI agents across iMessage, WhatsApp, Telegram and SMS.
AI phone agents, calls and campaigns as tools, and messaging between your AI agent sessions.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to interact with a user's Telegram account: list chats, read history, search, and send messages through Telegram's MTProto API.2MIT
- FlicenseNot gradedqualityDmaintenanceEnables LLM clients to send messages, read recent messages, and retrieve chat information through the Telegram Bot API.-
- AlicenseAqualityBmaintenanceEnables AI agents to privately read, search and answer messages that people send a Bale (ุจูู) bot, keep a local searchable history, download incoming files, and send text or media. Agents can also pose questions with inline buttons and block until the user replies, all running on the user's own machine with an optional chat allowlist and no telemetry.132PolyForm Noncommercial 1.0.0
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to access a self-hosted MAX messenger personal account: browse chats, read and search message history, inspect context, pins and forwarded text, download attachments, and send text or files with receipts and retry protection. Also supports durable batch state for scheduled workflows, with local authentication and access control over Streamable HTTP.1MIT