From 8641ce50a329d1349feaad9565c5608b8f84ecc5 Mon Sep 17 00:00:00 2001 From: Hamja Shaikh <148641870+Imhamza86@users.noreply.github.com> Date: Fri, 4 Dec 2026 19:18:05 +0530 Subject: [PATCH 1/4] feat(cli): add mcp subcommand --- site/cli/fgda.mjs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/site/cli/fgda.mjs b/site/cli/fgda.mjs index de751d12..003c587b 100644 --- a/site/cli/fgda.mjs +++ b/site/cli/fgda.mjs @@ -15,17 +15,19 @@ import { fileURLToPath } from "node:url"; import { parseArgs } from "node:util"; import { checkLicense, getAsset, listStacks, searchAssets } from "../lib/catalog-query.mjs"; import { loadData } from "./data.mjs"; +import { main as runMcp } from "./mcp.mjs"; const USAGE = `usage: fgda search [words] [--license L] [--category C] [--commercial] [--no-attribution] [--engine E] [--format F] [--limit N] fgda get fgda check [--engine E] [--non-commercial] fgda stacks + fgda mcp [--data ] options: --data --json`; const line = (a) => `${a.id} ${a.name}\n ${a.license}${a.commercial === true ? ", commercial OK" : a.commercial === "varies" ? ", per-file" : a.commercial === false ? ", NOT commercial" : ", commercial ?"}${a.attribution_required === true ? ", credit required" : a.attribution_required === false ? ", no credit" : ""}${a.engine_lock ? `, ${a.engine_lock} only` : ""}; ${a.status}; read ${a.verified || "never"}\n ${a.page}`; -export async function main(argv = process.argv.slice(2), out = (s) => process.stdout.write(`${s}\n`)) { +export async function main(argv = process.argv.slice(2), out = (s) => process.stdout.write(`${s}\n`), runMcpServer = runMcp) { const { values: o, positionals } = parseArgs({ args: argv, allowPositionals: true, @@ -49,6 +51,7 @@ export async function main(argv = process.argv.slice(2), out = (s) => process.st out(USAGE); return o.help ? 0 : 2; } + if (cmd === "mcp") return runMcpServer(o.data ? ["--data", o.data] : []); const data = await loadData(o.data); const print = (value, text) => out(o.json ? JSON.stringify(value, null, 2) : text); if (cmd === "search") { @@ -80,7 +83,7 @@ export async function main(argv = process.argv.slice(2), out = (s) => process.st } if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) { - main().then((code) => process.exit(code), (err) => { + main().then((code) => { if (code !== undefined) process.exit(code); }, (err) => { console.error(err.message); process.exit(2); }); From bad8902b0f9731c9a64b569b5592bc0ff0839e9a Mon Sep 17 00:00:00 2001 From: Hamja Shaikh <148641870+Imhamza86@users.noreply.github.com> Date: Fri, 4 Dec 2026 19:18:18 +0530 Subject: [PATCH 2/4] feat(mcp): export server entry point --- site/cli/mcp.mjs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/site/cli/mcp.mjs b/site/cli/mcp.mjs index 2c2aa9d8..f859e24c 100644 --- a/site/cli/mcp.mjs +++ b/site/cli/mcp.mjs @@ -4,8 +4,9 @@ * no dependencies: newline-delimited JSON-RPC 2.0, the tools capability * only. Tools: search_assets, get_asset, check_license, list_stacks. * node site/cli/mcp.mjs [--data ] + * Or through the CLI: fgda mcp [--data ] * Client config (Claude Desktop, Cursor and others): - * { "command": "node", "args": ["/path/to/Free-Game-Dev-Assets/site/cli/mcp.mjs"] } + * { "command": "npx", "args": ["-y", "github:TMHSDigital/Free-Game-Dev-Assets", "mcp"] } */ import path from "node:path"; import readline from "node:readline"; @@ -85,9 +86,9 @@ export function handle(msg, data) { } } -async function main() { - const i = process.argv.indexOf("--data"); - const data = await loadData(i === -1 ? undefined : process.argv[i + 1]); +export async function main(argv = process.argv.slice(2)) { + const i = argv.indexOf("--data"); + const data = await loadData(i === -1 ? undefined : argv[i + 1]); const rl = readline.createInterface({ input: process.stdin }); rl.on("line", (raw) => { if (!raw.trim()) return; From c8f1a3ba30818349f429849fa0e6fc674b214599 Mon Sep 17 00:00:00 2001 From: Hamja Shaikh <148641870+Imhamza86@users.noreply.github.com> Date: Fri, 4 Dec 2026 19:18:31 +0530 Subject: [PATCH 3/4] docs: add npx MCP client setup --- docs/data.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/data.md b/docs/data.md index f5f0c41c..7c9bc6b7 100644 --- a/docs/data.md +++ b/docs/data.md @@ -102,12 +102,14 @@ still `needs-review` (with its open question), so a build can stop on it. In a c does the same and reads `site/dist/data.json` when a build is there; `--data ` picks another copy. `site/cli/mcp.mjs` is a Model Context Protocol server (stdio, no dependencies) with the tools `search_assets`, -`get_asset`, `check_license` and `list_stacks`. In Claude Desktop, Cursor or another MCP client, from a clone: +`get_asset`, `check_license` and `list_stacks`. Start it without cloning the repository by using this client configuration in Claude Desktop, Cursor or another MCP client: ```json -{ "mcpServers": { "free-game-dev-assets": { "command": "node", "args": ["/path/to/Free-Game-Dev-Assets/site/cli/mcp.mjs"] } } } +{ "mcpServers": { "free-game-dev-assets": { "command": "npx", "args": ["-y", "github:TMHSDigital/Free-Game-Dev-Assets", "mcp"] } } } ``` +This runs the `mcp` subcommand exposed by the existing `fgda` CLI. To use a local file or another data URL, append `--data` and its value after `mcp` in the arguments. + ## How to cite The repository has a [`CITATION.cff`](../CITATION.cff), and GitHub's "Cite this repository" button renders it. In text: From 6d21e20d95ff5620b003707219c09e162b511e70 Mon Sep 17 00:00:00 2001 From: Hamja Shaikh <148641870+Imhamza86@users.noreply.github.com> Date: Fri, 4 Dec 2026 19:18:45 +0530 Subject: [PATCH 4/4] test(mcp): cover npx command dispatch --- site/lib/lib.test.mjs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/site/lib/lib.test.mjs b/site/lib/lib.test.mjs index a43455b4..599dc8dc 100644 --- a/site/lib/lib.test.mjs +++ b/site/lib/lib.test.mjs @@ -2908,6 +2908,11 @@ await section("catalog queries, CLI and MCP (#115)", async () => { const json = []; eq("cli: search exits 0", await main(["search", "pixel", "--license", "cc-by", "--json", "--data", file], (s) => json.push(s)), 0); eq("cli: --json is parseable", JSON.parse(json.join("\n"))[0].id, "b"); + const { main: mcpMain } = await import("../cli/mcp.mjs"); + eq("mcp: server entry point is importable", typeof mcpMain, "function"); + let mcpArgs; + eq("cli: mcp subcommand starts the server", await main(["mcp", "--data", file], () => {}, async (args) => { mcpArgs = args; return 0; }), 0); + eq("cli: mcp forwards the data option", mcpArgs.join(" "), `--data ${file}`); } finally { fsm.rmSync(file, { force: true }); }