Skip to main content
Glama
tuananhdta

RagBrain Auth MCP Server

by tuananhdta
README.md
# RagBrain auth MCP server

Simple MCP server for:

- `POST /api/v1/auth/register`
- `POST /api/v1/auth/login`
- `GET /api/v1/auth/me`

API base:

```text
https://ragbrain-production.up.railway.app
```

Override with:

```bash
export RAGBRAIN_API_BASE="https://ragbrain-production.up.railway.app"
```

## Setup

```bash
cd /home/mediax/research/mcp_research
python3 -m venv .venv
. .venv/bin/activate
python -m pip install -r requirements.txt
```

## Run streamable HTTP server

```bash
python ragbrain_auth_mcp_server.py
```

Default MCP endpoint:

```text
http://127.0.0.1:8765/mcp
```

Override host, port, or path:

```bash
MCP_HOST=0.0.0.0 MCP_PORT=8765 MCP_PATH=/mcp python ragbrain_auth_mcp_server.py
```

## Tools

### `ragbrain_register`

Inputs:

- `email`
- `password`
- `full_name` optional

### `ragbrain_login`

Inputs:

- `email`
- `password`

Returns the API `access_token` and caches it in the server process.

### `ragbrain_me`

Inputs:

- `access_token` optional

If `access_token` is omitted, it uses the token cached by the latest successful `ragbrain_login`.

## Streamable HTTP client config example

```json
{
  "mcpServers": {
    "ragbrain-auth": {
      "url": "http://127.0.0.1:8765/mcp"
    }
  }
}
```

Start the server first:

```bash
cd /home/mediax/research/mcp_research
.venv/bin/python ragbrain_auth_mcp_server.py
```

Note: some clients only support local STDIO MCP servers. Use a client that supports MCP Streamable HTTP.

## OpenAI Agents SDK client

This repo also includes a simple OpenAI Agents SDK agent that uses the MCP server above.

Start the MCP server:

```bash
cd /home/mediax/research/mcp_research
.venv/bin/python ragbrain_auth_mcp_server.py
```

In another terminal, verify the agent can see the MCP tools without calling OpenAI:

```bash
cd /home/mediax/research/mcp_research
.venv/bin/python ragbrain_auth_agent.py --list-tools
```

Run the agent with OpenAI:

```bash
cd /home/mediax/research/mcp_research
export OPENAI_API_KEY="..."
.venv/bin/python ragbrain_auth_agent.py "Login to RagBrain with email user@example.com and password ..."
```

Optional config:

```bash
export RAGBRAIN_MCP_URL="http://127.0.0.1:8765/mcp"
export OPENAI_AGENT_MODEL="gpt-5.6"
```