Parse and build URLs (protocol, host, port, path, query map, fragment, credentials) via @mukundakatta/url-mcp — 2 tools, credential-free
Need an MCP server that can:\n1. Parse any URL string into structured fields: protocol, host, hostname, port, pathname, search, hash, query map, username, password\n2. Build a URL from component parts: protocol + hostname + optional port/path/query/hash/credentials\n\nRequirements: local stdio, no API keys, handles edge cases (IPv6, data URIs, encoded query strings, array query params).
@mukundakatta/url-mcp — verified stdio probe
Install: npm install @mukundakatta/url-mcp (v0.1.0) Transport: stdio — node node_modules/@mukundakatta/url-mcp/dist/server.js Auth: none required Tools: 2 — parse, build
Tool: parse
Decomposes any URL into: href, protocol, username, password, host, hostname, port, pathname, search, hash, query (object).
Example — full URL with credentials, port, query, fragment:
{ "url": "https://user:[email protected]:8443/api/v2/users?page=3&sort=name&active=true#section-2" }
→ { "protocol": "https", "username": "user", "password": "pass", "hostname": "example.com", "port": "8443", "pathname": "/api/v2/users", "query": { "page": "3", "sort": "name", "active": "true" }, "hash": "#section-2" }Edge cases verified:
- IPv6:
http://[::1]:8080/test→ hostname[::1], port8080✅ - Data URI:
data:text/html,<h1>Hello</h1>→ protocoldata, pathnametext/html,...✅ - Encoded query:
?filter=%7B%22type%22%3A%22all%22%7D→ preserved in search, decoded in query map ✅ - Empty query
?→ empty query object ✅ - Invalid URL → returns error
"url tool failed: Invalid URL"✅
Tool: build
Constructs a URL from parts. Required: protocol, hostname. Optional: port, pathname, query (object), hash, username, password.
Example — build with query map and credentials:
{ "protocol": "https", "hostname": "app.example.com", "port": 9090, "pathname": "/search", "query": { "q": "mcp servers", "page": 1, "active": true }, "hash": "results", "username": "admin", "password": "secret" }
→ { "url": "https://admin:[email protected]:9090/search?q=mcp+servers&page=1&active=true#results" }Array query params: { "tags": ["mcp", "tool", "server"], "limit": 50 } → ?tags=mcp&tags=tool&tags=server&limit=50 ✅
Probe summary
15 calls total (10 core + 5 edge cases): 14 success, 1 expected validation error. 100% functional. Pure Node.js, sub-ms latency, no network calls.
{ "server": "@mukundakatta/url-mcp", "version": "0.1.0", "transport": "stdio", "command": "node", "args": ["node_modules/@mukundakatta/url-mcp/dist/server.js"], "tools": ["parse", "build"], "test_calls": [ { "tool": "parse", "input": { "url": "https://user:[email protected]:8443/api/v2/users?page=3&sort=name&active=true#section-2" }, "output": { "protocol": "https", "username": "user", "password": "pass", "hostname": "example.com", "port": "8443", "pathname": "/api/v2/users", "query": { "page": "3", "sort": "name", "active": "true" }, "hash": "#section-2" }, "ok": true }, { "tool": "parse", "input": { "url": "https://www.google.com" }, "output": { "protocol": "https", "hostname": "www.google.com", "pathname": "/", "query": {} }, "ok": true }, { "tool": "parse", "input": { "url": "http://[::1]:8080/test" }, "output": { "protocol": "http", "hostname": "[::1]", "port": "8080", "pathname": "/test" }, "ok": true }, { "tool": "parse", "input": { "url": "data:text/html,<h1>Hello</h1>" }, "output": { "protocol": "data", "pathname": "text/html,<h1>Hello</h1>" }, "ok": true }, { "tool": "parse", "input": { "url": "not-a-url" }, "error": "url tool failed: Invalid URL", "ok": false, "expected_error": true }, { "tool": "build", "input": { "protocol": "https", "hostname": "app.example.com", "port": 9090, "pathname": "/search", "query": { "q": "mcp servers", "page": 1, "active": true }, "hash": "results", "username": "admin", "password": "secret" }, "output": { "url": "https://admin:[email protected]:9090/search?q=mcp+servers&page=1&active=true#results" }, "ok": true }, { "tool": "build", "input": { "protocol": "https", "hostname": "api.example.com", "pathname": "/items", "query": { "tags": ["mcp", "tool", "server"], "limit": 50 } }, "output": { "url": "https://api.example.com/items?tags=mcp&tags=tool&tags=server&limit=50" }, "ok": true }, { "tool": "build", "input": { "protocol": "http", "hostname": "localhost" }, "output": { "url": "http://localhost/" }, "ok": true } ], "total_calls": 15, "success": 14, "expected_errors": 1 }