All files / src/core-entities mcp-config.entity.ts

100% Statements 11/11
100% Branches 0/0
100% Functions 0/0
100% Lines 9/9

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 5845x 45x 45x                       45x             45x             45x                       45x             45x               45x    
import { Entity, Column, Index } from 'typeorm';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { BaseEntity } from './base.entity';
 
/**
 * McpConfig stores configuration for an MCP (Model Context Protocol) server.
 * MCP servers provide external tools that the AI can call as native tool definitions.
 * Each active MCP tool is surfaced as a separate tool definition with name pattern
 * `{server_name}__{tool_name}` (double underscore).
 *
 * Configuration follows the standard MCP format with command, args, and environment variables.
 * When is_active is true, the server is launched and its tools are available to the LLM.
 */
@Entity('mcp_configs')
export class McpConfig extends BaseEntity {
  @ApiProperty({
    description: 'Unique name for this MCP server',
    example: 'filesystem',
  })
  @Column({ type: 'text', unique: true })
  @Index()
  server_name: string;
 
  @ApiProperty({
    description: 'Command to launch the MCP server',
    example: 'npx',
  })
  @Column({ type: 'text' })
  command: string;
 
  @ApiProperty({
    description: 'Arguments for the command',
    example: [
      '-y',
      '@modelcontextprotocol/server-filesystem',
      '/path/to/project',
    ],
    type: 'array',
  })
  @Column({ type: 'json' })
  args: string[];
 
  @ApiPropertyOptional({
    description: 'Environment variables for the server process',
    example: { NODE_ENV: 'production' },
  })
  @Column({ type: 'json', nullable: true })
  env: Record<string, string>;
 
  @ApiProperty({
    description: 'Whether this MCP server is active/enabled',
    example: true,
    default: true,
  })
  @Column({ type: 'boolean', default: true })
  is_active: boolean;
}