MCP Hub
Back to servers

Rocket.Chat Minimal MCP Server Generator

Generates customized, production-grade MCP servers for Rocket.Chat by selecting only the specific API endpoints needed for a project to minimize context bloat and token usage. It uses natural language processing to parse official OpenAPI specs and automatically create optimized TypeScript servers with built-in authentication and tests.

glama
Updated
Mar 28, 2026

Rocket.Chat Minimal MCP Server Generator

A gemini-cli extension that generates minimal MCP servers covering only the Rocket.Chat API endpoints your project needs — solving context bloat.

The Problem

Today, one major problem when adopting MCP is "context bloat" — almost all MCP servers are written to support a large set of service APIs, and anyone adopting them will have most of their token budget consumed by static MCP requirements associated with API calls they will never need. This situation is exacerbated in agentic code generator workflows where every agent is burning tokens in loops unnecessarily while supporting APIs/tools that the project will never use.

The Solution

This generator solves context bloat by letting Rocket.Chat developers generate a production-grade minimal MCP server covering only the subset of APIs required by their project. It automatically parses Rocket.Chat's official OpenAPI specs at runtime, lets you describe what you need in plain English, identifies the relevant API domains, presents endpoints grouped by functionality, recommends the most relevant ones for your use case, and lets you adjust the selection to match your project's exact needs. The output is a multi-file MCP server with auto-generated tests, a shared HTTP client, and authentication handling built in — significantly reducing the cost of all Rocket.Chat code generation projects involving MCP.

Key Features

  • Automatic OpenAPI parsing — Fetches Rocket.Chat's official OpenAPI YAML specs from GitHub at runtime and parses them using @apidevtools/swagger-parser, dereferencing all $refs into a fully resolved spec. No manual endpoint definitions needed.
  • Zero maintenance — When RC adds or changes endpoints, they're available immediately. No manual updates, no version lag.
  • Full API coverage — All 12 Rocket.Chat API domains available out of the box, always in sync with the official spec.
  • Tag-based grouping — Endpoints are organized by semantic tags (e.g., "Chat", "Channels", "DM") so Gemini can quickly identify the right operationIds for workflow composition.
  • Three-tier caching — Parsed specs are cached in memory for instant reuse, persisted to disk (24h TTL) to survive restarts, and fetched from GitHub only on cache miss. Parse once, reuse everywhere.
  • Lazy schema extraction — When browsing endpoints, only lightweight summaries (name, method, path) are extracted. The expensive JSON Schema mapping only runs for the endpoints you actually select for generation.
  • Parallel domain fetching — When multiple API domains are queried (e.g., omnichannel + messaging), all specs are fetched and parsed concurrently rather than one at a time.
  • Domain-indexed lookup — During browsing, the tool builds an index of which endpoints belong to which domain. When generating, it uses this index to search only the relevant spec files instead of scanning all 12.
  • Multi-file output with tests — Template-based TypeScript generation using @modelcontextprotocol/sdk. Each generated server is a complete project: one file per tool, a shared HTTP client for all API calls, per-tool test files, server-level tests, a README with setup instructions, and config files.
  • Minimality report — After generation, shows exactly how much you saved: endpoint count reduction, schema size reduction, and estimated token savings compared to a full-coverage server.

Prerequisites

Installation

  1. Clone the repository:

    git clone https://github.com/sezallagwal/mcpGenerator
    cd mcpGenerator
    
  2. Install dependencies:

    npm install
    
  3. Register as a gemini-cli extension:

    mkdir -p ~/.gemini/extensions
    ln -s "$(pwd)" ~/.gemini/extensions/mcpGenerator
    

    This symlinks the project into gemini-cli's extensions directory so it's loaded automatically.

Usage

Launch gemini in any project directory. The extension provides two MCP tools that Gemini uses automatically based on your natural language requests.

Quick Start

Just describe what you want in plain English:

gemini> I need an MCP server that can send messages and manage channels

Gemini will:

  1. Identify the relevant API domains from your description
  2. Fetch all endpoints and pick the operationIds needed for your use case
  3. If realtime events are needed, discover available Apps-Engine capabilities
  4. Ask where to save the project
  5. Compose the workflow, validate, and generate the complete project in one call

See Workflow Details below for the full step-by-step.

Slash Command

You can also use the explicit slash command:

gemini> /generator:generate send alerts based on workspace statistics

Example Prompts

  • "Generate an MCP server for sending messages and managing channels"
  • "I need a support bot that handles live chat and messaging"
  • "Build an MCP server to monitor workspace health and statistics"
  • "Create tools for user management and role assignment"

Workflow Details

The workflow is fully automated — Gemini handles endpoint selection, workflow composition, and code generation autonomously based on your description.

  1. Describe your intent — Just say what you want in plain English (e.g., "build a support bot for live chat"). You don't need to know API domain names — Gemini maps your keywords to the right domains automatically.
  2. Capability guide — Gemini calls get_capability_guide which returns all endpoints and app events. Gemini picks the operationIds and eventInterfaces it needs.
  3. Schema lookup — Gemini calls get_endpoint_schemas with the chosen operationIds to get exact request/response schemas and event shapes.
  4. Generated! — Gemini passes the workflow steps and configuration directly to generate, which validates, composes, and writes the complete project to disk in one call.

Generated Project Structure

The generator creates a monorepo with an MCP server (always) and optionally an RC App (if realtime events are needed):

my-project/
├── mcp-server/
│   ├── src/
│   │   ├── server.ts          # MCP server entry point
│   │   ├── rc-client.ts       # Shared Rocket.Chat HTTP client
│   │   ├── tools/
│   │   │   └── *.ts           # One file per workflow tool
│   │   └── tests/
│   │       └── setup.ts       # Test setup
│   ├── package.json
│   ├── tsconfig.json
│   ├── .env.example
│   └── README.md
└── rc-app/                    # Only if eventInterfaces provided
    ├── *App.ts                # Main app class
    ├── handlers/              # Event handler files
    ├── commands/              # Slash command files
    ├── bridge/                # HTTP bridge to MCP server
    └── package.json

Using the Generated Server

cd my-rc-server
npm install
cp .env.example .env
# Edit .env with your Rocket.Chat credentials

The generated server uses stdio transport. To use it, add it to your MCP client's configuration:

{
  "mcpServers": {
    "my-rc-server": {
      "command": "npm",
      "args": ["start"],
      "cwd": "/path/to/my-rc-server"
    }
  }
}

You can also run npm start directly to test the server on stdio.

Available API Domains

The generator covers all 12 Rocket.Chat API domains (~500-800+ endpoints total):

DomainDescription
authenticationLogin, OAuth, 2FA, tokens
messagingSend messages, threads, reactions, pins
roomsChannels, groups, DMs, room settings
user-managementUsers, roles, avatars, presence
omnichannelLive chat, agents, visitors, queues
integrationsWebhooks, incoming/outgoing integrations
settingsWorkspace settings, permissions, OAuth apps
statisticsServer stats, online users, metrics
notificationsPush notifications, preferences
content-managementEmoji, custom sounds, assets
marketplace-appsApps, marketplace, permissions
miscellaneousServer info, DNS, licenses

API specs are fetched from the official Rocket.Chat OpenAPI repo at runtime, so the generator always reflects the latest available endpoints.

Development

Project Structure

mcpGenerator/
├── gemini-extension.json    # Extension manifest
├── GEMINI.md                # Model instructions for Gemini
├── commands/
│   └── generator/
│       └── generate.toml    # /generator:generate slash command
├── src/
│   ├── server.ts            # MCP server (3 tools: get_capability_guide, get_endpoint_schemas, generate)
│   ├── utils.ts             # Shared utilities
│   ├── mcp-server/
│   │   ├── mcpServerCodegen.ts    # Workflow → TypeScript code generator
│   │   ├── mcpServerTemplates.ts  # Shared project scaffolding templates
│   │   ├── workflowComposer.ts    # Workflow validation & composition
│   │   ├── types.ts               # Workflow type definitions
│   │   └── parser/
│   │       ├── index.ts           # OpenAPI parser (fetch, list, extract)
│   │       ├── schema-mapper.ts   # OpenAPI → JSON Schema conversion
│   │       └── types.ts           # Parser type definitions
│   ├── rc-app/
│   │   ├── rcAppGenerator.ts      # RC App project orchestrator
│   │   ├── rcAppTemplates.ts      # RC App code templates
│   │   ├── parser.ts              # Apps-Engine capability parser (ts-morph)
│   │   └── types.ts               # RC App type definitions
│   └── tests/
│       ├── parser.test.ts
│       ├── generate.test.ts
│       ├── workflow.test.ts
│       ├── rc-app.test.ts
│       └── rc-app-parser.test.ts
├── package.json
└── tsconfig.json

Running Tests

npm test

Building

npm run build

Running in Dev Mode

npm run dev

License

MIT

Reviews

No reviews yet

Sign in to write a review