vite-plugin-swagger-mcp 0.0.20 → 0.0.21

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.
@@ -1,6 +1,5 @@
1
1
  import type { Plugin } from "vite";
2
2
  import { SchemaObject } from "./type";
3
- export declare const isInitializeRequest: (value: unknown) => boolean;
4
3
  export declare class SwaggerMcpServer {
5
4
  private swaggerUrl;
6
5
  private token?;
package/dist/cjs/index.js CHANGED
@@ -20,13 +20,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  var src_exports = {};
21
21
  __export(src_exports, {
22
22
  SwaggerMcpServer: () => SwaggerMcpServer,
23
- default: () => vitePluginSwaggerMcp,
24
- isInitializeRequest: () => isInitializeRequest
23
+ default: () => vitePluginSwaggerMcp
25
24
  });
26
25
  module.exports = __toCommonJS(src_exports);
27
26
  var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
28
27
  var import_streamableHttp = require("@modelcontextprotocol/sdk/server/streamableHttp.js");
29
- var import_types = require("@modelcontextprotocol/sdk/types");
30
28
  var import_node_crypto = require("node:crypto");
31
29
  var import_v4 = require("zod/v4");
32
30
  async function readJsonBody(req) {
@@ -35,7 +33,6 @@ async function readJsonBody(req) {
35
33
  body += chunk;
36
34
  return JSON.parse(body || "{}");
37
35
  }
38
- var isInitializeRequest = (value) => import_types.InitializeRequestParamsSchema.safeParse(value).success;
39
36
  var SwaggerMcpServer = class {
40
37
  constructor(swaggerUrl, token) {
41
38
  this.swaggerUrl = swaggerUrl;
@@ -192,7 +189,7 @@ function vitePluginSwaggerMcp({
192
189
  let transport;
193
190
  if (sessionId && transports[sessionId]) {
194
191
  transport = transports[sessionId];
195
- } else if (!sessionId && isInitializeRequest(json)) {
192
+ } else if (!sessionId) {
196
193
  transport = new import_streamableHttp.StreamableHTTPServerTransport({
197
194
  sessionIdGenerator: () => (0, import_node_crypto.randomUUID)(),
198
195
  // 如果你的编辑器不支持 SSE 只能接收 JSON 响应,可以设为 true
@@ -242,6 +239,5 @@ function vitePluginSwaggerMcp({
242
239
  }
243
240
  // Annotate the CommonJS export names for ESM import in node:
244
241
  0 && (module.exports = {
245
- SwaggerMcpServer,
246
- isInitializeRequest
242
+ SwaggerMcpServer
247
243
  });
@@ -1,6 +1,5 @@
1
1
  import type { Plugin } from "vite";
2
2
  import { SchemaObject } from "./type";
3
- export declare const isInitializeRequest: (value: unknown) => boolean;
4
3
  export declare class SwaggerMcpServer {
5
4
  private swaggerUrl;
6
5
  private token?;
package/dist/esm/index.js CHANGED
@@ -14,7 +14,6 @@ function _asyncIterator(r) { var n, t, o, e = 2; for ("undefined" != typeof Symb
14
14
  function AsyncFromSyncIterator(r) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var n = r.done; return Promise.resolve(r.value).then(function (r) { return { value: r, done: n }; }); } return AsyncFromSyncIterator = function AsyncFromSyncIterator(r) { this.s = r, this.n = r.next; }, AsyncFromSyncIterator.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, return: function _return(r) { var n = this.s.return; return void 0 === n ? Promise.resolve({ value: r, done: !0 }) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); }, throw: function _throw(r) { var n = this.s.return; return void 0 === n ? Promise.reject(r) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); } }, new AsyncFromSyncIterator(r); }
15
15
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
16
16
  import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
17
- import { InitializeRequestParamsSchema } from "@modelcontextprotocol/sdk/types";
18
17
  import { randomUUID } from "node:crypto";
19
18
  import { z } from "zod/v4";
20
19
  // --- 辅助函数:解析 JSON Body ---
@@ -84,9 +83,6 @@ function _readJsonBody() {
84
83
  }));
85
84
  return _readJsonBody.apply(this, arguments);
86
85
  }
87
- export var isInitializeRequest = function isInitializeRequest(value) {
88
- return InitializeRequestParamsSchema.safeParse(value).success;
89
- };
90
86
  export var SwaggerMcpServer = /*#__PURE__*/function () {
91
87
  function SwaggerMcpServer(swaggerUrl, token) {
92
88
  _classCallCheck(this, SwaggerMcpServer);
@@ -433,7 +429,7 @@ export default function vitePluginSwaggerMcp(_ref) {
433
429
  _context8.next = 21;
434
430
  break;
435
431
  case 11:
436
- if (!(!_sessionId && isInitializeRequest(json))) {
432
+ if (_sessionId) {
437
433
  _context8.next = 19;
438
434
  break;
439
435
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-swagger-mcp",
3
- "version": "0.0.20",
3
+ "version": "0.0.21",
4
4
  "description": "vite plugin for swagger mcp",
5
5
  "homepage": "https://github.com/mmdctjj/vite-plugin-swagger-mcp",
6
6
  "repository": {