LibreChat MCP Servers

by wally-kroeker

471 downloads Not rated yet

About

Instructions for setting up SuperGateway MCP servers in docker containers for docker deployments of LibreChat

Explore

- Converts stdio MCP servers to SSE using Supergateway.
- Each server runs in its own Docker container.
- Consistent port numbering (8003+ for new servers).
- Uses environment variables for sensitive data.
- Follows least privilege principle for security.

1. A running LibreChat installation
2. Docker and Docker Compose
3. The MCP server package you want to integrate

Each MCP server should:
1. Use Supergateway as a bridge (stdio to SSE)
2. Follow consistent port numbering (8003+)
3. Connect to the librechat_default network
4. Use environment variables for sensitive data

RUN npm install -g supergateway @organization/mcp-server-package

Here's a complete example of adding a new MCP server:

1. Directory Structure:

librechat/
├── mcp-server/
│ └── Dockerfile
├── docker-compose.override.yml
└── librechat.yaml

2. Dockerfile:

FROM node:18
WORKDIR /app
RUN npm install -g supergateway @org/mcp-server
CMD ["npx", "-y", "supergateway", "--stdio", "npx -y @org/mcp-server", "--port", "8002"]

3. docker-compose.override.yml:

services:
mcp-server:
build:
context: ./mcp-server
ports:
- "8002:8002"
networks:
- librechat_default
environment:
- API_KEY=${MCP_API_KEY}

4. librechat.yaml:

mcpServers:
mcp-server:
type: sse
url: "http://mcp-server:8002/sse"

This directory contains Model Context Protocol (MCP) server implementations that extend LibreChat's capabilities through the Supergateway bridge.

These are the projects I am tiing together.
- This is the think that gives any kind of tool to the Agent. Model Context Protocol Specification
- Converts stdio MCP servers to SSE and each server can run in its own container. I will see how this scales Supergateway Documentation
- Multi-LLM agent and MCP client LibreChat Documentation

Directory Structure

mcp/
├── brave-search/          # Brave Search API integration
│   ├── Dockerfile
│   └── README.md
├── [future-server]/      # Template for future MCP servers
│   ├── Dockerfile
│   └── README.md
└── README.md             # This file

Adding New MCP Servers

1. Create a new directory under mcp/ for your server
2. Add required files:
- Dockerfile - Server build configuration
- README.md - Server-specific documentation
3. Update docker-compose.override.yml to add your service
4. Update librechat.yaml to configure the MCP server

Common Configuration

Each MCP server should:
1. Use Supergateway as a bridge (stdio to SSE)
2. Follow consistent port numbering (8003+)
3. Connect to the librechat_default network
4. Use environment variables for sensitive data

Port Assignments

- 8003: Brave Search
- 8004-8099: Reserved for future MCP servers

Security Best Practices

1. Never commit API keys or sensitive data
2. Use environment variables for secrets
3. Follow least privilege principle
4. Keep services isolated
5. Regularly update dependencies

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.