mcp-api-router 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/bin/server.js +8 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,6 +9,10 @@ MCP server that helps AI agents pick an API provider (LLM inference, scraping, p
|
|
|
9
9
|
- json_repair: fix broken or LLM-produced JSON and optionally validate it against a JSON Schema subset
|
|
10
10
|
- page_to_markdown: clean markdown from a public web page (30 requests per IP per day)
|
|
11
11
|
- check_quote: check whether a quote appears in a given text or URL (exact, near, partial or not_found; wording only, not truth)
|
|
12
|
+
- check_email: syntax, domain and mail server (MX) check for an email address (does not prove the mailbox exists)
|
|
13
|
+
- convert_time: convert a date and time between IANA time zones
|
|
14
|
+
- convert_units: convert length, mass, volume, area, speed, data, time and temperature units
|
|
15
|
+
- convert_currency: central bank reference rates via frankfurter.dev, information only
|
|
12
16
|
- check_url: check whether a public URL resolves (status, redirects, content type, title; shares the 30 per day limit)
|
|
13
17
|
|
|
14
18
|
## Use
|
package/bin/server.js
CHANGED
|
@@ -8,13 +8,18 @@ const tools = [
|
|
|
8
8
|
{name:"json_repair",description:"Repair broken or LLM-produced JSON (code fences, comments, trailing commas, single quotes, bare keys, truncation) and optionally validate against a JSON Schema subset. Free, deterministic.",inputSchema:{type:"object",properties:{text:{type:"string"},schema:{type:"object"}},required:["text"]}},
|
|
9
9
|
{name:"page_to_markdown",description:"Fetch a public web page and return clean markdown. Free, limited to 30 requests per IP per day.",inputSchema:{type:"object",properties:{url:{type:"string"}},required:["url"]}},
|
|
10
10
|
{name:"check_quote",description:"Check whether a quote appears in a source text or a URL. Returns verdict exact|near|partial|not_found plus numbers in the quote missing from the best match. Matches wording only, not truth. Free, deterministic.",inputSchema:{type:"object",properties:{quote:{type:"string"},text:{type:"string"},url:{type:"string"}},required:["quote"]}},
|
|
11
|
-
{name:"check_url",description:"Check whether a public URL resolves: final status, redirect chain, content type and title. Free, 30 requests per IP per day (shared with page_to_markdown).",inputSchema:{type:"object",properties:{url:{type:"string"}},required:["url"]}}
|
|
11
|
+
{name:"check_url",description:"Check whether a public URL resolves: final status, redirect chain, content type and title. Free, 30 requests per IP per day (shared with page_to_markdown).",inputSchema:{type:"object",properties:{url:{type:"string"}},required:["url"]}},
|
|
12
|
+
{name:"check_email",description:"Check an email address: syntax, domain DNS and mail server (MX). Does not contact the mailbox, so it cannot prove the address exists. Free, 30 requests per IP per day (shared).",inputSchema:{type:"object",properties:{"email":{"type":"string"}},required:["email"]}},
|
|
13
|
+
{name:"convert_time",description:"Convert a date and time between IANA time zones (for example Asia/Qatar to America/New_York), with offsets. Time is optional and defaults to now. Free, deterministic.",inputSchema:{type:"object",properties:{"time":{"type":"string"},"from":{"type":"string"},"to":{"type":"string"}},required:["to"]}},
|
|
14
|
+
{name:"convert_units",description:"Convert length, mass, volume, area, speed, data size, time and temperature units. Free, deterministic.",inputSchema:{type:"object",properties:{"value":{"type":"number"},"from":{"type":"string"},"to":{"type":"string"}},required:["value","from","to"]}},
|
|
15
|
+
{name:"convert_currency",description:"Convert an amount between currencies using central bank reference rates (frankfurter.dev). For information only, not a payment or trading rate. Free, 30 requests per IP per day (shared).",inputSchema:{type:"object",properties:{"amount":{"type":"number"},"from":{"type":"string"},"to":{"type":"string"}},required:["amount","from","to"]}}
|
|
12
16
|
];
|
|
13
|
-
const
|
|
17
|
+
const GETR={check_email:a=>`/v1/check-email?email=${encodeURIComponent(a.email)}`,convert_time:a=>`/v1/convert-time?time=${encodeURIComponent(a.time||"")}&from=${encodeURIComponent(a.from||"")}&to=${encodeURIComponent(a.to)}`,convert_units:a=>`/v1/convert-units?value=${encodeURIComponent(a.value)}&from=${encodeURIComponent(a.from)}&to=${encodeURIComponent(a.to)}`,convert_currency:a=>`/v1/convert-currency?amount=${encodeURIComponent(a.amount)}&from=${encodeURIComponent(a.from)}&to=${encodeURIComponent(a.to)}`};
|
|
18
|
+
const path = (n,a)=> GETR[n]?GETR[n](a):n==="best_route"?`/v1/best-route?task=${encodeURIComponent(a.task)}&budget=${a.budget||"low"}`: n==="catalog"?"/v1/catalog":n==="check_url"?`/v1/check-url?url=${encodeURIComponent(a.url)}`:n==="page_to_markdown"?`/v1/page-to-markdown?url=${encodeURIComponent(a.url)}&format=md`:`/v1/health-route?category=${encodeURIComponent(a.category)}`;
|
|
14
19
|
const send = (o)=>process.stdout.write(JSON.stringify(o)+"\n");
|
|
15
20
|
let buf="";
|
|
16
21
|
process.stdin.on("data",async d=>{buf+=d;let i;while((i=buf.indexOf("\n"))>=0){const l=buf.slice(0,i).trim();buf=buf.slice(i+1);if(!l)continue;let m;try{m=JSON.parse(l)}catch{continue}
|
|
17
|
-
if(m.method==="initialize")send({jsonrpc:"2.0",id:m.id,result:{protocolVersion:"2024-11-05",capabilities:{tools:{}},serverInfo:{name:"mcp-api-router",version:"0.2.
|
|
22
|
+
if(m.method==="initialize")send({jsonrpc:"2.0",id:m.id,result:{protocolVersion:"2024-11-05",capabilities:{tools:{}},serverInfo:{name:"mcp-api-router",version:"0.2.3"}}});
|
|
18
23
|
else if(m.method==="tools/list")send({jsonrpc:"2.0",id:m.id,result:{tools}});
|
|
19
24
|
else if(m.method==="tools/call"){try{const a=m.params.arguments||{};const r=m.params.name==="check_quote"?await fetch(BASE+"/v1/check-quote",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({quote:a.quote,...(a.text?{text:a.text}:{}),...(a.url?{url:a.url}:{})})}):m.params.name==="json_repair"?await fetch(BASE+"/v1/json-repair",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:a.text,...(a.schema?{schema:a.schema}:{})})}):await fetch(BASE+path(m.params.name,a));send({jsonrpc:"2.0",id:m.id,result:{content:[{type:"text",text:await r.text()}]}})}catch(e){send({jsonrpc:"2.0",id:m.id,result:{isError:true,content:[{type:"text",text:String(e)}]}})}}
|
|
20
25
|
else if(m.id!==undefined)send({jsonrpc:"2.0",id:m.id,error:{code:-32601,message:"unknown method"}});}});
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name": "mcp-api-router", "version": "0.2.
|
|
1
|
+
{"name": "mcp-api-router", "version": "0.2.3", "mcpName": "io.github.instinctagentai/mcp-api-router", "description": "MCP server: compare AI/developer API pricing, health and free-credit signup links; plus free JSON repair and page-to-markdown tools", "bin": {"mcp-api-router": "bin/server.js"}, "type": "module", "license": "MIT", "keywords": ["mcp", "model-context-protocol", "api", "llm", "scraping", "json-repair", "markdown"], "repository": {"type": "git", "url": "git+https://github.com/instinctagentai/api-router.git", "directory": "mcp"}, "homepage": "https://github.com/instinctagentai/api-router", "files": ["bin"]}
|