> ## Documentation Index
> Fetch the complete documentation index at: https://portkey-docs-feat-rerank-documentation.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# LibreChat

> Connect your MCP servers to LibreChat through Portkey's secure MCP gateway

## Overview

LibreChat is an open-source AI chat platform that supports MCP (Model Context Protocol) for enhanced tool integration. Through Portkey's MCP Gateway, you can seamlessly connect any MCP server to LibreChat without managing infrastructure or authentication.

### Key Benefits

* **Secure Authentication**: Portkey handles OAuth flows and token management
* **Unified Authentication**: Single OAuth token to rule them all
* **Team Collaboration**: Share MCP server configurations, manage access permissions, and ensure everyone on your team has the tools they need—configured correctly, every time
* **Complete Observability**: See every request, track latency, monitor errors, and understand usage patterns

***

## Prerequisites

Before you begin, ensure you have:

1. **LibreChat** installed and running
2. **Portkey account** with workspace access
3. **MCP server** registered in Portkey's MCP Hub
4. **Access** to your `librechat.yaml` configuration file

***

## Quick Setup

### Step 1: Get Your MCP Server URL

1. Log in to [Portkey Dashboard](https://app.portkey.ai)
2. Navigate to **MCP Hub** → **Your Servers**
3. Copy your server URL:
   ```
   https://mcp.portkey.ai/:workspace-id/:server-id/mcp
   ```

### Step 2: Configure LibreChat

1. Open your `librechat.yaml` configuration file
2. Add your MCP server configuration under the `mcpServers` section:

```yaml theme={"system"}
mcpServers:
  portkey-mcp:
    type: "streamable-http"
    url: "https://mcp.portkey.ai/:workspace-id/:server-id/mcp"
```

### Step 3: Restart LibreChat

Restart LibreChat to load the new MCP configuration:

```bash theme={"system"}
# If using Docker
docker-compose restart

```

***

### Step 4: Authentication

Portkey handles all authentication flows automatically:

1. **First Connection**: When LibreChat first connects to an authenticated MCP server, Portkey will:
   * Open your browser for OAuth authorization (if required)
   * Store credentials securely
   * Maintain session state

2. **Subsequent Connections**: Authentication tokens are refreshed automatically

3. **Team Access**: Workspace members share the same authentication scope based on your Portkey settings

***

## Configuration Examples

### Single Server Setup

```yaml theme={"system"}
mcpServers:
  linear-integration:
    type: "streamable-http"
    url: "https://mcp.portkey.ai/ws-abc123/linear-def456/mcp"
```

### Multiple Servers Setup

```yaml theme={"system"}
mcpServers:
  linear:
    type: "streamable-http"
    url: "https://mcp.portkey.ai/ws-abc123/linear-def456/mcp"

  github:
    type: "streamable-http"
    url: "https://mcp.portkey.ai/ws-abc123/github-ghi789/mcp"

  slack:
    type: "streamable-http"
    url: "https://mcp.portkey.ai/ws-abc123/slack-jkl012/mcp"
```

***

## Support

Need help? We're here for you:

* 📧 Email: [support@portkey.ai](mailto:support@portkey.ai)
* 💬 Discord: [Join our community](https://discord.gg/portkey)
