npm package: @rightanswers/mcp
Description: MCP Server for RightAnswers Enterprise Knowledge Base — zero external dependencies, works on Node 16+
Author: RightAnswers
Latest version: 1.3.0

# RightAnswers MCP Server

A lightweight, zero-dependency MCP (Model Context Protocol) server that connects Claude, GitHub Copilot, ChatGPT, and any other MCP-compatible AI client to your **RightAnswers enterprise knowledge base**.

## Features

- **AI-generated answers** — surfaces RightAnswers' GenAI summarized responses
- **Full article search** — returns ranked KB articles with metadata
- **Per-user configuration** — credentials and company URL set via environment variables
- **Zero infrastructure** — runs locally on each device, spawned automatically by the AI client
- **Zero dependencies** — uses only Node.js built-ins; no npm install required at runtime
- **Multi-client compatible** — works with Claude Desktop, GitHub Copilot (VS Code), ChatGPT desktop

## Prerequisites

- **Node.js 16 or higher**
- Access to a RightAnswers portal (URL, username, password, company code)

**Check your version:**
```bash
node --version   # must be v16.x.x or higher
```

**Upgrade if needed (pick one):**
```bash
# Option A — nvm (recommended)
nvm install 20 && nvm alias default 20

# Option B — Homebrew (macOS)
brew install node

# Option C — direct download
# https://nodejs.org/en/download  →  Node 20 LTS
```

---

## Installation

### Option A — Run directly with npx (recommended, no install required)

```bash
npx @rightanswers/mcp
```

### Option B — Install globally

```bash
npm install -g @rightanswers/mcp
```

### Option C — Clone and run locally

```bash
git clone https://github.com/RightAnswers/rta-mcp.git
cd rta-mcp
node rightanswers-server.js
```

---

## Configuration

The server is configured entirely via environment variables — no credentials are hardcoded.

| Variable          | Required | Description                                              |
|-------------------|----------|----------------------------------------------------------|
| `RA_BASE_URL`     | ✅       | Your RightAnswers portal URL (e.g. `https://acme.rightanswers.com`) |
| `RA_USERNAME`     | ✅       | Your RightAnswers username                               |
| `RA_PASSWORD`     | ✅       | Your RightAnswers password                               |
| `RA_COMPANY_CODE` | ✅       | Company code (e.g. `NA`, `EMEA`)                         |
| `RA_AP_INTERFACE` | ❌       | Interface type: `sa` (Support Agent) or `ss` (Self-Service). Default: `sa` |
| `RA_IGNORE_SSL`   | ❌       | Set `true` only in dev/test with self-signed certs. Default: `false` |

---

## Connecting to AI Clients

### Claude Desktop

Add to your `claude_desktop_config.json` (found in `~/Library/Application Support/Claude/` on macOS or `%APPDATA%\Claude\` on Windows):

```json
{
  "mcpServers": {
    "rightanswers": {
      "command": "npx",
      "args": ["-y", "@rightanswers/mcp@latest"],
      "env": {
        "RA_BASE_URL":      "https://yourcompany.rightanswers.com",
        "RA_USERNAME":      "your.username@company.com",
        "RA_PASSWORD":      "your_password",
        "RA_COMPANY_CODE":  "NA",
        "RA_AP_INTERFACE":  "sa"
      }
    }
  }
}
```

> **macOS note:** Claude Desktop launches MCP servers without a shell, so `npx` may not be on `$PATH`. If the server fails to start, replace `"command": "npx"` with the full path to your npx binary. Find it by running `which npx` in Terminal, e.g.:
> ```json
> "command": "/usr/local/bin/npx"
> ```

### GitHub Copilot (VS Code)

Add to your VS Code `settings.json`:

```json
{
  "mcp": {
    "servers": {
      "rightanswers": {
        "type": "stdio",
        "command": "npx",
        "args": ["-y", "@rightanswers/mcp@latest"],
        "env": {
          "RA_BASE_URL":      "https://yourcompany.rightanswers.com",
          "RA_USERNAME":      "your.username@company.com",
          "RA_PASSWORD":      "your_password",
          "RA_COMPANY_CODE":  "NA",
          "RA_AP_INTERFACE":  "sa"
        }
      }
    }
  }
}
```

### ChatGPT Desktop

In ChatGPT Desktop, go to Settings → Connectors → Add MCP Server and provide the same `command`, `args`, and `env` values shown above.

---

## Available Tool

### `searchKnowledgeBase`

Searches the RightAnswers knowledge base and returns an AI-generated answer plus ranked articles.

| Parameter          | Type    | Required | Description |
|--------------------|---------|----------|-------------|
| `query`            | string  | ✅       | The question or search phrase |
| `generateAiAnswer` | boolean | ❌       | Request an AI-summarized answer (default: `true`) |

**Example prompt to your AI client:**
> "Search the knowledge base: how do I reset my VPN credentials?"

---

## Enterprise Deployment (MDM / Intune / Jamf)

IT teams can pre-configure the MCP server for all employees by pushing the config file with environment variables set to per-user credentials. The `npx` command will download and run the server on first use — no manual setup required from end users.

---

## Testing the Server Manually

You can verify the server works by piping JSON-RPC requests directly:

```bash
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | \
  RA_BASE_URL=https://yourserver RA_USERNAME=user RA_PASSWORD=pass RA_COMPANY_CODE=NA \
  npx @rightanswers/mcp
```

---

## License

MIT