@shiplightai/mcp 0.1.49 → 0.1.50
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/dist/{agentHelpers-242MN5TR-AK52N3RJ.js → agentHelpers-ZEELTQHQ-7LTM7RPI.js} +1 -1
- package/dist/agentLogin-JJ76YIVR-ODLFUWNL.js +4 -0
- package/dist/{chunk-JT3U4KNR.js → chunk-2BZVD336.js} +1 -1
- package/dist/{chunk-HQNPMIQW.js → chunk-4DIUHKFB.js} +2 -2
- package/dist/{chunk-ORSFJVJL.js → chunk-5GG34OWS.js} +3 -3
- package/dist/chunk-HBXQFJ2K.js +4 -0
- package/dist/{chunk-GZSLCYQ7.js → chunk-KI54PAOH.js} +28 -28
- package/dist/chunk-OZ36UVHR.js +3999 -0
- package/dist/{chunk-Z3E7FIDS.js → chunk-UBUBM7F7.js} +1 -1
- package/dist/{chunk-AFEFEPKR.js → chunk-VBI4DDSS.js} +1 -1
- package/dist/{chunk-PFLXO7G4.js → chunk-X5NUVPAF.js} +1 -1
- package/dist/{chunk-KW4N7WFX.js → chunk-XWDTDVL5.js} +4 -4
- package/dist/{chunk-RSM4LZ5P.js → chunk-Y64TKFRF.js} +3203 -3203
- package/dist/dist-FVIJHOEK.js +4 -0
- package/dist/dist-T3EAKPBA.js +4 -0
- package/dist/{handler-2DVP4PMD-IFR4HH7D.js → handler-QSEXJ3YG-BK26HZ5S.js} +1 -1
- package/dist/index.js +2 -2
- package/dist/relayBrowserCache-QL6LD4JJ-RCZSXWM6.js +4 -0
- package/dist/server-SF3CTCCU.js +22 -0
- package/dist/{task-2JIXKMIY-CMX3BD6Z.js → task-5N7K2U7O-UX3BL63L.js} +1 -1
- package/package.json +1 -1
- package/dist/agentLogin-VLDCPI66-52P67BMY.js +0 -4
- package/dist/chunk-34YV5HSR.js +0 -3999
- package/dist/chunk-JKHKVGEC.js +0 -4
- package/dist/dist-VVPHZ43R.js +0 -4
- package/dist/dist-YNN5UBVC.js +0 -4
- package/dist/relayBrowserCache-QL6LD4JJ-TKU47MOI.js +0 -4
- package/dist/server-KGF6BY7H.js +0 -22
package/dist/chunk-JKHKVGEC.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __createRequire } from "module";
|
|
3
|
-
const require = __createRequire(import.meta.url);
|
|
4
|
-
import{createRequire as g}from"module";var R=g(import.meta.url),f=class{constructor(){this.config=this.getDefaultConfig()}getDefaultConfig(){return{logLevel:1,debugAgent:!1,testResultsJsonPath:void 0,consoleLogsPath:void 0}}getConfig(){return{...this.config}}updateConfig(e){this.config={...this.config,...e}}resetConfig(){this.config=this.getDefaultConfig()}get(e){return this.config[e]}set(e,t){this.config[e]=t}},l=new f,s=l;function y(e){l.updateConfig(e)}function L(){return l.getConfig()}var c=class{getLevel(){return s.get("logLevel")}isStderrOnly(){return s.get("stderrOnly")===!0}debug(...e){this.getLevel()<=0&&(this.isStderrOnly()?console.error("[DEBUG]",...e):console.log("[DEBUG]",...e))}info(...e){this.getLevel()<=1&&(this.isStderrOnly()?console.error("[INFO]",...e):console.log("[INFO]",...e))}log(...e){this.info(...e)}warn(...e){this.getLevel()<=2&&console.warn("[WARN]",...e)}error(...e){this.getLevel()<=3&&console.error("[ERROR]",...e)}setLevel(e){s.set("logLevel",e)}},u=new c,N=u,n=Object.defineProperty,h=Object.getOwnPropertyDescriptor,v=Object.getOwnPropertyNames,O=Object.prototype.hasOwnProperty,d=(e,t,o)=>t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,m=(e,t)=>()=>(e&&(t=e(e=0)),t),C=(e,t)=>{for(var o in t)n(e,o,{get:t[o],enumerable:!0})},i=(e,t,o,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of v(t))!O.call(e,r)&&r!==o&&n(e,r,{get:()=>t[r],enumerable:!(a=h(t,r))||a.enumerable});return e},D=(e,t,o)=>(i(e,t,"default"),o&&i(o,t,"default")),E=e=>i(n({},"__esModule",{value:!0}),e),w=(e,t,o)=>d(e,typeof t!="symbol"?t+"":t,o),p=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e[e.SILENT=4]="SILENT",e))(p||{});export{y as a,L as b,N as c,m as d,C as e,D as f,E as g,w as h,p as i};
|
package/dist/dist-VVPHZ43R.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __createRequire } from "module";
|
|
3
|
-
const require = __createRequire(import.meta.url);
|
|
4
|
-
import{$,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,_,a as b,b as c,c as d,d as e,e as f,f as g,g as h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-RSM4LZ5P.js";import"./chunk-7W6YLS2E.js";import"./chunk-AFEFEPKR.js";import{r as a}from"./chunk-GZSLCYQ7.js";import"./chunk-HQNPMIQW.js";import"./chunk-JT3U4KNR.js";import"./chunk-HHCLRZRA.js";import"./chunk-67R4GP2H.js";import"./chunk-ORSFJVJL.js";import"./chunk-34YV5HSR.js";import"./chunk-Z3E7FIDS.js";import"./chunk-B7PRQ6ZM.js";import"./chunk-KW4N7WFX.js";import"./chunk-PFLXO7G4.js";import"./chunk-JKHKVGEC.js";import"./chunk-ETDHHU35.js";import"./chunk-LM633YUO.js";export{p as ACT_SUPPORTED_ACTIONS,f as ActionEntitySchema,P as BrowserTools,R as DataTools,Q as DebugTools,k as ExtensionRelayServer,U as LocalTestTools,m as PROMPTS,V as RESOURCES,r as RelayTools,i as SessionManager,q as SessionTools,g as StatementSchema,S as TestCaseTools,h as TestFlowSchema,$ as TestFlowTools,T as TestResultTools,j as TokenApiClient,l as ToolRegistry,a as WebAgent,x as actHandler,v as actSchema,D as clearExecutionHistoryHandler,B as clearExecutionHistorySchema,C as clearExecutionHistoryToolMeta,N as getActSchema,O as getActToolDefinition,w as getActToolMeta,Y as getActionEntitySchemaResource,M as getLocatorsHandler,K as getLocatorsSchema,L as getLocatorsToolMeta,G as getPageInfoHandler,E as getPageInfoSchema,F as getPageInfoToolMeta,n as getPrompt,_ as getResource,W as getTestFlowJsonSchemaResource,X as getTestFlowYamlSchemaResource,c as hasLlmKey,J as inspectPageHandler,H as inspectPageSchema,I as inspectPageToolMeta,b as isLlmAction,o as listPrompts,Z as listResources,e as missingApiTokenError,d as missingLlmKeyError,u as navigateHandler,s as navigateSchema,t as navigateToolMeta,A as updateVariablesHandler,y as updateVariablesSchema,z as updateVariablesToolMeta};
|
package/dist/dist-YNN5UBVC.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __createRequire } from "module";
|
|
3
|
-
const require = __createRequire(import.meta.url);
|
|
4
|
-
import{a as N,b as O,c as P,d as Q,e as R,f as S,g as T,h as U,i as V,j as W,k as X,l as Y,m as Z,n as _,o as $,p as aa,q as ba,r as ca,s as da,t as ea,u as fa}from"./chunk-GZSLCYQ7.js";import{i as k,j as l,k as m,l as n}from"./chunk-HQNPMIQW.js";import{a as e,c as f,d as g,e as h,f as i,g as j}from"./chunk-JT3U4KNR.js";import{b as I,e as J,f as K,g as L,h as M}from"./chunk-ORSFJVJL.js";import{a as o,b as p,c as q,d as r,e as s,f as t,g as u,h as v,i as w,j as x,k as y,l as z,m as A}from"./chunk-34YV5HSR.js";import"./chunk-Z3E7FIDS.js";import"./chunk-B7PRQ6ZM.js";import{C as G,E as H}from"./chunk-KW4N7WFX.js";import{g as B,h as C,i as D,k as E,l as F}from"./chunk-PFLXO7G4.js";import{a,b,c,i as d}from"./chunk-JKHKVGEC.js";import"./chunk-ETDHHU35.js";import"./chunk-LM633YUO.js";export{H as ActionHandler,G as ActionHelper,ca as Agent,$ as AgentServices,aa as AgentStepEventTypes,ba as AgentTaskFailedError,Z as BrowserManager,v as DEFAULT_EVENT_LISTENER_LIMIT,z as DomService,u as EVENT_LISTENER_CANDIDATE_SELECTORS,A as HistoryTreeProcessor,e as INIT_SCRIPT,t as INTERACTION_EVENT_TYPES,s as INTERACTIVE_ROLES,d as LogLevel,k as LoginType,X as MCPToolProvider,I as OpenAIToolProvider,fa as SDK_VERSION,o as ToolRegistry,l as TwoFactorAuthType,n as VariableStore,ca as WebAgent,a as configureSdk,ea as createAgent,da as createAgentContext,U as createToolRegistry,V as createToolRegistryWithCapabilities,S as ensureToolsRegistered,L as evaluateStatement,K as executeStep,Y as exportMCPTools,y as filterInteractionListeners,J as generateActionStep,F as getActionEntityLocatorInfo,g as getBrowserCdpUrl,W as getCapabilitySummary,E as getFramePath,q as getModel,i as getPageInfo,h as getPageWsUrl,_ as getPlatformFromDeviceName,r as getProviderOptions,b as getSdkConfig,T as getToolRegistry,N as injectUserFunction,x as isInteractionEventType,w as isInteractiveRole,Q as loadKnowledgeMappings,P as loadKnowledges,O as loadUserFunctions,c as logger,f as newBrowserContext,R as parseSSEStream,B as pickBestLocator,C as pickBestLocatorForElement,D as pickBestLocators,m as replaceVariables,M as runTask,j as setWindowBounds,p as toolRegistry};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __createRequire } from "module";
|
|
3
|
-
const require = __createRequire(import.meta.url);
|
|
4
|
-
import{a as e,b as o,c as t}from"./chunk-AFEFEPKR.js";import"./chunk-GZSLCYQ7.js";import"./chunk-HQNPMIQW.js";import"./chunk-JT3U4KNR.js";import"./chunk-ORSFJVJL.js";import"./chunk-34YV5HSR.js";import"./chunk-Z3E7FIDS.js";import"./chunk-B7PRQ6ZM.js";import"./chunk-KW4N7WFX.js";import"./chunk-PFLXO7G4.js";import"./chunk-JKHKVGEC.js";import"./chunk-ETDHHU35.js";import"./chunk-LM633YUO.js";export{e as connectBrowser,o as forceDisconnect,t as getCacheStatus};
|
package/dist/server-KGF6BY7H.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __createRequire } from "module";
|
|
3
|
-
const require = __createRequire(import.meta.url);
|
|
4
|
-
import{S as y,Z as C,_ as P,h as O,j as I,l as S,n as A,o as k}from"./chunk-RSM4LZ5P.js";import"./chunk-7W6YLS2E.js";import"./chunk-AFEFEPKR.js";import"./chunk-GZSLCYQ7.js";import"./chunk-HQNPMIQW.js";import"./chunk-JT3U4KNR.js";import"./chunk-HHCLRZRA.js";import"./chunk-67R4GP2H.js";import"./chunk-ORSFJVJL.js";import"./chunk-34YV5HSR.js";import"./chunk-Z3E7FIDS.js";import"./chunk-B7PRQ6ZM.js";import"./chunk-KW4N7WFX.js";import"./chunk-PFLXO7G4.js";import{a as f,c as T}from"./chunk-JKHKVGEC.js";import"./chunk-ETDHHU35.js";import"./chunk-LM633YUO.js";import{Server as oe}from"@modelcontextprotocol/sdk/server/index.js";import{StdioServerTransport as te}from"@modelcontextprotocol/sdk/server/stdio.js";import{CallToolRequestSchema as re,ListToolsRequestSchema as ne,ListResourcesRequestSchema as ie,ReadResourceRequestSchema as ae,ListPromptsRequestSchema as le,GetPromptRequestSchema as ce,ErrorCode as E,McpError as L}from"@modelcontextprotocol/sdk/types.js";import H from"axios";import pe from"dotenv";var V=new Set(["click","double_click","right_click","hover"]),q=new Set(["press","send_keys_on_element"]),F=`
|
|
5
|
-
@keyframes _sl_ripple {
|
|
6
|
-
0% { transform: translate(-50%,-50%) scale(1.0); opacity: 1; }
|
|
7
|
-
60% { transform: translate(-50%,-50%) scale(1.8); opacity: 0.9; }
|
|
8
|
-
100% { transform: translate(-50%,-50%) scale(4.0); opacity: 0; }
|
|
9
|
-
}
|
|
10
|
-
@keyframes _sl_dot {
|
|
11
|
-
0% { transform: translate(-50%,-50%) scale(1.0); opacity: 1; }
|
|
12
|
-
40% { transform: translate(-50%,-50%) scale(1.0); opacity: 1; }
|
|
13
|
-
100% { transform: translate(-50%,-50%) scale(0.0); opacity: 0; }
|
|
14
|
-
}
|
|
15
|
-
@keyframes _sl_key_pop {
|
|
16
|
-
0% { opacity: 0; transform: scale(0.6); }
|
|
17
|
-
15% { opacity: 1; transform: scale(1.15); }
|
|
18
|
-
25% { transform: scale(1.0); }
|
|
19
|
-
75% { opacity: 1; transform: scale(1.0); }
|
|
20
|
-
100% { opacity: 0; transform: scale(0.9); }
|
|
21
|
-
}
|
|
22
|
-
`;async function G(t,s,a,r,e){if(process.env.SHIPLIGHT_ACTION_INDICATORS){if(await t.evaluate(o=>{if(document.getElementById("_sl_styles"))return;let n=document.createElement("style");n.id="_sl_styles",n.textContent=o,document.head.appendChild(n)},F).catch(()=>{}),V.has(s)){let o=a.element_index;if(typeof o=="number"){let n=null;if(r){let i=r.selectorMap.get(o),l=i?.viewportCoordinates?.center;if(l)n=l;else if(i?.xpath)try{let c=i.xpath.startsWith("//")?i.xpath:`//${i.xpath}`,u=await t.locator(`xpath=${c}`).first().boundingBox({timeout:2e3});u&&(n={x:u.x+u.width/2,y:u.y+u.height/2})}catch{}}if(n){let{x:i,y:l}=n,c=s==="double_click";T.debug(`[indicator] ${s} at (${Math.round(i)}, ${Math.round(l)})`),await t.evaluate(({x:u,y:x,isDouble:D})=>{let m=window;m._sl_timers&&(m._sl_timers.forEach(p=>clearTimeout(p)),document.querySelectorAll("._sl_indicator").forEach(p=>p.remove())),m._sl_timers=[];function _(p){let h=document.createElement("div");h.className="_sl_indicator",h.style.cssText=["position:fixed",`left:${u}px`,`top:${x}px`,"width:80px","height:80px","border-radius:50%","background:rgba(255,30,30,0.25)","border:5px solid rgba(255,30,30,0.9)","pointer-events:none","z-index:2147483647",`animation:_sl_ripple 0.9s ${p}ms ease-out forwards`].join(";"),document.body.appendChild(h),m._sl_timers.push(setTimeout(()=>h.remove(),1e3+p))}function U(){let p=document.createElement("div");p.className="_sl_indicator",p.style.cssText=["position:fixed",`left:${u}px`,`top:${x}px`,"width:28px","height:28px","border-radius:50%","background:rgba(255,30,30,0.95)","pointer-events:none","z-index:2147483647","animation:_sl_dot 0.8s ease-in forwards"].join(";"),document.body.appendChild(p),m._sl_timers.push(setTimeout(()=>p.remove(),850))}_(0),_(200),U(),D&&(_(400),_(600))},{x:i,y:l,isDouble:c}),e&&await t.waitForTimeout(300)}else T.debug(`[indicator] ${s}: no coords for element_index ${o}`)}}else if(q.has(s)){let o=a.keys;typeof o=="string"&&(T.debug(`[indicator] ${s}: keys="${o}"`),await t.evaluate(({keysText:n})=>{let i=window;i._sl_timers&&(i._sl_timers.forEach(c=>clearTimeout(c)),document.querySelectorAll("._sl_indicator").forEach(c=>c.remove())),i._sl_timers=[];let l=document.createElement("div");l.className="_sl_indicator",l.style.cssText=["position:fixed","bottom:32px","left:0","right:0","width:fit-content","margin:0 auto","background:#1a1a1a","color:#fff","padding:14px 28px","border-radius:12px","font-size:28px","font-family:ui-monospace,monospace","font-weight:800","letter-spacing:0.04em","pointer-events:none","z-index:2147483647","border:3px solid rgba(255,255,255,0.25)","box-shadow:0 4px 32px rgba(0,0,0,0.5)","animation:_sl_key_pop 1.4s ease-out forwards"].join(";"),l.textContent="\u2328\uFE0F "+n,document.body.appendChild(l),i._sl_timers.push(setTimeout(()=>l.remove(),1500))},{keysText:o}),e&&await t.waitForTimeout(300))}}}var g=class t{static _instance;_logLevel;constructor(){switch(process.env.LOG_LEVEL?.toUpperCase()){case"ERROR":this._logLevel=1;break;case"WARN":this._logLevel=2;break;case"INFO":this._logLevel=3;break;case"DEBUG":this._logLevel=4;break;default:this._logLevel=3}}static getInstance(){return t._instance||(t._instance=new t),t._instance}setLevel(s){this._logLevel=s}debug(...s){this._logLevel>=4&&console.error("[DEBUG]",...s)}info(...s){this._logLevel>=3&&console.error("[INFO]",...s)}warn(...s){this._logLevel>=2&&console.error("[WARN]",...s)}error(...s){this._logLevel>=1&&console.error("[ERROR]",...s)}log(...s){this.info(...s)}},K=g.getInstance(),d=K;import{createHash as Y}from"node:crypto";import{hostname as W,userInfo as j,platform as M,arch as z}from"node:os";import{PostHog as J}from"posthog-node";var X="phc_5Va2dHamGwJWX9qZqyRka5Lann5ATsg3LL4uyU63qin",Z="https://us.i.posthog.com",Q=process.env.SHIPLIGHT_TELEMETRY==="0"||process.env.DO_NOT_TRACK==="1",v=null,N=!1;function ee(){return Q?null:(v||(v=new J(X,{host:Z,flushAt:1,flushInterval:3e4})),v)}function se(){let t=`${W()}:${j().username}:${M()}:${z()}`;return Y("sha256").update(t).digest("hex")}function B(t,s){let a=ee();if(a){N||(d.info("Anonymous usage telemetry enabled. Set SHIPLIGHT_TELEMETRY=0 to disable."),N=!0);try{a.capture({distinctId:se(),event:"mcp_new_session",properties:{product:"mcp-server",version:t,platform:M(),nodeVersion:process.version,cloudMode:s,$geoip_disable:!0,$ip:null}}),a.flush().catch(()=>{})}catch{}}}process.env.PWDEBUG="console";var b=(...t)=>console.error(...t);console.log=b;console.info=b;console.debug=b;process.on("uncaughtException",t=>{console.error("[MCP] Uncaught exception (non-fatal):",t)});process.on("unhandledRejection",t=>{console.error("[MCP] Unhandled rejection (non-fatal):",t)});pe.config({override:!1});async function w(){let{SessionTools:t,RelayTools:s,BrowserTools:a,DebugTools:r,LocalTestTools:e,SessionManager:o,ExtensionRelayServer:n}=await import("./dist-VVPHZ43R.js");return{SessionTools:t,RelayTools:s,BrowserTools:a,DebugTools:r,LocalTestTools:e,SessionManager:o,ExtensionRelayServer:n}}var ue="SHIPLIGHT_API_TOKEN";function $(){return process.env[ue]||null}var R=class{constructor(s=!1,a=null){this.debugMode=s;this.relayPort=a;f({stderrOnly:!0});let r=process.env.API_BASE_URL||"https://api.shiplight.ai";this.server=new oe({name:"shiplight-mcp",version:"1.0.0"},{capabilities:{tools:{},resources:{},prompts:{}}}),this.registry=new S;let e=$();if(this.apiClient=e?new I({apiBaseUrl:r,getApiToken:()=>$()}):null,this.apiClient){let o=new y(this.apiClient);this.testCaseTools=o,this.registry.registerTools(y,o,["getTestCase","getTemplate","getFunction","saveTestCase","saveTestAccount","saveTemplate","saveFunction"])}}server;registry;sessionBackend=null;apiClient;sessionTools=null;browserTools=null;debugTools=null;testCaseTools=null;localTestTools=null;relayTools=null;relayServer=null;async initBrowserTools(){let s=O(process.env),a=process.env.TERMINATION_TIMEOUT?parseInt(process.env.TERMINATION_TIMEOUT,10):null,r={};process.env.GOOGLE_API_KEY&&(r.GOOGLE_API_KEY=process.env.GOOGLE_API_KEY),process.env.ANTHROPIC_API_KEY&&(r.ANTHROPIC_API_KEY=process.env.ANTHROPIC_API_KEY),Object.keys(r).length>0&&f({env:r});let{SessionTools:e,BrowserTools:o,DebugTools:n,LocalTestTools:i,SessionManager:l}=await w();this.sessionBackend=new l({terminationTimeout:a,onBeforeAction:G}),this.sessionTools=new e(this.sessionBackend,this.apiClient,s),this.browserTools=new o(this.sessionBackend),this.debugTools=new n(this.sessionBackend),this.localTestTools=new i(this.sessionBackend);let{RelayTools:c}=await w();this.relayTools=new c(this.sessionBackend),this.registry.registerAll(e,this.sessionTools).registerAll(o,this.browserTools).registerAll(n,this.debugTools).registerAll(i,this.localTestTools).registerAll(c,this.relayTools)}async startRelayServer(){if(this.relayPort===null)return!1;let s=this.relayPort,{RelayTools:a,ExtensionRelayServer:r}=await w();if(this.relayServer=new r,!this.sessionBackend||!this.relayTools)return d.error("[MCP] Cannot start relay server: session backend not initialized"),!1;try{return await this.relayServer.start(s),d.info(`[MCP] Chrome Extension Relay ready on port ${s}`),this.relayTools.setRelayServer(this.relayServer),this.debugMode&&this.registry.registerAll({toolDefinitions:a.debugToolDefinitions},this.relayTools),!0}catch(e){let o=e;return o.message&&o.message.includes("EADDRINUSE")?d.warn(`[MCP] Port ${s} already in use. Relay disabled for this instance.`):d.error("[MCP] Failed to start relay server:",e),this.relayServer=null,!1}}setupHandlers(){let{tools:s,handleToolCall:a}=this.registry.build();this.server.setRequestHandler(ne,async()=>({tools:s})),this.server.setRequestHandler(re,async r=>{try{let{name:e,arguments:o}=r.params,n=await a(e,o);return e==="new_session"&&B("0.1.49",!!this.apiClient),{content:[{type:"text",text:n}]}}catch(e){let o=e instanceof Error?e.message:String(e);if(H.isAxiosError(e)){let n=e.config?.url,i=e.config?.baseURL,l=e.response?.status;o=`${e.code||"AxiosError"}: ${e.message}`,(i||n)&&(o+=` (${i||""}${n||""})`),l&&(o+=` [${l}]`),console.error(`[MCP] API error: ${o}`)}throw H.isAxiosError(e)&&e.response?.status===401&&(o="Authentication required. Contact info@shiplight.ai to get access to cloud services and advanced features."),new L(E.InternalError,o)}}),this.server.setRequestHandler(ie,async()=>({resources:C()})),this.server.setRequestHandler(ae,async r=>{let{uri:e}=r.params,o=await P(e);if(!o)throw new L(E.InvalidRequest,`Unknown resource: ${e}`);return{contents:[{uri:e,mimeType:"text/markdown",text:o}]}}),this.server.setRequestHandler(le,async()=>({prompts:k().map(e=>({name:e.name,description:e.description}))})),this.server.setRequestHandler(ce,async r=>{let{name:e}=r.params,o=A(e);if(!o)throw new L(E.InvalidRequest,`Unknown prompt: ${e}`);return{messages:[{role:"user",content:{type:"text",text:o}}]}})}async run(){await this.initBrowserTools(),await this.startRelayServer(),this.setupHandlers();let s=new te;await this.server.connect(s),d.info("Shiplight MCP Server running on stdio")}};async function Ce(){let t=process.argv.includes("--debug"),s=process.env.SHIPLIGHT_RELAY_PORT&&parseInt(process.env.SHIPLIGHT_RELAY_PORT,10)||null;await new R(t,s).run()}export{Ce as startServer};
|