@mrfentmen/nintendo-eshop-mcp 0.0.0-stage → 1.0.0
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 +21 -2
- package/dist/api.d.ts +3 -0
- package/dist/api.js +48 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +13 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.js +17 -0
- package/package.json +39 -4
- package/server.json +20 -0
package/README.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
-
#
|
|
1
|
+
# nintendo-eshop-mcp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
MCP server for Nintendo eShop prices. Keyless, ungated: it reads the public api.ec.nintendo.com price endpoint.
|
|
4
|
+
|
|
5
|
+
## Tools
|
|
6
|
+
|
|
7
|
+
| Tool | What it returns |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| `get_eshop_price` | Sale status, regular price and discount for one or more title ids |
|
|
10
|
+
|
|
11
|
+
## Run
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx -y @mrfentmen/nintendo-eshop-mcp
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Build and test
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install
|
|
21
|
+
npm test
|
|
22
|
+
```
|
package/dist/api.d.ts
ADDED
package/dist/api.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const API = "https://api.ec.nintendo.com/v1";
|
|
2
|
+
export class EshopError extends Error {
|
|
3
|
+
}
|
|
4
|
+
async function get(url) {
|
|
5
|
+
try {
|
|
6
|
+
const response = await fetch(url, { signal: AbortSignal.timeout(20000) });
|
|
7
|
+
if (!response.ok)
|
|
8
|
+
throw new EshopError(`Nintendo eShop API answered ${response.status}`);
|
|
9
|
+
return (await response.json());
|
|
10
|
+
}
|
|
11
|
+
catch (error) {
|
|
12
|
+
if (error instanceof EshopError)
|
|
13
|
+
throw error;
|
|
14
|
+
throw new EshopError(`Nintendo eShop API unreachable: ${error instanceof Error ? error.message : String(error)}`);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function money(value) {
|
|
18
|
+
if (!value?.amount)
|
|
19
|
+
return "unknown price";
|
|
20
|
+
const cents = Number(value.amount);
|
|
21
|
+
if (!Number.isFinite(cents))
|
|
22
|
+
return `${value.amount} ${value.currency ?? ""}`.trim();
|
|
23
|
+
return `${(cents / 100).toFixed(2)} ${value.currency ?? ""}`.trim();
|
|
24
|
+
}
|
|
25
|
+
export async function prices(ids) {
|
|
26
|
+
const clean = ids
|
|
27
|
+
.split(",")
|
|
28
|
+
.map((item) => item.trim())
|
|
29
|
+
.filter((item) => /^\d+$/.test(item));
|
|
30
|
+
if (clean.length === 0)
|
|
31
|
+
throw new EshopError("Give at least one numeric eShop title id");
|
|
32
|
+
const json = await get(`${API}/price?country=US&lang=en&ids=${clean.join(",")}`);
|
|
33
|
+
const list = json.prices ?? [];
|
|
34
|
+
if (list.length === 0)
|
|
35
|
+
throw new EshopError("Nintendo eShop returned no prices for those ids");
|
|
36
|
+
const rows = list.map((item, index) => {
|
|
37
|
+
const sale = item.sales_status && item.sales_status !== "not_found" ? item.sales_status : "status unknown";
|
|
38
|
+
const discount = item.discount_price?.amount ? `, now ${money(item.discount_price)}` : "";
|
|
39
|
+
return `${index + 1}. ${item.title_id ?? "unknown"} — ${sale} · ${money(item.regular_price)}${discount}`;
|
|
40
|
+
});
|
|
41
|
+
return [
|
|
42
|
+
`# Nintendo eShop prices (US)`,
|
|
43
|
+
"",
|
|
44
|
+
`- Currency: ${list[0]?.regular_price?.currency ?? "USD"}`,
|
|
45
|
+
"",
|
|
46
|
+
...rows,
|
|
47
|
+
].join("\n");
|
|
48
|
+
}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
|
+
import { createServer } from "./server.js";
|
|
4
|
+
async function main() {
|
|
5
|
+
const server = createServer();
|
|
6
|
+
const transport = new StdioServerTransport();
|
|
7
|
+
await server.connect(transport);
|
|
8
|
+
console.error("nintendo-eshop-mcp running on stdio");
|
|
9
|
+
}
|
|
10
|
+
main().catch((error) => {
|
|
11
|
+
console.error("Fatal error:", error);
|
|
12
|
+
process.exit(1);
|
|
13
|
+
});
|
package/dist/server.d.ts
ADDED
package/dist/server.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { prices } from "./api.js";
|
|
4
|
+
const text = (value) => ({ content: [{ type: "text", text: value }] });
|
|
5
|
+
const failed = (error) => text(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
6
|
+
export function createServer() {
|
|
7
|
+
const server = new McpServer({ name: "nintendo-eshop-mcp", version: "1.0.0" });
|
|
8
|
+
server.tool("get_eshop_price", "Nintendo eShop US prices: status, regular price and discount.", { ids: z.string().describe("One or more eShop title ids, comma separated, like 70010000000025") }, async ({ ids }) => {
|
|
9
|
+
try {
|
|
10
|
+
return text(await prices(ids));
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
return failed(error);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
return server;
|
|
17
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrfentmen/nintendo-eshop-mcp",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Nintendo eShop MCP: US prices and discounts. Keyless and ungated.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"mcpName": "io.github.mrfentmen/nintendo-eshop-mcp",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/mrfentmen/awesome-servers.git"
|
|
10
|
+
},
|
|
11
|
+
"bin": {
|
|
12
|
+
"nintendo-eshop-mcp": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"main": "./dist/index.js",
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"server.json",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsc -p tsconfig.json",
|
|
22
|
+
"start": "node dist/index.js",
|
|
23
|
+
"test": "npm run build && node --test tests/tools.test.mjs"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"mcp",
|
|
27
|
+
"nintendo",
|
|
28
|
+
"eshop",
|
|
29
|
+
"switch",
|
|
30
|
+
"prices"
|
|
31
|
+
],
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@modelcontextprotocol/sdk": "^1.0.4",
|
|
35
|
+
"zod": "^3.23.8"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/node": "^22.0.0",
|
|
39
|
+
"typescript": "^5.6.0"
|
|
40
|
+
}
|
|
41
|
+
}
|
package/server.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
|
+
"name": "io.github.mrfentmen/nintendo-eshop-mcp",
|
|
4
|
+
"description": "Nintendo eShop MCP: US prices and discounts. Keyless and ungated.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"url": "https://github.com/mrfentmen/awesome-servers",
|
|
7
|
+
"source": "github"
|
|
8
|
+
},
|
|
9
|
+
"version": "1.0.0",
|
|
10
|
+
"packages": [
|
|
11
|
+
{
|
|
12
|
+
"registryType": "npm",
|
|
13
|
+
"identifier": "@mrfentmen/nintendo-eshop-mcp",
|
|
14
|
+
"version": "1.0.0",
|
|
15
|
+
"transport": {
|
|
16
|
+
"type": "stdio"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|