@plutojl/mcp 0.2.0 → 0.3.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.
Files changed (2) hide show
  1. package/dist/cli.cjs +40 -0
  2. package/package.json +1 -1
package/dist/cli.cjs CHANGED
@@ -63944,6 +63944,44 @@ async function callTool(port, toolName, argsJson, raw2) {
63944
63944
  }
63945
63945
  }
63946
63946
 
63947
+ // ../../src/cli/preflight.ts
63948
+ async function preflight(port, opts = {}) {
63949
+ const mcpUrl = `http://localhost:${port}`;
63950
+ let health;
63951
+ try {
63952
+ const res = await fetch(`${mcpUrl}/health`, {
63953
+ signal: AbortSignal.timeout(3e3)
63954
+ });
63955
+ health = await res.json();
63956
+ } catch {
63957
+ console.error(`Error: Cannot reach MCP server at ${mcpUrl}`);
63958
+ console.error(``);
63959
+ console.error(`The MCP server is not running. Start it first:`);
63960
+ console.error(``);
63961
+ console.error(` npx @plutojl/mcp run`);
63962
+ console.error(``);
63963
+ console.error(
63964
+ `Or, if you are using a different port, pass --mcp-port <port>.`
63965
+ );
63966
+ process.exit(1);
63967
+ }
63968
+ if (opts.requirePluto && !health.plutoServerRunning) {
63969
+ console.error(`Error: MCP server is running but Pluto is not connected.`);
63970
+ console.error(``);
63971
+ console.error(`Start Pluto via the MCP server:`);
63972
+ console.error(``);
63973
+ console.error(` npx @plutojl/mcp call start_pluto_server`);
63974
+ console.error(``);
63975
+ console.error(`Or connect to an existing Pluto server:`);
63976
+ console.error(``);
63977
+ console.error(
63978
+ ` npx @plutojl/mcp call connect_to_pluto_server '{"port": 1234}'`
63979
+ );
63980
+ process.exit(1);
63981
+ }
63982
+ return { mcpRunning: true, plutoRunning: health.plutoServerRunning };
63983
+ }
63984
+
63947
63985
  // ../../src/cli/index.ts
63948
63986
  async function main() {
63949
63987
  const args = parseArgs(process.argv.slice(2));
@@ -63960,6 +63998,7 @@ async function main() {
63960
63998
  break;
63961
63999
  }
63962
64000
  case "tools": {
64001
+ await preflight(mcpPort);
63963
64002
  await listTools(mcpPort);
63964
64003
  break;
63965
64004
  }
@@ -63968,6 +64007,7 @@ async function main() {
63968
64007
  console.error("Usage: npx @plutojl/mcp call <tool_name> [json_args]");
63969
64008
  process.exit(1);
63970
64009
  }
64010
+ await preflight(mcpPort);
63971
64011
  await callTool(
63972
64012
  mcpPort,
63973
64013
  args.toolName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plutojl/mcp",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Standalone MCP server for Pluto.jl notebooks — run with npx @plutojl/mcp",
5
5
  "license": "MIT",
6
6
  "repository": {