How to make a Discord bot with AI, and host it for free

Bot-Hosting team,

You can now make a Discord bot by describing it. Not “generate some code and figure out the rest”: an AI agent connected to your Bot-Hosting account writes the files, deploys them, starts the bot, reads its logs and fixes what breaks, in the same conversation.

The MCP server introduction explained what MCP is, and AI agents on Bot-Hosting.net lists every agent that works and what it can do. This post is the practical side: going from an empty account to a bot that is online in your server, with an agent doing the typing.

The short version

  1. Create a free Bot-Hosting account. No card needed.
  2. Connect your AI. Pick it on the AI agents page: Claude and ChatGPT take a pasted URL, Cursor and VS Code install in one click, Claude Code and Codex need one command. You sign in to Bot-Hosting and approve, there is no key to copy.
  3. Create the bot in Discord. In the Discord Developer Portal, create an application, open Bot, copy the token and invite the bot to your server.
  4. Ask for the bot you want. For example: “Make me a Discord bot in Node.js that answers /ping and welcomes new members, and host it on Bot-Hosting.”
  5. Add the token yourself. When the agent asks for it, paste the token in the Environment tab of the new deployment as DISCORD_TOKEN, marked secret. Then tell the agent it is there.

That is the whole loop. The rest of this post shows what happens in between, and how to get good results.

What a real session looks like

Here is a condensed version of what an agent does with that prompt. The tool names are the real ones it calls on your account.

  1. It picks a runtime and creates the deployment. It lists the available runtimes, then creates a Node.js 24 deployment called welcome-bot with deployments_create.
  2. It writes the code. package.json and index.js go in with files_writeMany: a slash command handler for /ping and a guildMemberAdd listener that posts a welcome message.
  3. It installs the library. discord.js is added with packages_add, so the startup installs it every time.
  4. It asks you for the token. The agent cannot read secret variables, and you should not paste a token into a chat anyway. You add it in the dashboard, it carries on.
  5. It starts the bot and reads the logs. First start, first error: Used disallowed intents. The welcome message needs the Server Members intent, which is off by default.
  6. It explains the fix you have to make. Intents are switched on in the Discord Developer Portal, not in code, so the agent tells you which toggle to turn on (the same fix, step by step), then restarts the bot with deployments_power.
  7. It confirms the bot is online from the logs, and tells you how to test it.

When something fails later, it is the same conversation: “my bot stopped answering, check the logs” gets you deployments_logs, deployments_diagnose and an explanation instead of a stack trace.

Which AI should you use?

All of them work with the same account and the same permissions. The difference is where you talk to them.

If you…UseSetup
want to stay in a chat windowClaude, ChatGPT, Mistral Vibe, Grokpaste the server URL
already code in an editorCursor, VS Code with Copilot, Devin Desktopone click or one command
live in the terminalClaude Code, Codexone command

If you have never written code, start with a chat app. Claude and ChatGPT both work on their free plans.

If you want to read and edit the code yourself as it grows, an editor agent is the better fit: the files stay in front of you, and the agent deploys them to the same deployment.

Getting good results

  • Say what the bot should do, not how. “Welcome new members in #general and give them the Member role” beats “write a guildMemberAdd handler”.
  • Name the language if you care. Node.js and Python are both well supported. If you do not say, the agent picks one.
  • Build in small steps. One feature, test it in Discord, then the next one. When something breaks, the agent only has a few lines to look at.
  • Let it read the logs. “Check the logs” is the most useful sentence you can type. It sees the real error from your deployment, not a guess.
  • Keep secrets out of the chat. Tokens and API keys go in the Environment tab, marked secret. The agent can use them in code without ever seeing them.

What the agent can and cannot do

It acts through the same API as the dashboard, with the same rules.

  • It can create and delete deployments, write and restore files, install packages, set environment variables, start, stop and restart, read and search logs, diagnose crashes, and restore backups.
  • It cannot read the value of a secret variable, go past the limits of your plan, or touch anything outside your account.
  • Most apps ask before each action that changes something, and let you choose what may run on its own.
  • You can cut it off at any time: in your dashboard, open Developer, then My apps, and revoke it under Authorized apps.

FAQ

Do I need to know how to code?

No. You describe the bot and test it in Discord. Knowing a little helps when you want to change something precisely, and the agent can explain its code line by line if you ask.

Is it free?

The Bot-Hosting free plan includes the MCP server, and Claude and ChatGPT can both connect on their free plans. What the agent creates counts against your plan, like anything you create yourself.

Can I make a bot that talks, like a ChatGPT bot in Discord?

Yes. Ask the agent to call the OpenAI or Anthropic API from your bot. You add that API key as a secret variable, the same way as the Discord token.

What if the agent gets stuck?

Ask it to check the logs and explain the error before changing anything. If you prefer to fix it by hand, everything it wrote is in the Files tab of the deployment, and earlier versions of each file can be restored.

Ready to try? Pick your AI and ask for your first bot.