Skip to main content
Glama
README.md
# weaviate-mcp

Weaviate MCP server and document upload API for RAG.

## Setup

```bash
cp .env.example .env
# Fill in your OPENAI_API_KEY
uv sync
```

## Start Weaviate (from workspace root)

```bash
cd ..
OPENAI_API_KEY=sk-... docker compose up -d
```

## Run the MCP stdio server (for rag-agent)

```bash
uv run python server.py
```

## Run the upload API (for upload-ui)

```bash
uv run python api.py
# Listens on http://localhost:8001
```

## Collections

All three collections share the same schema:

| Field | Type | Required |
|---|---|---|
| `title` | text | yes |
| `content` | text | yes (vectorized) |
| `source` | text | yes |
| `chunk_index` | int | yes |
| `total_chunks` | int | yes |
| `account_id` | text | no (filter field) |
| `salesforce_account_id` | text | no (filter field) |

- **AccountNotes** — internal account notes
- **ProductPromos** — product promotional documents
- **Contracts** — account contracts and agreements

## MCP Tools

- `search(query, collection, limit, alpha, account_id, salesforce_account_id)`
- `retrieve(doc_id, collection)`
- `list_documents(collection, limit, offset, account_id, salesforce_account_id)`
- `get_stats(collection)` — pass `"all"` for totals

## Upload API Endpoints

- `POST /upload` — multipart: `file`, `collection`, `account_id?`, `salesforce_account_id?`
- `GET /documents?collection=...&account_id=...` — list with optional filters
- `DELETE /documents/{id}?collection=...` — delete a chunk
- `GET /stats` — counts per collection