Skip to content

MCP server

MCP provides an easy way to integrate SerenityGPT functionality within MCP clients such as Cursor, VS Code, or your own MCP client.

This page shows how to run the SerenityGPT MCP server and connect an MCP-capable client. After setup, the serenity_docs_answer tool is available directly in your MCP client.


Prerequisites

  • A running SerenityGPT backend.
  • Docker/Docker Compose on the host where you run the MCP server.
  • An MCP client.

Start the MCP server

Add the following lines to your docker-compose.yaml:

  mcp-server:
    <<: *common
    container_name: mcp-server
    command: python manage.py run_mcp_server --host HOST --port PORT --transport streamable-http --path /mcp/

Parameters

  • --host: interface to bind on, for example 0.0.0.0 to accept remote connections, or 127.0.0.1 for local only.
  • --port: port for the MCP server, for example 8765.
  • --transport: streamable-http is the current MCP transport. sse is still accepted for older clients.
  • --path: path where the endpoint is served, /mcp/ in this example. --sse-path is deprecated and means the same.

Start (or restart) Compose:

docker compose up -d mcp-server

The server exposes two endpoints:

Endpoint Token Tenant
/mcp/ Tenant token or JWT Fixed by the token
/mcp/company/ Company token Chosen by the agent on every call

Connect with a tenant token

Use a tenant token when the client searches a single tenant. Each tenant needs its own entry in the client.

In Cursor go to Settings → Tools & Integrations, click New MCP Server, and paste:

{
  "mcpServers": {
    "serenity": {
      "url": "HOST:PORT/mcp/",
      "headers": {
        "Authorization": "Bearer SERENITY_TENANT_TOKEN"
      }
    }
  }
}

Replace:

  • HOST:PORT with your MCP server host and port, for example http://localhost:8765 or https://mcp.example.com, depending on your setup and client requirements.
  • SERENITY_TENANT_TOKEN with the token of the tenant to search.

VS Code also needs "type": "http" in the server entry.


Connect with a company token

New

Company tokens on the MCP server are available since October 2026.

Use a company token when one client should reach every tenant of your company, for example one product line per tenant. One entry in the client then replaces one entry per tenant, and the agent picks the tenant for each question.

The company token is the same token that the SerenityGPT team provides for the system API. The SerenityGPT team enables it for the MCP server in your company configuration.

{
  "mcpServers": {
    "serenity": {
      "url": "HOST:PORT/mcp/company/",
      "headers": {
        "Authorization": "Bearer SERENITY_COMPANY_TOKEN"
      }
    }
  }
}

On this endpoint the serenity_docs_answer tool has a required tenant argument. The tool lists the tenant codes and names of your company, so the agent chooses the tenant that fits the question.


Use the Serenity tool

Once connected, the serenity_docs_answer tool becomes available in your client.

You can invoke the tool by prefacing your question with:

ask serenity: <your question>

Example

  • ask serenity: Show me the docs for connecting Confluence and how to restrict access by space.