npm package: @infopercept/invinsense-rag-mcp
Description: MCP (Model Context Protocol) server that provides Claude and other AI assistants with semantic search access to InvinSense documentation using Vertex AI RAG Engine. Enables AI-powered documentation queries with grounded, citation-backed responses.
Latest version: 1.0.1

# @infopercept/invinsense-rag-mcp

MCP (Model Context Protocol) server that provides Claude and other AI assistants with semantic search access to InvinSense documentation using Vertex AI RAG Engine.

[![npm version](https://img.shields.io/npm/v/@infopercept/invinsense-rag-mcp.svg)](https://www.npmjs.com/package/@infopercept/invinsense-rag-mcp)

## Installation

```bash
npm install -g @infopercept/invinsense-rag-mcp
```

Or use directly with npx (recommended for MCP):

```bash
npx @infopercept/invinsense-rag-mcp
```

## MCP Configuration

### Claude Code CLI

Add to `~/.claude/settings.json`:

```json
{
  "mcpServers": {
    "invinsense-rag": {
      "command": "npx",
      "args": ["@infopercept/invinsense-rag-mcp"],
      "env": {
        "RAG_API_URL": "https://your-rag-endpoint",
        "RAG_API_KEY": "your-api-key"
      }
    }
  }
}
```

### Claude Desktop

Add to `~/.config/claude/mcp.json`:

```json
{
  "mcpServers": {
    "invinsense-rag": {
      "command": "npx",
      "args": ["@infopercept/invinsense-rag-mcp"],
      "env": {
        "RAG_API_URL": "https://your-rag-endpoint",
        "RAG_API_KEY": "your-api-key"
      }
    }
  }
}
```

## Environment Variables

| Variable      | Description             | Default                 |
| ------------- | ----------------------- | ----------------------- |
| `RAG_API_URL` | RAG service endpoint    | `http://localhost:8080` |
| `RAG_API_KEY` | API key for RAG service | (none)                  |

## Available Tools

### `rag_query`

Semantic search through InvinSense documentation.

```text
Search for "How does identity broker authentication work?"
```

### `rag_generate`

Get AI-generated answers with citations using Gemini + RAG.

```text
What authentication protocols does the Identity Broker support?
```

### `rag_corpus_info`

Get RAG corpus information (document count, status).

### `rag_health`

Check RAG service health and connectivity.

## Architecture

```text
┌─────────────────┐     ┌─────────────────┐     ┌─────────────────┐
│  Claude/MCP     │────▶│   MCP Server    │────▶│   RAG Service   │
│   Client        │     │  (this package) │     │  (your endpoint)│
└─────────────────┘     └─────────────────┘     └────────┬────────┘
                                                         │
                              ┌───────────────────────────┼───────────────────────────┐
                              │                           │                           │
                              ▼                           ▼                           ▼
                     ┌─────────────────┐        ┌─────────────────┐        ┌─────────────────┐
                     │  Vertex AI RAG  │        │   Google AI     │        │      GCS        │
                     │    Engine       │        │  Gemini 2.0     │        │   (Documents)   │
                     └─────────────────┘        └─────────────────┘        └─────────────────┘
```

## RAG Service Setup

This MCP server connects to a RAG service backend. See the full repository for RAG service setup:

### Prerequisites

- Node.js >= 20.0.0
- Google Cloud account with billing enabled
- Service account with Vertex AI permissions

### Quick Start

```bash
# Clone the repository
git clone https://gitlab.invinsense.dev/infopercept/docs/pg-rag.git
cd pg-rag

# Install dependencies
npm install

# Configure environment
cp .env.example .env
# Edit .env with your GCP credentials

# Start the RAG service
npm run dev
```

### API Endpoints

| Endpoint          | Method | Description                    |
| ----------------- | ------ | ------------------------------ |
| `/health/live`    | GET    | Liveness probe                 |
| `/health/ready`   | GET    | Readiness probe with checks    |
| `/v1/query`       | POST   | Semantic search                |
| `/v1/generate`    | POST   | RAG-powered answer generation  |
| `/v1/corpus`      | GET    | Corpus information             |

## License

MIT