Skip to main content
Glama

IT Tools MCP Server

index.ts•2.08 kB
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { z } from "zod"; export function registerUnixTimestampConverter(server: McpServer) { server.registerTool("convert_unix_timestamp", { description: "Convert between Unix timestamps and human-readable dates", inputSchema: { input: z.string().describe("Unix timestamp (seconds) or ISO date string") }, // VS Code compliance annotations annotations: { title: "Unix-timestamp-converter", description: "Convert between Unix timestamps and human-readable dates", readOnlyHint: false } }, async ({ input }) => { try { // Auto-detect if input is a timestamp or date string const isTimestamp = /^\d+$/.test(input.trim()); if (isTimestamp) { // Convert timestamp to date const timestamp = parseInt(input); if (isNaN(timestamp)) { throw new Error("Invalid timestamp"); } const date = new Date(timestamp * 1000); const iso = date.toISOString(); const local = date.toLocaleString(); return { content: [ { type: "text", text: `Timestamp: ${timestamp}\nISO Date: ${iso}\nLocal Date: ${local}` } ] }; } else { // Convert date string to timestamp const date = new Date(input); if (isNaN(date.getTime())) { throw new Error("Invalid date string"); } const timestamp = Math.floor(date.getTime() / 1000); return { content: [ { type: "text", text: `Date: ${input}\nUnix Timestamp: ${timestamp}` } ] }; } } catch (error) { return { content: [ { type: "text", text: `Error converting timestamp: ${error instanceof Error ? error.message : 'Unknown error'}` } ] }; } } ); }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/wrenchpilot/it-tools-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server