#!/usr/bin/env node
import { FastMCP } from "fastmcp";
import {
formatTool,
nowTool,
addTool,
subtractTool,
differenceTool,
compareTool,
} from "./tools.js";
import {
addParams,
compareParams,
differenceParams,
formatParams,
subtractParams,
} from "./params.js";
const server = new FastMCP({
name: "Date Operations",
version: "1.0.0",
});
server.addTool({
name: "now",
description: "Get the current date and time.",
execute: nowTool,
});
server.addTool({
name: "format",
description: "Get the current date.",
parameters: formatParams,
execute: formatTool,
});
server.addTool({
name: "add",
description:
"Add the specified years, months, weeks, days, hours, minutes, and seconds to the given date.",
parameters: addParams,
execute: addTool,
});
server.addTool({
name: "subtract",
description:
"Subtract the specified years, months, weeks, days, hours, minutes, and seconds to the given date.",
parameters: subtractParams,
execute: subtractTool,
});
server.addTool({
name: "difference",
description:
"Get the difference between two dates in years, months, weeks, days, hours, minutes, and seconds.",
parameters: differenceParams,
execute: differenceTool,
});
server.addTool({
name: "compare",
description:
"Compare whether the first date is after, before, or equal to the second date.",
parameters: compareParams,
execute: compareTool,
});
server.start({
transportType:
(process.env.TRANSPORT_TYPE as "httpStream" | "stdio") || "httpStream",
httpStream: {
port: 3000,
},
});