voyage-and-consumption-mcp-server
Version:
Voyage and consumption management server handling vessel voyages, fuel consumption, performance monitoring, and operational data with ERP access for data extraction
222 lines (221 loc) • 5.16 kB
TypeScript
import { TextContent, ImageContent, EmbeddedResource } from "@modelcontextprotocol/sdk/types.js";
import { ObjectId } from "mongodb";
export interface ToolArguments {
session_id?: string;
imo?: string;
user_id?: string;
vessel_id?: string;
voyage_id?: string;
voyage_number?: string;
port_from?: string;
port_to?: string;
departure_date?: string;
arrival_date?: string;
voyage_status?: string;
voyage_type?: string;
fuel_type?: string;
consumption_period?: string;
consumption_rate?: number;
total_consumption?: number;
efficiency_metric?: string;
analysis_type?: string;
query?: string;
filters?: Record<string, any>;
sort_by?: string;
sort_order?: string;
max_results?: number;
page_size?: number;
pagination?: number;
start_date?: string;
end_date?: string;
startDate?: string;
endDate?: string;
dateFrom?: string;
dateTo?: string;
daysAgo?: number;
lookbackHours?: number;
lookback_hours?: number;
collection?: string;
projection?: Record<string, any>;
skip?: number;
limit?: number;
per_page?: number;
query_keyword?: string;
tag?: string;
latitude?: number;
longitude?: number;
timestamp?: string;
document_link?: string;
operation?: string;
category?: string;
casefileName?: string;
casefileSummary?: string;
currentStatus?: string;
importance?: number;
min_importance?: number;
role?: string;
casefile_url?: string;
tags?: string | string[];
topic?: string;
summary?: string;
mailId?: string;
facts?: string;
links?: string[];
detailed_report?: string;
}
export interface VesselInfo {
imo: string;
name: string;
type?: string;
flag?: string;
}
export interface VoyageInfo {
id: string;
vesselId: string;
voyageNumber: string;
portFrom: string;
portTo: string;
departureDate: Date;
arrivalDate: Date;
status: string;
distance: number;
}
export interface ConsumptionData {
id: string;
vesselId: string;
voyageId?: string;
fuelType: string;
consumptionDate: Date;
quantity: number;
unit: string;
efficiency?: number;
}
export interface PerformanceMetrics {
vesselId: string;
period: string;
fuelEfficiency: number;
speedPerformance: number;
consumptionTrend: string;
}
export type ToolResponse = Array<TextContent | ImageContent | EmbeddedResource>;
export interface ServerConfig {
serverName: string;
serverVersion: string;
capabilities: {
resources: {
read: boolean;
list: boolean;
templates: boolean;
};
tools: {
list: boolean;
call: boolean;
};
prompts: {
list: boolean;
get: boolean;
};
};
}
export interface VoyageDocument {
_id?: ObjectId;
vesselId: string;
imo: string;
vesselName: string;
voyageNumber: string;
portFrom: string;
portTo: string;
departureDate: Date;
arrivalDate: Date;
status: string;
distance: number;
duration: number;
createdAt: Date;
updatedAt: Date;
}
export interface ConsumptionDocument {
_id?: ObjectId;
vesselId: string;
voyageId?: string;
imo: string;
vesselName: string;
fuelType: string;
consumptionDate: Date;
quantity: number;
unit: string;
efficiency?: number;
remarks?: string;
createdAt: Date;
updatedAt: Date;
}
export interface TypesenseDocument {
id: string;
vesselId: string;
imo: string;
vesselName: string;
voyageNumber?: string;
portFrom?: string;
portTo?: string;
fuelType?: string;
quantity?: number;
efficiency?: number;
status?: string;
createdAt: Date;
updatedAt: Date;
embedding?: number[];
embedding_text?: string;
}
export interface SearchResult {
found: number;
out_of: number;
page: number;
hits: any[];
}
export interface Config {
mongoUri: string;
mongoDbName: string;
typesenseHost: string;
typesensePort: number;
typesenseProtocol: string;
typesenseApiKey: string;
openaiApiKey: string;
llamaApiKey: string;
vendorModel: string;
s3ApiToken: string;
s3GenerateHtmlUrl: string;
perplexityApiKey: string;
googleSearchApiKey: string;
googleSearchEngineId: string;
baseUrl?: string;
}
export interface MCPPrompt {
name: string;
description: string;
arguments: any[];
}
export interface MCPTextContent {
type: "text";
text: string;
}
export interface MCPImageContent {
type: "image";
url: string;
}
export interface MCPPromptMessage {
role: "user" | "assistant" | "system";
content: MCPTextContent | MCPImageContent;
}
export interface MCPGetPromptResult {
messages: MCPPromptMessage[];
}
export interface MCPResource {
uri: string;
name: string;
description: string;
mimeType: string;
}
export interface MCPResourceResponse {
status: "success" | "error";
data?: any;
message?: string;
}