0.1.3 • Published 7 months ago

@scom/mcp-rag v0.1.3

Weekly downloads
-
License
AGPL-3.0
Repository
github
Last release
7 months ago

SCOM RAG MCP Server

An MCP (Model Context Protocol) server that provides RAG (Retrieval-Augmented Generation) capabilities for SCOM framework code generation. This server connects to the scom-vector-db HTTP API service at https://mcp-vector01.decom.dev, providing access to indexed SCOM framework documentation and code for enhanced context when generating SCOM-based applications.

Quick Start

Add to your MCP client configuration file (Claude, Cursor, Copilot, etc.):

{
  "mcpServers": {
    "scom-mcp": {
      "command": "npx",
      "args": ["@scom/mcp-rag", "--transport", "stdio"],
      "env": {
        "SCOM_API_KEY": "your-api-key-here"
      }
    }
  }
}

Features

  • Vector Search: Semantic search with automatic embedding generation via HTTP API
  • Multi-Modal Search: Search across documentation, code examples, API definitions, and implementations
  • Component Intelligence: Get comprehensive information about specific SCOM components
  • Collection Management: List and describe vector database collections
  • Batch Operations: Perform multiple searches efficiently in a single request
  • Caching: LRU cache for improved performance on repeated queries
  • Query Expansion: Automatic query enhancement for better search results
  • Multiple Transports: Supports both stdio (CLI) and HTTP transports

Prerequisites

  • Node.js 18+ (ES modules support required)
  • NPM or Yarn
  • Access to Vector Database API (https://mcp-vector01.decom.dev)
  • API Key for authentication (provided in configuration)

Installation

# Clone the repository (if not already done)
git clone <repository-url>
cd mcp-scom

# Install dependencies
npm install

# Build the TypeScript project
npm run build

Usage

Starting the Server

# Development mode with auto-reload
npm run dev              # Default transport (HTTP)
npm run dev:stdio        # stdio transport only
npm run dev:http         # HTTP transport only

# Production mode
npm start                # Start with default configuration
npm run start:stdio      # Start with stdio transport
npm run start:http       # Start with HTTP transport
npm run start:both       # Start with both transports

# Using specific transport via command line
node build/index.js --transport stdio
node build/index.js -t http

MCP Client Configuration

For Claude Desktop (stdio)

Add to your Claude Desktop configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "scom-mcp": {
      "command": "npx",
      "args": ["@scom/mcp-server", "--transport", "stdio"],
      "env": {
        "SCOM_API_KEY": "your-api-key-here"
      }
    }
  }
}

Or if you're running locally:

{
  "mcpServers": {
    "scom-mcp": {
      "command": "node",
      "args": ["/path/to/mcp-rag/build/index.js", "--transport", "stdio"],
      "env": {
        "SCOM_API_KEY": "your-api-key-here"
      }
    }
  }
}

For HTTP Clients

{
  "mcpServers": {
    "scom-mcp": {
      "type": "streamable-http",
      "url": "http://localhost:3011"
    },
    "env": {
      "SCOM_API_KEY": "your-api-key-here"
    }
  }
}

Available Tools

1. search_scom_docs

Search SCOM framework documentation.

Parameters:

  • query (string, required): Search query
  • component (string, optional): Filter by component name
  • limit (number, optional): Max results (default: 10)
  • version (string, optional): SCOM version filter

Example:

{
  "query": "button component props",
  "component": "i-button",
  "limit": 5
}

2. search_scom_code

Find code examples and implementations.

Parameters:

  • query (string, required): Code pattern or description
  • language (string, optional): ts, tsx, js, jsx
  • component (string, optional): Component name
  • element_type (string, optional): class, function, interface, type, component
  • limit (number, optional): Max results (default: 10)

Example:

{
  "query": "onClick handler",
  "language": "tsx",
  "element_type": "function"
}

3. get_component_details

Get comprehensive information about a specific component.

Parameters:

  • component_name (string, required): Exact component name
  • include_examples (boolean, optional): Include usage examples (default: true)
  • include_implementation (boolean, optional): Include implementation (default: true)
  • include_api (boolean, optional): Include API docs (default: true)

Example:

{
  "component_name": "i-modal",
  "include_examples": true
}

4. search_by_type

Search by specific content types.

Parameters:

  • query (string, required): Search query
  • types (array, required): Content types to search
    • Options: documentation_md, code_implementation, code_example, api_definition, type_definition, component_definition
  • limit (number, optional): Results per type (default: 5)

Example:

{
  "query": "event handling",
  "types": ["code_example", "documentation_md"],
  "limit": 3
}

5. get_similar_chunks

Find content similar to given text.

Parameters:

  • text (string, required): Reference text
  • exclude_source (boolean, optional): Exclude same source (default: true)
  • limit (number, optional): Number of results (default: 10)
  • min_score (number, optional): Minimum similarity score (default: 0.7)

Example:

{
  "text": "import { Button } from '@ijstech/components'",
  "min_score": 0.8
}

6. build_code_context

Build optimized context for code generation.

Parameters:

  • query (string, required): Search query
  • target_component (string, optional): Target component
  • max_tokens (number, optional): Max tokens (default: 8000)

7. list_collections

List all available collections in the vector database.

Parameters: None

8. describe_collection

Get detailed information about a specific collection.

Parameters:

  • collection_name (string, required): Name of the collection to describe

9. batch_search_components

Perform multiple searches in a single request.

Parameters:

  • queries (array, required): Array of search queries
  • filters (object, optional): Filters to apply to all searches
  • limit (number, optional): Maximum results per query (default: 5)

10. check_vector_db_health

Check the health status of the vector database service.

Parameters: None

Deployment

Docker Deployment

# Start with Docker Compose
docker-compose up --build -d

# Verify deployment
curl http://localhost:3011/health

# View logs
docker-compose logs -f

# Stop services
docker-compose down

Development

Project Structure

mcp-scom/
├── src/
│   ├── index.ts              # Unified multi-transport server
│   ├── server_runner.ts      # Server initialization logic
│   ├── core/                 # Core MCP server implementation
│   ├── transports/           # Transport implementations
│   ├── services/             # RAG and vector services
│   ├── tools/                # MCP tool definitions
│   └── utils/                # Utilities and helpers
├── build/                    # Compiled JavaScript
├── test/                     # Test files
└── docker-compose.yml        # Docker configuration

Adding New Tools

  1. Define tool in src/tools/definitions.ts
  2. Implement handler in src/core/MCPServerCore.ts
  3. Add tests in test files
  4. Update README documentation