Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/S1LV4/th0th/llms.txt

Use this file to discover all available pages before exploring further.

OpenCode is the recommended way to use th0th with the best performance and user experience.

Overview

th0th integrates with OpenCode in two ways:
  1. MCP Server - Via the published npm package (recommended)
  2. OpenCode Plugin - Native plugin integration
  3. Development Mode - Run from source for development

Prerequisites

1

Install th0th

Ensure th0th is installed and the API server is running:
# Start the th0th API
cd th0th
bun run start:api
Verify: curl http://localhost:3333/health
2

Install OpenCode

If you haven’t already, install OpenCode from opencode.ai

Configuration

This method uses the published npm package @th0th-ai/mcp-client.
1

Open OpenCode configuration

Edit your OpenCode configuration file:
~/.config/opencode/opencode.json
2

Add th0th MCP server

Add the following to your mcpServers section:
opencode.json
{
  "mcpServers": {
    "th0th": {
      "type": "local",
      "command": ["bunx", "@th0th-ai/mcp-client"],
      "env": {
        "TH0TH_API_URL": "http://localhost:3333"
      },
      "enabled": true
    }
  }
}
3

Restart OpenCode

Restart OpenCode to load the MCP server.
Use npx instead of bunx if you prefer npm:
"command": ["npx", "@th0th-ai/mcp-client"]

Method 2: OpenCode Plugin

The native plugin provides deeper integration with OpenCode.
opencode.json
{
  "plugin": ["@th0th-ai/opencode-plugin"]
}
The plugin automatically:
  • Discovers the th0th API endpoint
  • Registers all th0th tools
  • Provides optimized context handling

Method 3: Development Mode

For development and testing, run th0th directly from source:
opencode.json
{
  "mcpServers": {
    "th0th": {
      "type": "local",
      "command": ["bun", "run", "/path/to/th0th/apps/mcp-client/src/index.ts"],
      "enabled": true
    }
  }
}
Replace /path/to/th0th with the actual path to your th0th installation.

Available Tools

Once configured, OpenCode will have access to these th0th tools:

th0th_index

Index a project directory for semantic search

th0th_search

Semantic + keyword search with filters

th0th_remember

Store important information in persistent memory

th0th_recall

Search stored memories from previous sessions

th0th_compress

Compress context (70-98% token reduction)

th0th_optimized_context

Search + compress in one call for max efficiency

th0th_analytics

Usage patterns, cache performance, metrics

Verification

1

Test the connection

In OpenCode, ask:
List all th0th tools
You should see all 7 th0th tools listed.
2

Test indexing

Index your current project:
Use th0th to index this project
3

Test search

Search for code:
Search th0th for authentication code

Configuration Options

API URL

By default, th0th connects to http://localhost:3333. To use a different URL:
{
  "mcpServers": {
    "th0th": {
      "env": {
        "TH0TH_API_URL": "http://your-server:3333"
      }
    }
  }
}

Enable/Disable Server

Toggle the MCP server without removing the configuration:
{
  "mcpServers": {
    "th0th": {
      "enabled": false  // Set to true to re-enable
    }
  }
}

Troubleshooting

  1. Check that the th0th API is running: curl http://localhost:3333/health
  2. Restart OpenCode
  3. Check OpenCode logs for MCP connection errors
  4. Verify the configuration file path is correct
Ensure the TH0TH_API_URL matches your running API server:
# Check if API is running
curl http://localhost:3333/health

# If not, start it
cd th0th && bun run start:api
Install Bun or use npx instead:
# Install Bun
curl -fsSL https://bun.sh/install | bash

# Or use npx
"command": ["npx", "@th0th-ai/mcp-client"]
The package may not be published yet. Use development mode:
"command": ["bun", "run", "/path/to/th0th/apps/mcp-client/src/index.ts"]

Next Steps

Configuration

Configure embedding providers and advanced settings

MCP Tools

Learn about all available MCP tools

Docker Setup

Run th0th in Docker containers

Troubleshooting

Common issues and solutions

Build docs developers (and LLMs) love