Parse and format international phone numbers via @mukundakatta/phone-mcp — E.164, national, country detection, line type
How do I use @mukundakatta/phone-mcp to parse international phone numbers into country, calling code, E.164, national/international formats, and line type? Also need to format numbers in e164, international, national, and rfc3966 styles. Should handle numbers from US, UK, Turkey, Australia, Japan, Germany, France, and gracefully handle invalid input.
@mukundakatta/phone-mcp v0.1.0 exposes 2 tools over stdio MCP. All 20 test calls succeeded with sub-ms latency. The parse tool returns structured data: country (ISO 3166-1), calling code, national number, E.164/international/national formatted strings, line type (FIXEDLINE, MOBILE, FIXEDLINEORMOBILE), and a validity flag. The format tool accepts 4 styles: e164, international, national, rfc3966. Use default_country (ISO alpha-2) for ambiguous local numbers. Invalid input returns a clear error string. Tested across US, UK, Turkey, Australia, Japan, Germany, France — all parsed correctly with proper country detection and formatting.
{ "package": "@mukundakatta/phone-mcp", "version": "0.1.0", "transport": "stdio", "install": "npm install @mukundakatta/phone-mcp @modelcontextprotocol/sdk", "entry": "node_modules/@mukundakatta/phone-mcp/dist/server.js", "tools": { "parse": { "description": "Parse a phone number. Returns country, calling code, E.164, national, international, line type, and a validity flag.", "input": { "input": "string", "default_country": "string (optional, ISO 3166-1 alpha-2)" }, "traces": [ { "call": { "input": "+14155552671" }, "result": { "valid": true, "country": "US", "country_calling_code": "1", "national_number": "4155552671", "e164": "+14155552671", "international": "+1 415 555 2671", "national": "(415) 555-2671", "type": "FIXED_LINE_OR_MOBILE" }, "ms": 3 }, { "call": { "input": "(415) 555-2671", "default_country": "US" }, "result": { "valid": true, "country": "US", "e164": "+14155552671", "national": "(415) 555-2671" }, "ms": 1, "note": "local format with default_country" }, { "call": { "input": "+442071234567" }, "result": { "valid": true, "country": "GB", "country_calling_code": "44", "national": "020 7123 4567", "type": "FIXED_LINE" }, "ms": 1 }, { "call": { "input": "+905321234567" }, "result": { "valid": true, "country": "TR", "country_calling_code": "90", "national": "0532 123 45 67" }, "ms": 1 }, { "call": { "input": "+61412345678" }, "result": { "valid": true, "country": "AU", "type": "MOBILE" }, "ms": 1 }, { "call": { "input": "+81312345678" }, "result": { "valid": true, "country": "JP", "national": "03-1234-5678" }, "ms": 0 }, { "call": { "input": "+4915123456789" }, "result": { "valid": true, "country": "DE" }, "ms": 1 }, { "call": { "input": "+33612345678" }, "result": { "valid": true, "country": "FR", "national": "06 12 34 56 78" }, "ms": 1 }, { "call": { "input": "not-a-number" }, "result": { "valid": false }, "ms": 1 }, { "call": { "input": "" }, "result": { "valid": false }, "ms": 0 }, { "call": { "input": "+1" }, "result": { "valid": false }, "ms": 0, "note": "country code only — invalid" } ] }, "format": { "description": "Format a phone number in e164, international, national, or rfc3966 style.", "input": { "input": "string", "style": "enum: e164|international|national|rfc3966", "default_country": "string (optional)" }, "traces": [ { "call": { "input": "+14155552671", "style": "e164" }, "result": { "formatted": "+14155552671" }, "ms": 1 }, { "call": { "input": "+14155552671", "style": "international" }, "result": { "formatted": "+1 415 555 2671" }, "ms": 0 }, { "call": { "input": "+14155552671", "style": "national" }, "result": { "formatted": "(415) 555-2671" }, "ms": 0 }, { "call": { "input": "+14155552671", "style": "rfc3966" }, "result": { "formatted": "tel:+14155552671" }, "ms": 0 }, { "call": { "input": "+442071234567", "style": "international" }, "result": { "formatted": "+44 20 7123 4567" }, "ms": 1 }, { "call": { "input": "+905321234567", "style": "national" }, "result": { "formatted": "0532 123 45 67" }, "ms": 0 }, { "call": { "input": "(415) 555-2671", "style": "e164", "default_country": "US" }, "result": { "formatted": "+14155552671" }, "ms": 0, "note": "local→E.164 with default_country" }, { "call": { "input": "invalid", "style": "e164" }, "result": "phone tool failed: cannot parse: invalid", "ms": 0 } ] } }, "test_summary": "20/20 calls succeeded, p50 latency 1ms" }