Deploy a Discord bot with an AI agent

DeployUpdated Agent quickstart

Connect your coding agent to your hosting account, upload your project and inspect its status from the same conversation. The agent uses your account's scoped access; your Discord bot token stays write-only. Paid setup returns a checkout link for you to open and pay. A Free claim requires a verified email address and a captcha in your browser; any sign-in method works.

Before you connect

Sign in, verify your email and open Account > AI agents. If AI agents is not available, use the normal getting started guide; agent access has not been enabled for your account. Pick your client and use Build and deploy for the full workflow (read, manage and deploy, including deleting bots and files). Everything adds billing-read. Choose 30 days, 90 days (default), one year or never. New tokens cover all your owned bots. Existing restricted credentials still cannot create new bots or start Checkout, and return 404 for excluded bots. The page shows last use and lets you revoke each token or OAuth grant. Read includes console logs; manage includes source files and deletion. Share the smallest scope you need and revoke the token after use.

Save the one-time token in the protected BH_API_TOKEN environment of the client that will connect. A graphical app or remote workspace may have a different environment from your terminal. Do not put the value into a project file, a command argument or a chat message. The snippets below refer to the variable name, never a populated credential. Keep the client's normal tool approvals enabled and review each change it proposes.

Codex

Add the following to your personal Codex config.toml. Set BH_API_TOKEN in the environment that starts Codex. The writes approval policy asks before tools that change your account. This is a bearer connection; it does not need an OAuth login command. Check the official OpenAI documentation for your installed client.

[mcp_servers.discordbothost]
url = "https://my.discordbothost.com/mcp"
bearer_token_env_var = "BH_API_TOKEN"
default_tools_approval_mode = "writes"

Claude Code

Use this entry in your reviewed .mcp.json. Claude Code expands the named environment variable in the Authorization header. Review project-level server trust before using shared configuration. See Claude Code's MCP reference.

{
  "mcpServers": {
    "discordbothost": {
      "type": "http",
      "url": "https://my.discordbothost.com/mcp",
      "headers": {
        "Authorization": "Bearer ${BH_API_TOKEN}"
      }
    }
  }
}

Cursor

Use the entry below in your personal or project .cursor/mcp.json. Cursor uses its env: interpolation syntax. Restart or reconnect the server after setting the client's environment. See Cursor's MCP reference.

{
  "mcpServers": {
    "discordbothost": {
      "url": "https://my.discordbothost.com/mcp",
      "headers": {
        "Authorization": "Bearer ${env:BH_API_TOKEN}"
      }
    }
  }
}

VS Code

Merge this server into your MCP configuration, such as .vscode/mcp.json. Use the configuration destination and agent harness appropriate to your installation. The environment must be available on the host making the HTTP connection. See the VS Code configuration reference.

{
  "servers": {
    "discordbothost": {
      "type": "http",
      "url": "https://my.discordbothost.com/mcp",
      "headers": {
        "Authorization": "Bearer ${env:BH_API_TOKEN}"
      }
    }
  }
}

Local stdio clients

The repository includes a small forwarding script for clients that launch local MCP commands. Use Node 24 or newer, replace the absolute path, and launch the client with protected BH_API_TOKEN in its environment. The script inherits that value. It forwards to the remote service; it does not run your bot locally. The package is not published, so an npx package command is not available.

{
  "mcpServers": {
    "discordbothost": {
      "command": "node",
      "args": [
        "/absolute/path/to/bh/packages/mcp-shim/cli.mjs"
      ]
    }
  }
}

Sign in with OAuth

When OAuth is enabled, clients discover registration automatically and open the account consent page. Review the app name and scopes; registered names are supplied by the app developer. Grants cover your owned bots, with the same sandbox as a personal token. Access tokens last one hour and renew with rotating refresh tokens for up to ninety days. Revoke the grant in Account > AI agents. Reusing an older refresh token revokes that connection family. No client secret or password belongs in client configuration.

For Codex, use this configuration instead of the bearer entry, then run the login command below. See the official MCP setup reference.

[mcp_servers.discordbothost]
url = "https://my.discordbothost.com/mcp"
scopes = ["read", "manage", "deploy"]
default_tools_approval_mode = "writes"
codex mcp login discordbothost --scopes read,manage,deploy --oauth-client-registration dcr

For Claude Code, Cursor and VS Code, remove the headers property from the matching JSON above. Keep the URL and client-specific outer key. Use the client's sign-in action when prompted; in Claude Code open /mcp and authenticate the server. Check the official Claude Code, Cursor and VS Code guides for your installed version.

ChatGPT desktop

In ChatGPT desktop, open Settings > MCP servers > Add server > Streamable HTTP and paste the URL below. Choose Authenticate, sign in to your hosting account and review the consent page before allowing access. No local config file or personal token is needed. ChatGPT web is not offered by this setup flow.

https://my.discordbothost.com/mcp

OAuth must be enabled by the host before this works. If discovery returns 404, use a supported token client or the dashboard until the host enables OAuth.

First conversation

Ask the agent to read the bh://docs/agents resource, call whoami, list_plans and list_bots, and propose a deployment before changing anything. If a tool is absent, check token scopes. New paid bots and Free claims return human steps; complete the browser step and ask the agent to list bots again. Then provide the Discord token through your client's protected secret workflow, upload source, set the startup file and start the bot. Check console output and usage rather than inferring success from a request acknowledgment. Follow the complete example for exact calls.

Client settings were checked against the linked official documentation on . Actual availability depends on account access and client policy; a successful connection test is still needed on your installation.

Read the agent quickstart, tool reference, API reference, complete deployment example and troubleshooting guide.

Still stuck? Contact support