mcp.ts

Overview

The mcp.ts file defines TypeScript interfaces and types related to the representation and management of MCP servers and their associated tools within the system. MCP servers appear to be external or internal service endpoints characterized by metadata, configuration variables, and a collection of tools. Each tool has its own schema describing inputs and operational details.

This file primarily serves as a type definition module that standardizes the structure of MCP server data and tools, enabling type-safe interactions throughout the application when dealing with MCP server information, tool configurations, and responses from server listing APIs.


Interfaces and Types

IMcpServer

Represents an individual MCP server and its metadata.

Property

Type

Description

create_date

string

ISO date string representing creation time of the server record.

description

null

Currently always null, reserved for future description field.

id

string

Unique identifier of the MCP server.

name

string

Human-readable name of the MCP server.

server_type

string

Type/category of the server (e.g., "fetch_2", "github_1").

update_date

string

ISO date string representing last update time of the server.

url

string

Base URL endpoint of the MCP server.

variables

Record<string, any> & { tools?: IMCPToolObject }

Configuration variables with optional tools object mapping tool configurations.

Usage Example:

const exampleServer: IMcpServer = {
  create_date: "2023-05-01T12:00:00Z",
  description: null,
  id: "server_123",
  name: "GitHub Server",
  server_type: "github_1",
  update_date: "2023-06-01T12:00:00Z",
  url: "https://api.github.com",
  variables: {
    apiKey: "abc123",
    tools: {
      toolA: {
        enabled: true,
        description: "A tool for handling repos",
        inputSchema: {
          title: "Tool A Input",
          type: "object",
          properties: {
            symbol: { title: "Symbol", type: "string" }
          },
          required: ["symbol"]
        }
      }
    }
  }
};

IMCPTool

Defines a tool associated with an MCP server.

Property

Type

Description

annotations

null

Currently always null, reserved for future use.

description

string

Description of what the tool does.

enabled

boolean

Whether the tool is enabled/active.

inputSchema

InputSchema

JSON schema defining the expected input parameters for the tool.

name

string

Name identifier of the tool.


InputSchema

Defines the JSON schema for a tool's input parameters.

Property

Type

Description

title

string

Human-readable title of the schema.

type

string

Type of the schema, usually "object".

properties

Properties

Defines the individual input properties.

required

string[]

List of required property keys.


Properties and ISymbol

These interfaces define the properties expected in the input schema.

Interface

Property

Type

Description

Properties

symbol

ISymbol

The symbol property specification.

ISymbol

title

string

Title of the symbol property.

type

string

Data type of the symbol property (e.g., "string").


IMCPToolObject

A mapped object representing a collection of tools keyed by string, each tool omitting the name property inherited from IMCPTool.

type IMCPToolObject = Record<string, Omit<IMCPTool, 'name'>>;

This is useful for storing tool configurations indexed by their keys without duplicating the tool name.


IMCPToolRecord

Similar to IMCPToolObject but includes the full IMCPTool interface, including the name.

type IMCPToolRecord = Record<string, IMCPTool>;

IMcpServerListResponse

Defines the response structure when retrieving a list of MCP servers.

Property

Type

Description

mcp_servers

IMcpServer[]

Array of MCP servers returned.

total

number

Total count of MCP servers available.


IExportedMcpServers & McpServers

Represents a structured export of MCP servers, pre-grouped by keys (fetch_2, github_1).

interface IExportedMcpServers {
  mcpServers: McpServers;
}

interface McpServers {
  fetch_2: IExportedMcpServer;
  github_1: IExportedMcpServer;
}

IExportedMcpServer

Represents an exported MCP server with authorization and configuration details.

Property

Type

Description

authorization_token

string

Authorization token for the server.

name

string

Server name.

tool_configuration

Record<string, any>

Configuration settings for tools.

type

string

Server type/category.

url

string

Server URL endpoint.


Implementation Details


Interactions with Other System Components


Mermaid Class Diagram

classDiagram
    class IMcpServer {
        +create_date: string
        +description: null
        +id: string
        +name: string
        +server_type: string
        +update_date: string
        +url: string
        +variables: Record<string, any> & { tools?: IMCPToolObject }
    }
    class IMCPTool {
        +annotations: null
        +description: string
        +enabled: boolean
        +inputSchema: InputSchema
        +name: string
    }
    class InputSchema {
        +properties: Properties
        +required: string[]
        +title: string
        +type: string
    }
    class Properties {
        +symbol: ISymbol
    }
    class ISymbol {
        +title: string
        +type: string
    }
    class IExportedMcpServer {
        +authorization_token: string
        +name: string
        +tool_configuration: Record<string, any>
        +type: string
        +url: string
    }
    class McpServers {
        +fetch_2: IExportedMcpServer
        +github_1: IExportedMcpServer
    }
    class IExportedMcpServers {
        +mcpServers: McpServers
    }
    class IMcpServerListResponse {
        +mcp_servers: IMcpServer[]
        +total: number
    }

    IMcpServer "1" o-- "0..*" IMCPTool : tools
    IMCPTool --> InputSchema : inputSchema
    InputSchema --> Properties : properties
    Properties --> ISymbol : symbol
    IExportedMcpServers --> McpServers : mcpServers
    McpServers --> IExportedMcpServer : fetch_2, github_1
    IMcpServerListResponse --> IMcpServer : mcp_servers

Summary

The mcp.ts file is a foundational type definition resource that models MCP servers and their tools, including metadata, configuration schemas, and export/import structures. It facilitates type-safe data exchange and manipulation of MCP server-related data throughout the application without implementing business logic or processing workflows. The structured and extensible design supports future enhancements such as richer descriptions, annotations, and expanded input schemas.