Skip to main content
Glama

IT Tools MCP Server

index.ts•2.34 kB
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { z } from "zod"; import { Buffer } from 'buffer'; export function registerDecodeSafelink(server: McpServer) { server.registerTool("decode_safelink", { description: "Decode Microsoft Outlook SafeLink URLs", inputSchema: { safelink: z.string().describe("SafeLink URL to decode") }, // VS Code compliance annotations annotations: { title: "Decode Safelink", description: "Decode Microsoft Outlook SafeLink URLs", readOnlyHint: false } }, async ({ safelink }) => { try { const url = new URL(safelink); // Check if it's a SafeLink URL - use secure hostname validation const allowedSafeLinkHosts = [ 'safelinks.protection.outlook.com', 'nam11.safelinks.protection.outlook.com', 'eur01.safelinks.protection.outlook.com', 'apc01.safelinks.protection.outlook.com', 'gcc02.safelinks.protection.outlook.com' ]; if (!allowedSafeLinkHosts.includes(url.hostname.toLowerCase())) { return { content: [{ type: "text", text: "This doesn't appear to be a legitimate SafeLink URL from Microsoft Outlook." }] }; } // Extract the actual URL from the 'url' parameter const actualUrl = url.searchParams.get('url'); if (!actualUrl) { return { content: [{ type: "text", text: "Could not find the original URL in the SafeLink." }] }; } // Decode the URL const decodedUrl = decodeURIComponent(actualUrl); return { content: [{ type: "text", text: `SafeLink Decoder Results: Original SafeLink: ${safelink} Decoded URL: ${decodedUrl} Additional Parameters: - Data: ${url.searchParams.get('data') || 'N/A'} - Reserved: ${url.searchParams.get('reserved') || 'N/A'} - Source: ${url.searchParams.get('source') || 'N/A'}` }] }; } catch (error) { return { content: [{ type: "text", text: `Error decoding SafeLink: ${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