Discord MCP integration for AI agents
Anlyon's Discord integration gives an AI agent Discord tools over MCP or through Anlyon's API: it can read channels and threads, post, reply, react and start threads as your bot. Each of your users connects their own Discord account with a key they create in Discord, and your company's account connects the same way. Your agent calls each action by name and never holds the key.
Give an agent a voice in your server with a ceiling on how often it speaks. It reads channels and threads, posts, replies, reacts and starts threads as your bot, and an edit or a delete can wait for a person.
- host
- discord.com
- connect
- API key, per user
Post message
discord-post-message
Edit message
discord-edit-message
Start thread
discord-start-thread
Reply to message
discord-reply-to-message
What can an AI agent do in Discord? Writes are off until you switch them on.
Each one is a named operation from the pack. Reads change nothing.
Writes
Post message
read backdiscord-post-message
Post one message to a channel the bot can see.
Edit message
read backdiscord-edit-message
Replace the text of one message the bot posted.
Start thread
read backdiscord-start-thread
Start one thread from a message.
Reply to message
read backdiscord-reply-to-message
Post one message as a reply to another message in the same channel. Discord refuses the reply if the original message no longer exists, rather than posting it unattached.
Post thread message
read backdiscord-post-thread-message
Post one message in a thread. Posting in an archived (not locked) thread unarchives it. Needs Send Messages in Threads.
Delete message
acknowledgeddiscord-delete-message
Delete one message. The bot can delete its own messages; deleting anyone else's needs Manage Messages, which Discord otherwise refuses. Deleting a message in an archived thread is refused.
Add reaction
acknowledgeddiscord-add-reaction
Add the bot's reaction to a message. Adding an emoji nobody has used on that message yet needs Add Reactions.
Remove reaction
acknowledgeddiscord-remove-reaction
Remove the bot's own reaction from a message; other people's reactions are left alone.
Pin message
read backdiscord-pin-message
Pin one message in its channel. Needs the Pin Messages permission.
Unpin message
read backdiscord-unpin-message
Unpin one message in its channel. Needs the Pin Messages permission.
Join thread
read backdiscord-join-thread
Add the bot to a thread so it receives the thread's messages. The thread must not be archived.
Archive thread
read backdiscord-archive-thread
Archive one thread: it leaves the channel's thread list and stays readable. Discord lets the thread's creator archive it; any other thread needs Manage Threads. A later message in the thread unarchives it unless it is locked.
Reads
List channels
discord-list-channels
List the channels of one server (text, announcement, voice, forum and categories; threads are not included, use list-active-threads). Discord returns every channel in one response and has no paging, so a very large server's list can be cut at 64 KB.
Get channel
discord-get-channel
Get one channel or thread by id: its name, type, topic, parent and, for a thread, its archived state and whether the bot has joined it.
List messages
discord-list-messages
List 20 messages in a channel, newest first. For older messages pass before = the id of the oldest message you have; for newer ones pass after = the id of the newest. Pass at most one of before and after. Discord returns an empty list when the bot lacks Read Message History.
Get message
discord-get-message
Get one message by id: its text, author, reactions, pinned state, reply reference and the thread started from it, if any.
List pinned messages
discord-list-pinned-messages
List up to 20 pinned messages in a channel, most recently pinned first, each with its pinned_at time. When has_more is true, pass before = the pinned_at of the last item for the next page.
List active threads
discord-list-active-threads
List every active (not archived) thread in a server, newest first, with a member entry for each thread the bot has joined. Discord returns them all in one response and has no paging, so a very large server's list can be cut at 64 KB.
List archived threads
discord-list-archived-threads
List up to 20 archived public threads of one channel, most recently archived first. When has_more is true, pass before = the thread_metadata.archive_timestamp of the last thread for the next page.
List thread messages
discord-list-thread-messages
List 20 messages in a thread, newest first (a thread is a channel, so this is the channel messages call with the thread's id). For older messages pass before = the id of the oldest message you have; for newer ones pass after. Pass at most one of before and after.
How do users connect? Each one brings their own Discord.
- 1.Call for the userYour server invokes the action for the signed-in user. Without a Discord connection, the SDK throws EndUserNotConnectedError with a connect link.
- 2.The user pastes a keyThe link opens a form that shows where in Discord's settings to create the key. The link lasts 10 minutes and works once.
- 3.Anlyon checks itThe key is checked with Discord before it is kept, and bound to discord.com. It is never shown back.
- 4.Your server confirmsYour server confirms the connection for the user who is signed in, and the call goes through.
How do I control what an AI agent does in Discord? Suggested limits and approvals, for you to review.
Suggested limits
- 200 messages a day
- 100 edits a day
- 50 threads started a day
- 200 replies a day
- 200 thread messages a day
- 50 deletions a day
- 200 reactions added a day
- 200 reactions removed a day
- 30 pins a day
- 30 unpins a day
- 50 threads joined a day
- 30 threads archived a day
Suggested approvals
- A person approves editing a message
- A person approves deleting a message
- A person approves archiving a thread
What the key must allow
- A bot token from an application you create
- View Channel, Send Messages, Read Message History
- Create Public Threads, Send Messages in Threads, Add Reactions and Pin Messages
Good to know
- Without Read Message History the post still goes out, but it cannot be read back and its receipt stays acknowledged.
- A bot can edit only its own messages.
For your own account
- 1.In the Discord Developer Portal, create an application, add a bot and copy its token.
- 2.Invite the bot to your server with View Channel, Send Messages, Read Message History and Create Public Threads.
- 3.In Anlyon, open Actions, then Integrations, choose Discord and paste the token.
- 4.Anlyon checks the token with Discord before storing it. It becomes a secret named DISCORD, bound to discord.com.
How do I call Discord from my agent's code? For one of your users, or for your own account.
Act for one of your users from your server, or connect your company's own Discord with the CLI.
import { Client, EndUserNotConnectedError } from "@anlyonhq/sdk";const anlyon = new Client({ apiKey: process.env.ANLYON_API_KEY! });try { const { data } = await anlyon .forUser(session.userId) .actions.invoke("discord-post-message", { channel_id: "1100000000000000001", content: "Deploy finished." }); return { status: "done", grade: data.grade };} catch (error) { if (error instanceof EndUserNotConnectedError) { // The user connects their own Discord, then you call again. return { status: "connect_required", url: error.connectUrl }; } throw error;}Questions. Discord and AI agents.
Connect a Discord account in Anlyon, switch on the operations the agent may use, and call them from the TypeScript or Python SDK or over MCP. Each of your users connects their own account through a connect link, where they paste a key they create in Discord. Your agent sees the operations by name and never sees the credential.
Through Anlyon it can read channels and threads, post, reply, react and start threads as your bot. Reads change nothing. Writes are off until you switch them on, and every write leaves a receipt.
Yes. Every Discord action you enable is also an MCP tool on Anlyon's hosted MCP server, at https://api.anlyon.com/mcp. Add that address to Claude Code, Cursor or Codex and sign in. It is Anlyon's own integration, and it calls Discord's API with the key Anlyon holds.
No. The key stays with Anlyon and is sent only in the request to Discord's API. No API returns it, to you, to the console or to an agent.
Other integrations. Under the same limits, approvals and receipts.
Available
Stripe
Payments · API key
Refunds under a money ceiling, and every customer, payment and invoice to read.
Available
GitHub
Code · Sign in
Issues, pull requests and code, in the repositories you choose.
Available
HubSpot
CRM · Sign in
Contacts, companies and deals: search them and change them.
- Anlyon app
- Available
- Your own app
- Recommended for production
