Public
Use this MCP to get your IP address
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.

my-ip-mcp

An MCP server that tells you your own public IP address. Runs serverlessly on val.town.

Tool

NameDescriptionInputs
get_ipReturns the public IP address of the caller(none)

Example response

Your IP address is: 203.0.113.42

Usage

Point any MCP-compatible client at this val's URL.

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{ "mcpServers": { "ip": { "type": "http", "url": "https://my-ip-mcp.val.run/" } } }

Restart Claude Desktop, then ask: "What's my IP address?"

Cursor / VS Code Copilot

{ "mcp": { "servers": { "ip": { "type": "http", "url": "https://my-ip-mcp.val.run/" } } } }

curl (manual test)

# 1 — Handshake curl -s -X POST https://my-ip-mcp.val.run/ \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"curl","version":"1.0"}}}' # 2 — Call the tool curl -s -X POST https://my-ip-mcp.val.run/ \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"get_ip","arguments":{}}}'

How it works

  • Transport: MCP Streamable HTTP — a single HTTP endpoint that handles JSON-RPC 2.0 messages via POST
  • IP detection: reads the X-Forwarded-For header set by val.town's CDN (first value = real client IP), falling back to X-Real-IP
  • Stateless: no sessions, no storage, no authentication
  • No logging: IP addresses are never stored or logged

Supported MCP methods

MethodPurpose
initializeHandshake — returns server capabilities
notifications/initializedClient acknowledgement (202, no body)
pingKeep-alive
tools/listReturns the get_ip tool descriptor
tools/callInvokes get_ip and returns the caller's IP