Skip to main content

MCP Tools

Nibchat connects to any server that implements the Model Context Protocol (MCP). Tools are automatically discovered, injected into the agent context, and called on-demand during conversations.

How it works

  1. On startup, Nibchat reads your agent.yaml for the list of MCP servers.
  2. When a user first sends a message, Nibchat opens a per-session connection to each server.
  3. Available tools are listed in the /api/mcp/connect response and shown to the LLM.
  4. When the LLM decides to call a tool, Nibchat executes it server-side and streams the result back.

Configuring MCP servers

Add servers under mcpServers in agent.yaml:

mcpServers:
- url: https://my-files-server.example.com
name: files

- url: https://my-database-server.example.com
name: db
headers:
Authorization: "Bearer secret-token"

Static auth headers

If your MCP server requires authentication but doesn't use OAuth, set static headers. This bypasses the OAuth flow entirely.

mcpServers:
- url: https://my-server.example.com
name: myserver
headers:
Authorization: "Bearer my-api-key"
X-Custom-Header: "some-value"

OAuth authentication

MCP servers that implement OAuth 2.0 are supported. When a server requires authorization:

  1. An amber Authorize button appears in the sidebar.
  2. The user clicks it — this opens an OAuth popup (must be user-triggered to pass browser popup blockers).
  3. After completing OAuth, Nibchat stores the tokens in the database and reconnects.

OAuth tokens are persisted per-session and survive server restarts.

PUBLIC_URL

For OAuth to work, set PUBLIC_URL to your server's public URL. The redirect URI registered with your OAuth provider must be {PUBLIC_URL}/oauth/callback.

Tool name collisions

If multiple MCP servers expose tools with the same name, Nibchat automatically prefixes them:

{serverName}__{toolName}

The serverName comes from the name field in agent.yaml, falling back to the server hostname.

Viewing available tools

The UI shows all connected tools in the bottom bar of the chat panel. Hover over the tools indicator to see the full list.