@mrrlin-dev/mcp 0.4.91 → 0.4.92

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/bin.cjs +37 -12
  2. package/package.json +1 -1
package/dist/bin.cjs CHANGED
@@ -50980,7 +50980,7 @@ async function invokeCapability(server, toolName, payload) {
50980
50980
  throw classifyInvokeError(error51, target, toolName);
50981
50981
  }
50982
50982
  if (result.isError) {
50983
- throw new Error(`invokeCapability: tool "${toolName}" reported isError -- ${extractFirstText(result.content)}`);
50983
+ throw new InvokeToolExecutionError(toolName, extractFirstText(result.content));
50984
50984
  }
50985
50985
  return { content: result.content, url: extractFirstUrl(result.content) };
50986
50986
  } finally {
@@ -50994,6 +50994,12 @@ var InvokeToolNotFoundError = class extends Error {
50994
50994
  this.name = "InvokeToolNotFoundError";
50995
50995
  }
50996
50996
  };
50997
+ var InvokeToolExecutionError = class extends Error {
50998
+ constructor(toolName, detail, cause) {
50999
+ super(`invokeCapability: tool "${toolName}" reported isError -- ${detail}`, { cause });
51000
+ this.name = "InvokeToolExecutionError";
51001
+ }
51002
+ };
50997
51003
  var InvokeUnreachableError = class extends Error {
50998
51004
  constructor(url2, cause) {
50999
51005
  super(`invokeCapability: could not reach the granted server at ${url2}`, { cause });
@@ -51027,9 +51033,12 @@ function classifyInvokeError(error51, url2, toolName) {
51027
51033
  return new InvokeUnreachableError(url2, error51);
51028
51034
  }
51029
51035
  if (error51 instanceof McpError) {
51030
- if (error51.code === ErrorCode.MethodNotFound || error51.code === ErrorCode.InvalidParams) {
51036
+ if (error51.code === ErrorCode.MethodNotFound) {
51031
51037
  return new InvokeToolNotFoundError(toolName, error51);
51032
51038
  }
51039
+ if (error51.code === ErrorCode.InvalidParams) {
51040
+ return new InvokeMalformedResultError(`invalid parameters for tool "${toolName}": ${error51.message}`, error51);
51041
+ }
51033
51042
  return new InvokeMalformedResultError(error51.message, error51);
51034
51043
  }
51035
51044
  if (error51 instanceof TypeError || error51 instanceof Error && (error51.name === "TimeoutError" || error51.name === "AbortError")) {
@@ -51041,8 +51050,15 @@ function isRecord(value) {
51041
51050
  return typeof value === "object" && value !== null && !Array.isArray(value);
51042
51051
  }
51043
51052
  function extractFirstUrl(content) {
51044
- const match = findFirstMatch(content, /https?:\/\/\S+/);
51045
- return match ? match.replace(/[.,;:!?"')\]}>]+$/, "") : null;
51053
+ const match = findFirstMatch(content, /https?:\/\/[^\s<>|]+/);
51054
+ if (!match) return null;
51055
+ const cleaned = match.replace(/[.,;:!?"')\]}]+$/, "");
51056
+ try {
51057
+ const parsed = new URL(cleaned);
51058
+ return parsed.href;
51059
+ } catch {
51060
+ return null;
51061
+ }
51046
51062
  }
51047
51063
  function extractFirstText(content) {
51048
51064
  if (Array.isArray(content)) {
@@ -51086,9 +51102,11 @@ function parsePullRequestUrl(url2) {
51086
51102
  const owner = parts[pullIdx - 2];
51087
51103
  const repo = parts[pullIdx - 1];
51088
51104
  const pullPart = parts[pullIdx + 1];
51089
- const pullNumber = pullPart ? parseInt(pullPart, 10) : NaN;
51090
- if (owner && repo && !Number.isNaN(pullNumber)) {
51091
- return { owner, repo, pullNumber };
51105
+ if (pullPart && /^\d+$/.test(pullPart)) {
51106
+ const pullNumber = parseInt(pullPart, 10);
51107
+ if (owner && repo && !Number.isNaN(pullNumber)) {
51108
+ return { owner, repo, pullNumber };
51109
+ }
51092
51110
  }
51093
51111
  }
51094
51112
  } catch {
@@ -51128,7 +51146,7 @@ async function deliverToGit(server, toolName, payload) {
51128
51146
  }
51129
51147
  return invokeCapability(server, toolName, args);
51130
51148
  }
51131
- if (isDefaultGitHubRoute && toolName === defaultRoute.operations.pull_request_state) {
51149
+ if (isDefaultGitHubRoute && (toolName === defaultRoute.operations.pull_request_state || toolName === "pull_request_read")) {
51132
51150
  const { operation: _operation, ...args } = payload;
51133
51151
  const urlParts = parsePullRequestUrl(payload.pullRequestUrl);
51134
51152
  let owner = args.owner ?? urlParts.owner;
@@ -51144,7 +51162,12 @@ async function deliverToGit(server, toolName, payload) {
51144
51162
  if (owner) adaptedArgs.owner = owner;
51145
51163
  if (repo) adaptedArgs.repo = repo;
51146
51164
  if (pullNumber !== void 0) {
51147
- adaptedArgs.pull_number = pullNumber;
51165
+ if (toolName === "pull_request_read") {
51166
+ adaptedArgs.method = "get";
51167
+ adaptedArgs.pullNumber = pullNumber;
51168
+ } else {
51169
+ adaptedArgs.pull_number = pullNumber;
51170
+ }
51148
51171
  }
51149
51172
  return invokeCapability(server, toolName, adaptedArgs);
51150
51173
  }
@@ -51232,8 +51255,10 @@ async function deliverToSend(server, toolName, payload) {
51232
51255
  const defaultRoute = server.id ? getDefaultCapabilityRouteForServer(server.id) : null;
51233
51256
  const isDefaultSlackRoute = defaultRoute?.capability === "send";
51234
51257
  if (payload.operation === "dispatch" && isDefaultSlackRoute && toolName === defaultRoute.operations.dispatch) {
51235
- const channelId = args.channel_id ?? args.destination ?? args.channel ?? args.to;
51236
- const text = args.text ?? args.body ?? args.message ?? args.content;
51258
+ const rawChannel = args.channel_id ?? args.destination ?? args.channel ?? args.to;
51259
+ const channelId = typeof rawChannel === "string" ? rawChannel.trim() : rawChannel !== void 0 ? String(rawChannel) : void 0;
51260
+ const rawText = args.text ?? args.body ?? args.message ?? args.content;
51261
+ const text = typeof rawText === "string" ? rawText.trim() : rawText !== void 0 ? String(rawText) : void 0;
51237
51262
  const adaptedArgs = {};
51238
51263
  if (channelId !== void 0) adaptedArgs.channel_id = channelId;
51239
51264
  if (text !== void 0) adaptedArgs.text = text;
@@ -57691,7 +57716,7 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
57691
57716
  }
57692
57717
 
57693
57718
  // src/_generated/version.ts
57694
- var PKG_VERSION = "0.4.91";
57719
+ var PKG_VERSION = "0.4.92";
57695
57720
 
57696
57721
  // src/api-base-url-migrate.ts
57697
57722
  var import_node_fs13 = __toESM(require("node:fs"), 1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrrlin-dev/mcp",
3
- "version": "0.4.91",
3
+ "version": "0.4.92",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mrrlin-mcp": "dist/bin.cjs"