opentestmcp 0.3.2 → 0.3.4

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/server.js +35 -2
  2. package/package.json +1 -1
package/dist/server.js CHANGED
@@ -857,13 +857,36 @@ export function createServer() {
857
857
  });
858
858
  }
859
859
  });
860
- server.tool("mcp_preview", "Pick endpoints matching an intent and generate a tool-schema preview. Also writes the same two-pane HTML to opentest-mcp/mcp-preview-last.html and returns preview_file_url use Cursor Simple Browser or `node opentest-mcp/scripts/open-cursor-preview.mjs` if the inline MCP app panel does not appear. LLM selection when OPENAI_API_KEY is set on the backend; else keyword match. Does NOT write to the DB.", {
860
+ server.tool("share_endpoints_with_ui", "Push discovered or verified endpoints into the OpenTest Flow Playground so the user can see them, test them, and convert selected endpoints into hosted MCP tools. Use this after verify_endpoints_live or when the user explicitly asks to stream endpoints to the UI.", {
861
+ endpoints: z.array(z.any()).describe("Endpoints to push. Each item should include method plus path/path_template/url; include schemas when available."),
862
+ upstream_base_url: z.string().optional().describe("Default upstream base URL for testing and MCP generation, e.g. http://127.0.0.1:8000 or https://api.example.com"),
863
+ intent: z.string().optional().describe("Short label for the session, e.g. 'Login endpoint' or 'Auth endpoints'"),
864
+ session_id: z.string().optional().describe("Optional existing session id to append/replace. Omit to create a new session."),
865
+ }, async (args) => {
866
+ try {
867
+ const result = await callBackend("share_endpoints_with_ui", args);
868
+ return { content: [{ type: "text", text: JSON.stringify(result) }] };
869
+ }
870
+ catch (e) {
871
+ return toolError(e.message, inferErrorCode(e.message), {
872
+ next_actions: [
873
+ "Make sure OPENTEST_API_KEY is set or run opentest_login, then retry.",
874
+ "If the Flow UI opens but is empty, confirm OPENTEST_BACKEND points to the same backend that received this push.",
875
+ ],
876
+ related_tools: ["verify_endpoints_live", "mcp_preview", "opentest_status"],
877
+ });
878
+ }
879
+ });
880
+ server.tool("mcp_preview", "Pick endpoints matching an intent, generate a tool-schema preview, and automatically share the selected endpoints into the OpenTest Flow Playground session so the user can see/test/deploy them in the UI. Also writes the same two-pane HTML to opentest-mcp/mcp-preview-last.html and returns preview_file_url — use Cursor Simple Browser or `node opentest-mcp/scripts/open-cursor-preview.mjs` if the inline MCP app panel does not appear. LLM selection when OPENAI_API_KEY is set on the backend; else keyword match.", {
861
881
  intent: z.string().describe("Free text like 'auth endpoints' or 'everything related to orders'"),
862
882
  endpoints: z.array(z.any()).describe("Candidate endpoints (typically the confirmed bucket from verify_endpoints_live)"),
863
883
  upstream_base_url: z.string().describe("Base URL the deployed MCP will proxy to"),
864
884
  }, async (args) => {
865
885
  try {
866
- const result = await callBackend("mcp_preview", args);
886
+ const result = await callBackend("mcp_preview", {
887
+ ...args,
888
+ session_id: AGENT_SESSION_ID,
889
+ });
867
890
  const previewData = (result && typeof result === "object" && !Array.isArray(result))
868
891
  ? result
869
892
  : {};
@@ -872,11 +895,21 @@ export function createServer() {
872
895
  const basePayload = result && typeof result === "object" && !Array.isArray(result)
873
896
  ? result
874
897
  : { raw: result };
898
+ const uiPayload = basePayload.ui && typeof basePayload.ui === "object" && !Array.isArray(basePayload.ui)
899
+ ? basePayload.ui
900
+ : {};
875
901
  const withPreviewNav = {
876
902
  ...basePayload,
877
903
  preview_html_path: absolutePath,
878
904
  preview_file_url: fileUrl,
905
+ _agent_session: {
906
+ session_id: typeof basePayload.session_id === "string" ? basePayload.session_id : AGENT_SESSION_ID,
907
+ dashboard_url: typeof uiPayload.url === "string"
908
+ ? uiPayload.url
909
+ : buildAgentDashboardUrl("/endpoints"),
910
+ },
879
911
  _how_to_see_the_ui: [
912
+ "The selected endpoints were automatically shared into the Flow Playground session. Open ui.url or _agent_session.dashboard_url to see them.",
880
913
  "Cursor may not show the embedded MCP app (no new tab is opened by default).",
881
914
  "Run `node opentest-mcp/scripts/open-cursor-preview.mjs` from the repo root; it copies the http:// URL to the clipboard (macOS) and tries cursor:// + vscode:// Simple Browser handlers.",
882
915
  "If no tab appears: Cmd+Shift+P → “Simple Browser: Show” → paste the http://127.0.0.1:… URL from the script output. In the integrated terminal, Cmd+Click that URL may open the in-editor browser.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opentestmcp",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "Turn APIs into agent-callable MCP tools with auth, testing, and audit logs",
5
5
  "type": "module",
6
6
  "bin": {