← Discover MCPs and Agents
n
MCPAI & MLGitHub

nexus

MCP server that gives AI agents access to Telegram, Gmail, WhatsApp, Slack, and Discord. Pure Rust, 48 tools, single binary.

Links

README

From the repo.

Nexus

MCP server that gives AI agents access to messaging platforms. One binary, five platforms.

Telegram · Gmail · WhatsApp · Slack · Discord

Nexus implements the Model Context Protocol (MCP) over stdio, exposing 48 tools that let AI agents read, send, search, and manage messages across platforms through a unified interface.

Built in pure Rust. No MCP SDK dependencies — hand-rolled JSON-RPC 2.0. Single binary, ~4MB release.

Why Nexus?

AI agents need to communicate. They need to read your Telegram messages, send emails, search Slack history, and manage Discord channels — but each platform has its own API, auth flow, and data model.

Nexus unifies all of this behind MCP. Connect it to Claude Code, Claude Desktop, or any MCP client, and your agent gets instant access to your messaging world.

What agents can do with Nexus:

  • Read and send messages across all platforms
  • Search chat history (find that message from months ago)
  • Manage emails (archive, label, star, draft, send with attachments)
  • Forward, pin, react to, edit, and delete Telegram messages
  • Create Slack channels, set topics, manage reactions
  • List Discord guilds, create threads, pin messages
  • Download media and attachments from any platform

Quick Start

1. Install

From source:

git clone https://github.com/santoshakil/nexus.git
cd nexus
cargo build --release
cp target/release/nexus ~/.local/bin/

Prerequisites:

2. Configure

Copy the example env file and fill in the platforms you want:

cp .env.example .env

You only need to configure the platforms you'll use. Nexus silently skips unconfigured platforms.

# Telegram (get from https://my.telegram.org)
TELEGRAM_API_ID=12345678
TELEGRAM_API_HASH=abcdef1234567890abcdef1234567890

# Gmail (generate App Password at https://myaccount.google.com/apppasswords)
GMAIL_ADDRESS=you@gmail.com
GMAIL_APP_PASSWORD=xxxx xxxx xxxx xxxx

# WhatsApp Business Cloud API (https://developers.facebook.com)
WHATSAPP_ACCESS_TOKEN=your_token
WHATSAPP_PHONE_NUMBER_ID=your_phone_id

# Slack (create app at https://api.slack.com/apps)
SLACK_BOT_TOKEN=xoxb-your-bot-token

# Discord (create app at https://discord.com/developers/applications)
DISCORD_BOT_TOKEN=your_bot_token

3. Authenticate Telegram (one-time)

Telegram requires an interactive login the first time:

nexus auth telegram

This prompts for your phone number, SMS code, and optional 2FA password. The session is saved to ~/.nexus/tdlib/ and reused automatically.

4. Connect to Claude Code

Add to your Claude Code MCP config (~/.claude/claude_code_config.json):

{
  "mcpServers": {
    "nexus": {
      "command": "nexus",
      "args": ["mcp"],
      "env": {
        "TELEGRAM_API_ID": "12345678",
        "TELEGRAM_API_HASH": "abcdef1234567890abcdef1234567890",
        "GMAIL_ADDRESS": "you@gmail.com",
        "GMAIL_APP_PASSWORD": "xxxx xxxx xxxx xxxx"
      }
    }
  }
}

Or for Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "nexus": {
      "command": "/path/to/nexus",
      "args": ["mcp"],
      "env": {
        "TELEGRAM_API_ID": "12345678",
        "TELEGRAM_API_HASH": "abcdef1234567890abcdef1234567890"
      }
    }
  }
}

Tools

Nexus exposes tools dynamically — only tools for configured platforms appear in tools/list.

Universal Tools (all platforms)

ToolDescription
list_platformsList connected platforms
get_profileGet authenticated user profile
list_channelsList chats, folders, channels
read_messagesRead messages with pagination
send_messageSend a message (with optional reply)
searchSearch messages across a platform

Telegram Tools (13)

ToolDescription
telegram_search_chatSearch within a specific chat
telegram_get_messageGet a single message with full metadata
telegram_get_chat_infoChat details, member count, description
telegram_get_chat_membersList members with roles
telegram_send_mediaSend photo/video/document
telegram_download_mediaDownload media to local file
telegram_forward_messageForward between chats
telegram_edit_messageEdit your sent messages
telegram_delete_messagesDelete messages
telegram_pin_messagePin a message
telegram_unpin_messageUnpin a message
telegram_mark_readMark messages as read
telegram_reactAdd emoji reaction

Gmail Tools (13)

ToolDescription
gmail_send_emailSend with CC, BCC, attachments
gmail_create_draftCreate draft without sending
gmail_archiveRemove from inbox
gmail_trashMove to trash
gmail_move_toMove to any folder
gmail_list_labelsList all labels/folders
gmail_add_labelAdd label to message
gmail_remove_labelRemove label from message
gmail_mark_readMark as read
gmail_mark_unreadMark as unread
gmail_starStar a message
gmail_unstarUnstar a message
gmail_get_attachmentDownload attachment to file

Slack Tools (9)

ToolDescription
slack_set_statusSet status message and emoji
slack_create_channelCreate a new channel
slack_invite_to_channelInvite user to channel
slack_set_topicSet channel topic
slack_add_reactionReact to a message
slack_remove_reactionRemove reaction
slack_upload_fileUpload file to channels
slack_list_usersList workspace users
slack_get_user_infoGet user profile details

Discord Tools (6)

ToolDescription
discord_list_guildsList servers the bot is in
discord_list_guild_channelsList channels in a server
discord_create_threadCreate a thread
discord_add_reactionReact to a message
discord_remove_reactionRemove reaction
discord_pin_messagePin a message

WhatsApp Tools (1)

ToolDescription
whatsapp_send_mediaSend media file to a number

WhatsApp Business Cloud API is limited to sending only. Message history is not available through the API.

Format System

Every data-returning tool accepts an optional format parameter:

FormatBehaviorUse Case
compact (default)One-liner per item, text truncated to 200 charsBrowsing, scanning, token-efficient
expandedOne-liner per item, full untruncated textReading full messages
fullComplete JSON with all fieldsWhen you need exact field values

Examples:

Compact (default):

[Jan 15 10:30] John Doe (@john): Hey, I was thinking about the architecture for the new...  (id:123456)

Expanded:

[Jan 15 10:30] John Doe (@john): Hey, I was thinking about the architecture for the new messaging service. We should probably use a hexagonal pattern with ports and adapters. What do you think? (id:123456)

Full:

{"id":"123456","platform":"telegram","channel_id":"-100123","sender":"John Doe","text":"Hey, I was thinking about...","timestamp":1705312200,...}

Architecture

Hexagonal (ports-and-adapters) with 9 workspace crates:

app-mcp ──→ mod-messaging ──→ core-domain ──→ core-error
                  ↑                 ↑
        infra-tdlib          (port traits)
        infra-google
        infra-whatsapp
        infra-slack
        infra-discord
LayerCratePurpose
Corecore-errorAgentError enum with suggestions and retryable flags
Corecore-domainShared entities (Message, Channel, Profile, etc.) and port traits (MessagingPort, TelegramExt, GmailExt, etc.)
Modulemod-messagingAgentService (platform registry + routing) and Format engine
Infrainfra-tdlibTelegram via TDLib FFI (4 C functions, dedicated receive thread)
Infrainfra-googleGmail via IMAP + SMTP (connection pooling, MIME decoding)
Infrainfra-whatsappWhatsApp Business Cloud API via HTTP
Infrainfra-slackSlack Web API via HTTP
Infrainfra-discordDiscord Bot API v10 via HTTP
Appapp-mcpBinary: CLI, MCP server (stdio JSON-RPC), tool definitions

MCP Protocol

Nexus uses newline-delimited JSON-RPC 2.0 on stdio (not Content-Length headers). stdout is exclusively for JSON-RPC responses. All logging goes to stderr via tracing.

Error Handling

Every error includes context to help the AI agent recover:

{
  "isError": true,
  "content": [{"type": "text", "text": "[auth] Telegram session expired | try: re-run `nexus auth telegram` | retryable: false"}]
}

Errors include a suggestion (actionable fix) and whether the operation is retryable.

Platform Setup Guides

Telegram

  1. Go to my.telegram.org and create an application
  2. Note your API_ID and API_HASH
  3. Set environment variables:
    export TELEGRAM_API_ID=12345678
    export TELEGRAM_API_HASH=abcdef1234567890abcdef1234567890
    
  4. Run one-time authentication:
    nexus auth telegram
    
    Enter your phone number, SMS code, and 2FA password if enabled.
  5. The session is saved to ~/.nexus/tdlib/ — you won't need to authenticate again unless you revoke the session.

Note: Telegram requires TDLib (libtdjson.so) installed at /usr/local/lib. See the TDLib build guide for your platform. Set TDLIB_DIR env var if installed elsewhere.

Gmail

  1. Enable 2-Step Verification on your Google account
  2. Generate an App Password at myaccount.google.com/apppasswords
    • Select "Mail" as the app
    • Copy the 16-character password
  3. Set environment variables:
    export GMAIL_ADDRESS=you@gmail.com
    export GMAIL_APP_PASSWORD="xxxx xxxx xxxx xxxx"
    

Gmail search syntax: The search tool accepts IMAP criteria:

  • Simple text: "meeting notes" (searches body)
  • From sender: FROM sender@example.com
  • By subject: SUBJECT "quarterly report"
  • By date: SINCE 01-Jan-2025
  • Unread only: UNSEEN
  • Combine: FROM boss@company.com SINCE 01-Feb-2025 UNSEEN

WhatsApp

  1. Create a Meta Developer account
  2. Create a new app with WhatsApp product
  3. Get your access token and phone number ID from the WhatsApp API dashboard
  4. Set environment variables:
    export WHATSAPP_ACCESS_TOKEN=your_token
    export WHATSAPP_PHONE_NUMBER_ID=your_phone_id
    

Limitations: WhatsApp Business Cloud API only supports sending messages. You cannot read message history or search messages through the API.

Slack

  1. Go to api.slack.com/apps and create a new app
  2. Under OAuth & Permissions, add these bot token scopes:
    • channels:history, channels:read, channels:write
    • chat:write
    • groups:history, groups:read
    • im:history, im:read
    • mpim:history, mpim:read
    • reactions:read, reactions:write
    • users:read
    • files:write (for file uploads)
  3. Install the app to your workspace
  4. Copy the Bot User OAuth Token (xoxb-...)
  5. Set environment variable:
    export SLACK_BOT_TOKEN=xoxb-your-bot-token
    

Discord

  1. Go to discord.com/developers/applications
  2. Create a new application
  3. Go to Bot tab and create a bot
  4. Enable these Privileged Gateway Intents: Message Content Intent
  5. Copy the bot token
  6. Invite the bot to your server using OAuth2 URL Generator with bot scope and these permissions:
    • Read Messages/View Channels
    • Send Messages
    • Manage Messages (for pin/delete)
    • Add Reactions
    • Read Message History
    • Create Public Threads
  7. Set environment variable:
    export DISCORD_BOT_TOKEN=your_bot_token
    

CLI Reference

# Start the MCP server (default command)
nexus mcp

# Authenticate with Telegram (interactive, one-time)
nexus auth telegram

# Show help and environment variables
nexus help

Environment Variables

VariablePlatformDescription
TELEGRAM_API_IDTelegramAPI ID from my.telegram.org
TELEGRAM_API_HASHTelegramAPI hash from my.telegram.org
GMAIL_ADDRESSGmailYour Gmail address
GMAIL_APP_PASSWORDGmailApp Password (not your regular password)
WHATSAPP_ACCESS_TOKENWhatsAppBusiness Cloud API token
WHATSAPP_PHONE_NUMBER_IDWhatsAppSender phone number ID
SLACK_BOT_TOKENSlackBot User OAuth Token (xoxb-...)
DISCORD_BOT_TOKENDiscordBot token
NEXUS_DATA_DIRAllData directory (default: ~/.nexus)
RUST_LOGAllLog level (default: nexus=info)

Building from Source

# Debug build
cargo build --workspace

# Release build (optimized, ~4MB)
cargo build --release

# Check/lint
cargo check --workspace
cargo clippy --workspace -- -D warnings

# Run protocol tests (needs debug build)
cargo build --workspace
bash tests/mcp_protocol_test.sh

Build Configuration

The release profile is optimized for small binary size:

  • LTO: fat (link-time optimization)
  • Codegen units: 1
  • Strip: enabled
  • Panic: abort

Workspace Lints

These are enforced across all crates:

  • clippy::unwrap_used = "deny" — use ? or match
  • clippy::expect_used = "deny" — use ? or match
  • unused_must_use = "deny"
  • unsafe_code = "warn" (only allowed in infra-tdlib for FFI)

Adding a New Platform

  1. Create crates/infra-{name}/ with Cargo.toml and src/adapter.rs
  2. Add a variant to Platform enum in core-domain/src/entities.rs
  3. Implement the MessagingPort trait (6 methods)
  4. Optionally add an extension trait in core-domain/src/ports.rs
  5. Register the adapter in app-mcp/src/main.rs
  6. Add tool definitions in app-mcp/src/mcp/tools.rs
  7. Wire dispatch in app-mcp/src/mcp/server.rs

Adding a New Tool

  1. Add the method to the relevant extension trait in core-domain/src/ports.rs
  2. Implement it in the adapter (e.g., infra-tdlib/src/adapter.rs)
  3. Add a ToolDef in app-mcp/src/mcp/tools.rs
  4. Add a dispatch arm in app-mcp/src/mcp/server.rs

Contributing

Contributions are welcome. Please:

  1. Fork the repo and create a feature branch
  2. Ensure cargo clippy --workspace -- -D warnings passes with no warnings
  3. Ensure cargo check --workspace compiles cleanly
  4. Run bash tests/mcp_protocol_test.sh (needs a debug build)
  5. Keep commits atomic and descriptive
  6. Open a pull request with a clear description

License

MIT — see LICENSE for details.

Collected info

  • ★ 7 stars
  • ⎇ 1 forks
  • Language: Rust
  • Source updated: 4/8/2026

Config for your environment

Replace {MCP_ENDPOINT_URL} with this MCP’s endpoint URL (from its repo or docs above). No API key — you connect directly.

Tool

OS

Config file: ~/.cursor/mcp.json

{
  "mcpServers": {
    "mcp-server": {
      "url": "{MCP_ENDPOINT_URL}"
    }
  }
}

Paste into mcpServers in the config file. Restart Cursor after saving.

If this MCP is also published on mcpchannel.ai, you can subscribe from Browse and use the gateway config there instead.