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 |
|---|---|---|
|
| ISO date string representing creation time of the server record. |
|
| Currently always |
|
| Unique identifier of the MCP server. |
|
| Human-readable name of the MCP server. |
|
| Type/category of the server (e.g., "fetch_2", "github_1"). |
|
| ISO date string representing last update time of the server. |
|
| Base URL endpoint of the MCP server. |
|
| Configuration variables with optional |
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 |
|---|---|---|
|
| Currently always null, reserved for future use. |
|
| Description of what the tool does. |
|
| Whether the tool is enabled/active. |
|
| JSON schema defining the expected input parameters for the tool. |
|
| Name identifier of the tool. |
InputSchema
Defines the JSON schema for a tool's input parameters.
Property | Type | Description |
|---|---|---|
|
| Human-readable title of the schema. |
|
| Type of the schema, usually |
|
| Defines the individual input properties. |
|
| List of required property keys. |
Properties and ISymbol
These interfaces define the properties expected in the input schema.
Propertiescontains a single propertysymbolof typeISymbol.ISymboldescribes thesymbolinput property.
Interface | Property | Type | Description |
|---|---|---|---|
|
|
| The symbol property specification. |
|
|
| Title of the symbol property. |
|
| Data type of the symbol property (e.g., |
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 |
|---|---|---|
|
| Array of MCP servers returned. |
|
| 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 for the server. |
|
| Server name. |
|
| Configuration settings for tools. |
|
| Server type/category. |
|
| Server URL endpoint. |
Implementation Details
The file is structured purely as a type definitions module and contains no executable logic or algorithms.
Interfaces make extensive use of TypeScript's utility types such as
RecordandOmitfor flexible and precise type composition.The
variablesproperty inIMcpServerincludes an intersection type allowing arbitrary key-value pairs, with a special optionaltoolsproperty to store tool configurations.The
InputSchemainterface follows a simplified JSON Schema representation, facilitating automatic validation or UI generation for tool inputs.
Interactions with Other System Components
This file is likely consumed by services or components responsible for:
Fetching MCP server data from APIs.
Managing server and tool configurations.
Validating or rendering input forms based on
InputSchema.Exporting/importing MCP server configurations.
The
IMcpServerListResponseinterface suggests this file is used to type API responses from an endpoint listing MCP servers.IExportedMcpServersand related interfaces imply functionality for exporting server configurations, possibly for persistence or transfer between environments.Tools defined here integrate with MCP servers and are likely used by other modules to invoke or configure specific functionalities.
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.