Setup guide

Start with one support channel.

ThreadSherpa runs on your machine or server. You create the Discord application, connect a database, choose a model, and decide where the bot can help. No hosted signup, no shared bot account.

Before you start

You need a project checkout, Node.js 22 or newer, a Discord account, and a database. A local model also needs Ollama and enough memory to run it. Hosted model providers can be used instead, but they receive the questions and evidence used for replies.

Clone ThreadSherpa.Get the code from the public GitHub repository. The bot uses Node.js 22 or newer; building this website needs Node.js 22.23.4 or newer.

Use a dedicated test server first. Do not import another community's messages, screenshots, or policies as a knowledge base. The bot reads new events in channels you connect; it does not backfill historical posts.

1. Create the Discord bot

  1. Open theDiscord Developer Portaland create an application. Name it ThreadSherpa.
  2. Open Bot, reset or copy the bot token, and keep it private. The token goes in DISCORD_BOT_TOKEN. A reset invalidates the previous token.
  3. On the Bot page, enable Message Content Intent. ThreadSherpa does not request Server Members Intent or Presence Intent.
  4. Open Installation and enable Guild Install. Invite the bot with the bot and applications.commands scopes. It does not need Administrator.

The bot needs View Channels, Read Message History, Send Messages, Send Messages in Threads (or Send Messages in Posts), and Embed Links in the support channel. Thread permissions are inherited from the parent forum, but channel overrides can still block it.

Reference:Discord's bot setup guideandDiscord permissions.

2. Choose storage and a model

MongoDB

Create a free MongoDB Atlas cluster, a database user, and a network access entry for the machine running the bot. Copy the driver connection string. It looks likemongodb+srv://… and includes the database user and password. Password characters reserved in URLs must be percent-encoded.

Local inference with Ollama

Install Ollamaand pull the reply model and embedding model named in the project's environment template. Keep Ollama running while the bot is running. Local inference keeps the synthesis request on your machine; Discord and the database still use the network.

Paper Instruments

Paper is optional. It uses server-side API credit for synthesis, while local embeddings still run through Ollama. Add its key only on the machine running the bot. Do not put a provider key in browser code, a screenshot, or a commit.

3. Configure the environment

Create .env from the project's .env.example. Keep it out of version control. These are the variable names you will see; values are yours and should never be posted publicly.

VariablePurpose
DISCORD_BOT_TOKENThe bot token from the Discord Developer Portal.
MONGODB_URIThe Atlas driver connection string.
MONGODB_DB_NAMEOptional database name. The default is threadsherpa.
MODEL_PROVIDERollama or paper.
PAPER_INSTRUMENTS_API_KEYOnly for Paper mode. Optional otherwise.
DISCORD_DEV_GUILD_IDOptional test-server ID for immediate command registration.

The project's setup checker creates .env only when it does not exist. It never overwrites existing keys. It checks access without posting Discord messages or requesting paid generation.

4. Check the configuration and start

Terminal
npm ci
npm run setup
npm run dev

Run the checker after each configuration change. You want Discord, MongoDB, and the chosen models to report OK. The checker prints a ready-to-use invite URL when the Discord token works. Open it, choose your test server, and authorize the bot. For a production process, use npm run build then npm start.

5. Connect the support forum

A forum's top-level view has no normal message composer, so do not run setup there. Run the command from a regular text channel, such as #bot-commands, as a server administrator:

In Discord
/setup channel:#your-forum autonomy_mode:auto

Select your actual support forum in the command's channel option. This works before the forum has any posts, and you do not repeat it for every question. Commands run in the text channel; the bot connects the selected forum.

If you already have a forum post, you can alternatively run/setup autonomy_mode:auto inside that post on first setup; the bot selects its parent forum. For an ordinary text support channel, run/setup autonomy_mode:auto directly in it, or select it with thechannel option.

Automatic replies apply to new posts in the selected forum. Unknown questions wait quietly in /queue. To stop monitoring a forum, run/setup remove_channel:#your-forum from a regular text channel.

6. Save the first answer

  1. Create a synthetic question in a support post.
  2. Reply as a moderator, then right-click your answer, open Apps, and choose Save this answer. You will see Saved. orAlready saved.
  3. Ask a new question in different words. When the saved facts support it, ThreadSherpa writes a short reply and links the original answer.
  4. Check /queue for questions that were not answered. Use/answers to edit or remove saved guidance, and /teach when there is no existing answer message to save.

A clear “that worked” confirmation closes a case without another bot message. A “that didn't work” reply queues the attempted advice for review. Saving knowledge does not post into older questions.

If something blocks you

What you seeWhat to check
Discord token rejectedUse the Bot Token, not the client secret or application ID. If you reset it, update .env.
Bot cannot read postsEnable Message Content Intent on the Bot page, then restart the bot.
MongoDB cannot connectCheck the database user, password encoding, and the current IP entry in Atlas.
Slash commands are missingInvite the bot with the URL from the checker and restart it. For multiple servers, set DISCORD_DEV_GUILD_ID for immediate test-server registration.
No reply in a forum postRun /setup channel:#your-forum autonomy_mode:auto from a text channel. Unknown questions are intentionally quiet; check /queue and the forum permissions.
Ollama is missingOpen Ollama, pull the models named in the environment template, and run the checker again.

Read the security boundaries before using real community data. For operational limits and data handling, the project's security notes are the authority.