@corsair-dev/mcp 0.1.28 → 0.1.29

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/bin.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runStdioMcpServer
4
- } from "./chunk-3H436GYZ.js";
4
+ } from "./chunk-QFVNNGDE.js";
5
5
 
6
6
  // src/bin.ts
7
7
  import { createCorsair } from "corsair";
@@ -650,55 +650,139 @@ import {
650
650
  ZodFirstPartyTypeKind as ZodFirstPartyTypeKind2
651
651
  } from "zod/v3";
652
652
 
653
- // ../../node_modules/.pnpm/eventsource-parser@3.0.6/node_modules/eventsource-parser/dist/index.js
653
+ // ../../node_modules/.pnpm/eventsource-parser@3.1.1/node_modules/eventsource-parser/dist/index.js
654
654
  var ParseError = class extends Error {
655
655
  constructor(message, options) {
656
656
  super(message), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
657
657
  }
658
658
  };
659
+ var LF = 10;
660
+ var CR = 13;
661
+ var SPACE = 32;
659
662
  function noop(_arg) {
660
663
  }
661
- function createParser(callbacks) {
662
- if (typeof callbacks == "function")
664
+ function createParser(config) {
665
+ if (typeof config == "function")
663
666
  throw new TypeError(
664
- "`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
667
+ "`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?"
665
668
  );
666
- const { onEvent = noop, onError = noop, onRetry = noop, onComment } = callbacks;
667
- let incompleteLine = "", isFirstChunk = true, id, data = "", eventType = "";
668
- function feed(newChunk) {
669
- const chunk = isFirstChunk ? newChunk.replace(/^\xEF\xBB\xBF/, "") : newChunk, [complete, incomplete] = splitLines(`${incompleteLine}${chunk}`);
670
- for (const line of complete)
671
- parseLine(line);
672
- incompleteLine = incomplete, isFirstChunk = false;
673
- }
674
- function parseLine(line) {
675
- if (line === "") {
669
+ const { onEvent = noop, onError = noop, onRetry = noop, onComment, maxBufferSize } = config, pendingFragments = [];
670
+ let pendingFragmentsLength = 0, isFirstChunk = true, id, data = "", dataLines = 0, eventType, terminated = false;
671
+ function feed(chunk) {
672
+ if (terminated)
673
+ throw new Error(
674
+ "Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing."
675
+ );
676
+ if (isFirstChunk && (isFirstChunk = false, chunk.charCodeAt(0) === 239 && chunk.charCodeAt(1) === 187 && chunk.charCodeAt(2) === 191 && (chunk = chunk.slice(3))), pendingFragments.length === 0) {
677
+ const trailing2 = processLines(chunk);
678
+ trailing2 !== "" && (pendingFragments.push(trailing2), pendingFragmentsLength = trailing2.length), checkBufferSize();
679
+ return;
680
+ }
681
+ if (chunk.indexOf(`
682
+ `) === -1 && chunk.indexOf("\r") === -1) {
683
+ pendingFragments.push(chunk), pendingFragmentsLength += chunk.length, checkBufferSize();
684
+ return;
685
+ }
686
+ pendingFragments.push(chunk);
687
+ const input = pendingFragments.join("");
688
+ pendingFragments.length = 0, pendingFragmentsLength = 0;
689
+ const trailing = processLines(input);
690
+ trailing !== "" && (pendingFragments.push(trailing), pendingFragmentsLength = trailing.length), checkBufferSize();
691
+ }
692
+ function checkBufferSize() {
693
+ maxBufferSize !== void 0 && (pendingFragmentsLength + data.length <= maxBufferSize || (terminated = true, pendingFragments.length = 0, pendingFragmentsLength = 0, id = void 0, data = "", dataLines = 0, eventType = void 0, onError(
694
+ new ParseError(`Buffered data exceeded max buffer size of ${maxBufferSize} characters`, {
695
+ type: "max-buffer-size-exceeded"
696
+ })
697
+ )));
698
+ }
699
+ function processLines(chunk) {
700
+ let searchIndex = 0;
701
+ if (chunk.indexOf("\r") === -1) {
702
+ let lfIndex = chunk.indexOf(`
703
+ `, searchIndex);
704
+ for (; lfIndex !== -1; ) {
705
+ if (searchIndex === lfIndex) {
706
+ dataLines > 0 && onEvent({ id, event: eventType, data }), id = void 0, data = "", dataLines = 0, eventType = void 0, searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
707
+ `, searchIndex);
708
+ continue;
709
+ }
710
+ const firstCharCode = chunk.charCodeAt(searchIndex);
711
+ if (isDataPrefix(chunk, searchIndex, firstCharCode)) {
712
+ const valueStart = chunk.charCodeAt(searchIndex + 5) === SPACE ? searchIndex + 6 : searchIndex + 5, value = chunk.slice(valueStart, lfIndex);
713
+ if (dataLines === 0 && chunk.charCodeAt(lfIndex + 1) === LF) {
714
+ onEvent({ id, event: eventType, data: value }), id = void 0, data = "", eventType = void 0, searchIndex = lfIndex + 2, lfIndex = chunk.indexOf(`
715
+ `, searchIndex);
716
+ continue;
717
+ }
718
+ data = dataLines === 0 ? value : `${data}
719
+ ${value}`, dataLines++;
720
+ } else isEventPrefix(chunk, searchIndex, firstCharCode) ? eventType = chunk.slice(
721
+ chunk.charCodeAt(searchIndex + 6) === SPACE ? searchIndex + 7 : searchIndex + 6,
722
+ lfIndex
723
+ ) || void 0 : parseLine(chunk, searchIndex, lfIndex);
724
+ searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
725
+ `, searchIndex);
726
+ }
727
+ return chunk.slice(searchIndex);
728
+ }
729
+ for (; searchIndex < chunk.length; ) {
730
+ const crIndex = chunk.indexOf("\r", searchIndex), lfIndex = chunk.indexOf(`
731
+ `, searchIndex);
732
+ let lineEnd = -1;
733
+ if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = crIndex < lfIndex ? crIndex : lfIndex : crIndex !== -1 ? crIndex === chunk.length - 1 ? lineEnd = -1 : lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1)
734
+ break;
735
+ parseLine(chunk, searchIndex, lineEnd), searchIndex = lineEnd + 1, chunk.charCodeAt(searchIndex - 1) === CR && chunk.charCodeAt(searchIndex) === LF && searchIndex++;
736
+ }
737
+ return chunk.slice(searchIndex);
738
+ }
739
+ function parseLine(chunk, start, end) {
740
+ if (start === end) {
676
741
  dispatchEvent();
677
742
  return;
678
743
  }
679
- if (line.startsWith(":")) {
680
- onComment && onComment(line.slice(line.startsWith(": ") ? 2 : 1));
744
+ const firstCharCode = chunk.charCodeAt(start);
745
+ if (isDataPrefix(chunk, start, firstCharCode)) {
746
+ const valueStart = chunk.charCodeAt(start + 5) === SPACE ? start + 6 : start + 5, value2 = chunk.slice(valueStart, end);
747
+ data = dataLines === 0 ? value2 : `${data}
748
+ ${value2}`, dataLines++;
681
749
  return;
682
750
  }
683
- const fieldSeparatorIndex = line.indexOf(":");
684
- if (fieldSeparatorIndex !== -1) {
685
- const field = line.slice(0, fieldSeparatorIndex), offset = line[fieldSeparatorIndex + 1] === " " ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
686
- processField(field, value, line);
751
+ if (isEventPrefix(chunk, start, firstCharCode)) {
752
+ eventType = chunk.slice(chunk.charCodeAt(start + 6) === SPACE ? start + 7 : start + 6, end) || void 0;
753
+ return;
754
+ }
755
+ if (firstCharCode === 105 && chunk.charCodeAt(start + 1) === 100 && chunk.charCodeAt(start + 2) === 58) {
756
+ const value2 = chunk.slice(chunk.charCodeAt(start + 3) === SPACE ? start + 4 : start + 3, end);
757
+ value2.includes("\0") || (id = value2);
758
+ return;
759
+ }
760
+ if (firstCharCode === 58) {
761
+ if (onComment) {
762
+ const line2 = chunk.slice(start, end);
763
+ onComment(line2.slice(chunk.charCodeAt(start + 1) === SPACE ? 2 : 1));
764
+ }
687
765
  return;
688
766
  }
689
- processField(line, "", line);
767
+ const line = chunk.slice(start, end), fieldSeparatorIndex = line.indexOf(":");
768
+ if (fieldSeparatorIndex === -1) {
769
+ processField(line, "", line);
770
+ return;
771
+ }
772
+ const field = line.slice(0, fieldSeparatorIndex), offset = line.charCodeAt(fieldSeparatorIndex + 1) === SPACE ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
773
+ processField(field, value, line);
690
774
  }
691
775
  function processField(field, value, line) {
692
776
  switch (field) {
693
777
  case "event":
694
- eventType = value;
778
+ eventType = value || void 0;
695
779
  break;
696
780
  case "data":
697
- data = `${data}${value}
698
- `;
781
+ data = dataLines === 0 ? value : `${data}
782
+ ${value}`, dataLines++;
699
783
  break;
700
784
  case "id":
701
- id = value.includes("\0") ? void 0 : value;
785
+ value.includes("\0") || (id = value);
702
786
  break;
703
787
  case "retry":
704
788
  /^\d+$/.test(value) ? onRetry(parseInt(value, 10)) : onError(
@@ -720,42 +804,31 @@ function createParser(callbacks) {
720
804
  }
721
805
  }
722
806
  function dispatchEvent() {
723
- data.length > 0 && onEvent({
807
+ dataLines > 0 && onEvent({
724
808
  id,
725
- event: eventType || void 0,
726
- // If the data buffer's last character is a U+000A LINE FEED (LF) character,
727
- // then remove the last character from the data buffer.
728
- data: data.endsWith(`
729
- `) ? data.slice(0, -1) : data
730
- }), id = void 0, data = "", eventType = "";
809
+ event: eventType,
810
+ data
811
+ }), id = void 0, data = "", dataLines = 0, eventType = void 0;
731
812
  }
732
813
  function reset(options = {}) {
733
- incompleteLine && options.consume && parseLine(incompleteLine), isFirstChunk = true, id = void 0, data = "", eventType = "", incompleteLine = "";
814
+ if (options.consume && pendingFragments.length > 0) {
815
+ const incompleteLine = pendingFragments.join("");
816
+ parseLine(incompleteLine, 0, incompleteLine.length);
817
+ }
818
+ isFirstChunk = true, id = void 0, data = "", dataLines = 0, eventType = void 0, pendingFragments.length = 0, pendingFragmentsLength = 0, terminated = false;
734
819
  }
735
820
  return { feed, reset };
736
821
  }
737
- function splitLines(chunk) {
738
- const lines = [];
739
- let incompleteLine = "", searchIndex = 0;
740
- for (; searchIndex < chunk.length; ) {
741
- const crIndex = chunk.indexOf("\r", searchIndex), lfIndex = chunk.indexOf(`
742
- `, searchIndex);
743
- let lineEnd = -1;
744
- if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = Math.min(crIndex, lfIndex) : crIndex !== -1 ? crIndex === chunk.length - 1 ? lineEnd = -1 : lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1) {
745
- incompleteLine = chunk.slice(searchIndex);
746
- break;
747
- } else {
748
- const line = chunk.slice(searchIndex, lineEnd);
749
- lines.push(line), searchIndex = lineEnd + 1, chunk[searchIndex - 1] === "\r" && chunk[searchIndex] === `
750
- ` && searchIndex++;
751
- }
752
- }
753
- return [lines, incompleteLine];
822
+ function isDataPrefix(chunk, i, firstCharCode) {
823
+ return firstCharCode === 100 && chunk.charCodeAt(i + 1) === 97 && chunk.charCodeAt(i + 2) === 116 && chunk.charCodeAt(i + 3) === 97 && chunk.charCodeAt(i + 4) === 58;
824
+ }
825
+ function isEventPrefix(chunk, i, firstCharCode) {
826
+ return firstCharCode === 101 && chunk.charCodeAt(i + 1) === 118 && chunk.charCodeAt(i + 2) === 101 && chunk.charCodeAt(i + 3) === 110 && chunk.charCodeAt(i + 4) === 116 && chunk.charCodeAt(i + 5) === 58;
754
827
  }
755
828
 
756
- // ../../node_modules/.pnpm/eventsource-parser@3.0.6/node_modules/eventsource-parser/dist/stream.js
829
+ // ../../node_modules/.pnpm/eventsource-parser@3.1.1/node_modules/eventsource-parser/dist/stream.js
757
830
  var EventSourceParserStream = class extends TransformStream {
758
- constructor({ onError, onRetry, onComment } = {}) {
831
+ constructor({ onError, onRetry, onComment, maxBufferSize } = {}) {
759
832
  let parser;
760
833
  super({
761
834
  start(controller) {
@@ -764,10 +837,11 @@ var EventSourceParserStream = class extends TransformStream {
764
837
  controller.enqueue(event);
765
838
  },
766
839
  onError(error) {
767
- onError === "terminate" ? controller.error(error) : typeof onError == "function" && onError(error);
840
+ typeof onError == "function" && onError(error), (onError === "terminate" || error.type === "max-buffer-size-exceeded") && controller.error(error);
768
841
  },
769
842
  onRetry,
770
- onComment
843
+ onComment,
844
+ maxBufferSize
771
845
  });
772
846
  },
773
847
  transform(chunk) {
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  createVercelAiMcpClient,
12
12
  getOpenAIMcpConfig,
13
13
  runStdioMcpServer
14
- } from "./chunk-3H436GYZ.js";
14
+ } from "./chunk-QFVNNGDE.js";
15
15
  export {
16
16
  AnthropicProvider,
17
17
  BaseProvider,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corsair-dev/mcp",
3
- "version": "0.1.28",
3
+ "version": "0.1.29",
4
4
  "description": "MCP server and framework adapters for Corsair. Expose 200+ integrations to any agent framework (Mastra, LangChain, LlamaIndex, OpenAI, Vercel AI, Claude) as tools.",
5
5
  "keywords": [
6
6
  "mcp",
@@ -67,10 +67,10 @@
67
67
  "@modelcontextprotocol/sdk": "^1.27.1",
68
68
  "express": "^4.21.0",
69
69
  "zod": "^4.1.13",
70
- "@corsair-dev/langchain": "0.1.0",
71
- "@corsair-dev/llamaindex": "0.1.0",
72
- "@corsair-dev/mastra": "0.1.0",
73
- "corsair": "0.1.129"
70
+ "@corsair-dev/langchain": "0.1.1",
71
+ "corsair": "0.1.158",
72
+ "@corsair-dev/llamaindex": "0.1.1",
73
+ "@corsair-dev/mastra": "0.1.1"
74
74
  },
75
75
  "peerDependencies": {
76
76
  "@anthropic-ai/claude-agent-sdk": ">=0.2.0",