Files
reverse-engineering-anything/scripts/verify/clients/environment-probe.mjs
morluto 8e18bdecef test(clients): check configured MCP catalogs in native harnesses (#15121)
* test(clients): check configured MCP catalogs in native harnesses

* test(opencode): resolve the native CLI in the isolated home

* ci(clients): identify native catalog discovery in the job log

* test(ci): isolate native clients and preserve registration failures
2026-11-29 18:03:55 +00:00

26 lines
941 B
JavaScript

import { writeFileSync } from "node:fs";
import { McpServer } from "@modelcontextprotocol/server";
import { StdioServerTransport } from "@modelcontextprotocol/server/stdio";
// Used in a disposable native client project. Record only this known selector.
const selection = process.env.REA_MCP_TOOL_FAMILIES;
const state =
selection === undefined
? "absent"
: selection === "electron,javascript-runtime"
? "selected"
: "unexpected";
const tool = `probe_environment_${state}`;
const receipt = process.argv[2];
const server = new McpServer({ name: "rea-environment-probe", version: "1" });
server.registerTool(
tool,
{ description: "Read the configuration test result." },
() => ({ content: [{ type: "text", text: state }] }),
);
server.server.oninitialized = () => {
if (receipt)
writeFileSync(receipt, JSON.stringify({ initialized: true, tool }) + "\n");
};
await server.connect(new StdioServerTransport());