Skip to main content
Glama
arjshiv

Local Utilities MCP Server

by arjshiv

get_public_ip

Retrieve the public IP address of the machine hosting the MCP server for network configuration and connectivity verification.

Instructions

Returns the public IP address of the machine running the MCP server.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The asynchronous handler function for the 'get_public_ip' tool. It fetches the public IP using the helper function and returns it in MCP text content format.
    async () => { const publicIp = await getPublicIp(); return { content: [{ type: "text", text: publicIp }] }; }
  • Core helper function that fetches the machine's public IP address via HTTPS request to api.ipify.org.
    export async function getPublicIp(): Promise<string> { return new Promise((resolve, reject) => { https.get('https://api.ipify.org', (res) => { let data = ''; res.on('data', (chunk) => { data += chunk; }); res.on('end', () => { resolve(data.trim()); }); }).on('error', (err) => { console.error("Error fetching public IP from api.ipify.org:", err); reject(new Error("Failed to fetch public IP address")); }); }); }
  • Function that registers the 'get_public_ip' tool on the MCP server by calling server.tool with name, description, and handler.
    export function registerPublicIpTool(server: McpServer): void { server.tool( "get_public_ip", "Returns the public IP address of the machine running the MCP server.", async () => { const publicIp = await getPublicIp(); return { content: [{ type: "text", text: publicIp }] }; } ); }
  • src/index.ts:20-20 (registration)
    Top-level call to registerPublicIpTool during server setup, which registers the get_public_ip tool.
    registerPublicIpTool(server);

Latest Blog Posts

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/arjshiv/localutils-mcp-server'

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