npm package: @genlobe/mcp-server
Description: MCP Server for GenLobe SaaS API - Provides AI assistants with comprehensive API documentation for building frontend applications
Latest version: 2.2.0

---
noteId: "5546f5b00e1211f1bab5dd288af14df6"
tags: []

---

# 🔌 MCP Server for Multi-tenant SaaS API

## What is this?

This is a **documentation SDK for tenants**. Tenants (developers who build on top of this platform) install this MCP server in their AI-enabled IDEs (GitHub Copilot, Cursor, Claude, etc.) so their AI coding assistants can understand and consume the **end-user API** when building frontend applications for their customers (end-users).

**In short:** Tenant installs MCP → AI assistant learns the API → AI helps build the tenant's app faster.

This server documents ONLY the **end-user facing endpoints** (API Key + JWT auth). It does NOT document tenant dashboard or admin endpoints, as those are not relevant when building end-user frontends.

## ⚠️ Important: Two Types of Endpoints

This API has **TWO types of endpoints**:

1. **Tenant/Dashboard endpoints** (`/v1/tenant-auth/*`, `/v1/dashboard/*`)
   - For tenant admins managing their SaaS account
   - Uses JWT from tenant login
   - **NOT for end-user frontends — NOT documented by this MCP**

2. **End-user endpoints** (`/v1/auth/*`, `/v1/organizations/*`, `/v1/users/*`, etc.)
   - For building frontend applications that serve the tenant's customers
   - Uses API Key (`X-API-Key`) + User JWT
   - **USE THESE for end-user frontends — documented by this MCP**

## 🚀 Installation

Add this to your project's `.vscode/mcp.json`:

```json
{
  "servers": {
    "multiagent": {
      "command": "npx",
      "args": ["-y", "https://api.your-domain.com/static/mcp-server.tgz"],
      "env": {
        "SAAS_API_URL": "https://api.your-domain.com"
      }
    }
  }
}
```

Restart VS Code and you're ready!

---

## 🛠️ Available Tools

| Tool | Description |
|------|-------------|
| `get_api_overview` | High-level API architecture overview |
| `get_end_user_endpoints` | Detailed documentation for end-user endpoints |
| `get_request_headers` | Required HTTP headers for API requests |
| `get_sdk_template` | Complete TypeScript SDK template |
| `get_authentication_flow` | Step-by-step auth implementation guide |
| `get_common_patterns` | Best practices for frontend development |
| `search_endpoints` | Search endpoints by keyword |
| `get_endpoint_details` | Get details of a specific endpoint |
| `get_openapi_spec` | Full OpenAPI specification from live API |

---

## 📋 Quick Start for AI Assistants

When building a frontend for end-users:

1. **Call `get_api_overview`** first to understand the architecture
2. **Call `get_authentication_flow`** to implement login/register
3. **Call `get_end_user_endpoints`** to see all available endpoints
4. **Call `get_sdk_template`** to get a ready-to-use API client

---

## 📦 Local Development

```bash
cd mcp-server
npm install
npm run build
npm pack  # Creates .tgz package
```

---

## 📊 End-User Endpoint Coverage

Categories currently documented in `get_end_user_endpoints`:

| Category | Routes | Status |
|----------|--------|--------|
| `authentication` | `/v1/auth/*` | ✅ Complete |
| `organizations` | `/v1/organizations/*` (incl. subscription, usage, members) | ✅ Complete |
| `subscriptions` | `/v1/subscriptions/*` | ✅ Complete |
| `billing` | `/v1/billing/*` | ✅ Complete |
| `plans` | `/v1/plans/*` | ✅ Complete |
| `agents` | `/v1/user/agents/*` | ✅ Complete |
| `users` | `/v1/users/*` | ✅ Complete |
| `usage` | `/v1/api/usage/*`, `/v1/usage/*` | ✅ Complete |
| `entities` | `/v1/entity/schemas/*`, `/v1/entity/records/*` | ✅ Complete |
| `departments` | `/v1/departments/*` | ✅ Complete |
| `ai` | `/v1/ai/completions` | ✅ Complete |

---

## 🔧 Environment Variables

| Variable | Description | Required |
|----------|-------------|----------|
| `SAAS_API_URL` | API base URL | Yes |
| `SAAS_API_KEY` | API Key for accessing protected docs | No |