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. Use this utility to quickly identify the server's external IP for network configuration or troubleshooting.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Registers the get_public_ip tool using server.tool, including description and inline handler function.
    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 }] }; } );
  • Helper function that fetches the public IP address from api.ipify.org using HTTPS.
    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")); }); }); }
  • src/index.ts:20-20 (registration)
    Invokes the registerPublicIpTool function to register the get_public_ip tool on the MCP server.
    registerPublicIpTool(server);
  • Inline handler function for the get_public_ip tool that calls the helper and returns formatted text response.
    async () => { const publicIp = await getPublicIp(); return { content: [{ type: "text", text: publicIp }] }; }

Other Tools

Related Tools

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