Onyx Knowledge Base MCP server

Bridges Onyx knowledge bases with semantic search and chat capabilities, enabling teams to access organizational knowledge through RAG-powered document retrieval with configurable context windows.
Back to servers
Provider
lupuletic
Release date
Mar 24, 2025
Language
TypeScript
Package
Stats
410 downloads
9 stars

Onyx MCP Server is a bridge that connects MCP-compatible clients to your Onyx knowledge base, enabling powerful semantic search and retrieval of relevant context from your documents. It provides enhanced search capabilities and chat integration to help you easily access information stored in your Onyx systems.

Installation Options

Via Smithery

The easiest way to install the Onyx MCP Server for Claude Desktop is through Smithery:

npx -y @smithery/cli install @lupuletic/onyx-mcp-server --client claude

Manual Installation

Prerequisites

  • Node.js (v16 or higher)
  • An Onyx instance with API access
  • An Onyx API token

Setup Steps

  1. Clone the repository:

    git clone https://github.com/lupuletic/onyx-mcp-server.git
    cd onyx-mcp-server
    
  2. Install dependencies:

    npm install
    
  3. Build the server:

    npm run build
    
  4. Configure your Onyx API Token:

    export ONYX_API_TOKEN="your-api-token-here"
    export ONYX_API_URL="http://localhost:8080/api"  # Adjust as needed
    
  5. Start the server:

    npm start
    

Configuring MCP Clients

Claude Desktop App

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "onyx-search": {
      "command": "node",
      "args": ["/path/to/onyx-mcp-server/build/index.js"],
      "env": {
        "ONYX_API_TOKEN": "your-api-token-here",
        "ONYX_API_URL": "http://localhost:8080/api"
      },
      "disabled": false,
      "alwaysAllow": []
    }
  }
}

Claude in VSCode (Cline)

Add to your Cline MCP settings file:

{
  "mcpServers": {
    "onyx-search": {
      "command": "node",
      "args": ["/path/to/onyx-mcp-server/build/index.js"],
      "env": {
        "ONYX_API_TOKEN": "your-api-token-here",
        "ONYX_API_URL": "http://localhost:8080/api"
      },
      "disabled": false, 
      "alwaysAllow": []
    }
  }
}

Other MCP Clients

For other MCP clients, consult their documentation on adding custom MCP servers. You'll need to provide:

  • The command: node
  • Path to the server file: /path/to/onyx-mcp-server/build/index.js
  • Environment variables: ONYX_API_TOKEN and ONYX_API_URL

Using the MCP Tools

Search Tool

The search_onyx tool provides direct access to Onyx's search capabilities:

<use_mcp_tool>
<server_name>onyx-search</server_name>
<tool_name>search_onyx</tool_name>
<arguments>
{
  "query": "customer onboarding process",
  "documentSets": ["Company Policies", "Training Materials"],
  "maxResults": 3,
  "chunksAbove": 1,
  "chunksBelow": 1,
  "retrieveFullDocuments": true
}
</arguments>
</use_mcp_tool>

Parameters:

  • query (required): The topic to search for
  • documentSets (optional): List of document set names to search within
  • maxResults (optional): Maximum number of results (default: 5, max: 10)
  • chunksAbove (optional): Number of chunks to include above the matching chunk (default: 1)
  • chunksBelow (optional): Number of chunks to include below the matching chunk (default: 1)
  • retrieveFullDocuments (optional): Whether to retrieve full documents (default: false)

Chat Tool

The chat_with_onyx tool leverages Onyx's chat API with LLM + RAG:

<use_mcp_tool>
<server_name>onyx-search</server_name>
<tool_name>chat_with_onyx</tool_name>
<arguments>
{
  "query": "What is our company's policy on remote work?",
  "personaId": 15,
  "documentSets": ["Company Policies", "HR Documents"],
  "chatSessionId": "optional-existing-session-id"
}
</arguments>
</use_mcp_tool>

Parameters:

  • query (required): The question to ask Onyx
  • personaId (optional): The ID of the persona to use (default: 15)
  • documentSets (optional): List of document set names to search within
  • chatSessionId (optional): Existing chat session ID to continue a conversation

Chat Sessions

The chat tool supports maintaining conversation context. After the first call, you'll receive a chat_session_id in the metadata that you can use in subsequent calls.

When to Use Each Tool

  • Use Search When: You need specific information and want to control how much context is retrieved.
  • Use Chat When: You need comprehensive answers that combine multiple sources or want the LLM to synthesize information.

For optimal results, you can combine both tools - search for specific details and chat for comprehensive understanding.

Use Cases

  • Knowledge Management: Access your organization's knowledge base
  • Customer Support: Help agents quickly find relevant information
  • Research: Conduct deep research across organizational documents
  • Training: Access training materials and documentation
  • Policy Compliance: Ensure teams have access to the latest policies

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later