vite-plugin-swagger-mcp 0.0.4 → 0.0.6

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/cjs/index.js CHANGED
@@ -110,8 +110,7 @@ var SwaggerMcpServer = class {
110
110
  apis.push({
111
111
  path,
112
112
  method,
113
- ...doc.paths[path][method],
114
- definitions: resolvedDefinition
113
+ summary: doc.paths[path][method].summary || ""
115
114
  });
116
115
  }
117
116
  });
@@ -144,6 +143,7 @@ function vitePluginSwaggerMcp({
144
143
  name: "vite-plugin-swagger-mcp",
145
144
  enforce: "pre",
146
145
  async configureServer(server) {
146
+ var _a, _b;
147
147
  try {
148
148
  let transport = new import_streamableHttp.StreamableHTTPServerTransport({
149
149
  sessionIdGenerator: () => (0, import_node_crypto.randomUUID)(),
@@ -211,11 +211,14 @@ function vitePluginSwaggerMcp({
211
211
  })
212
212
  );
213
213
  await mcpServer.connect(transport);
214
- console.log("MCP server connected");
214
+ console.log(
215
+ "MCP server connected:",
216
+ `http://localhost:${(_b = (_a = server.config) == null ? void 0 : _a.server) == null ? void 0 : _b.port}/_mcp/sse/swagger`
217
+ );
215
218
  server.middlewares.use(
216
219
  async (req, res, next) => {
217
- var _a;
218
- if (req.method === "POST" && ((_a = req.url) == null ? void 0 : _a.startsWith("/_mcp/sse/swagger"))) {
220
+ var _a2;
221
+ if (req.method === "POST" && ((_a2 = req.url) == null ? void 0 : _a2.startsWith("/_mcp/sse/swagger"))) {
219
222
  if (!req.headers["mcp-session-id"] && transport.sessionId) {
220
223
  req.headers["mcp-session-id"] = transport.sessionId;
221
224
  }
package/dist/esm/index.js CHANGED
@@ -163,12 +163,11 @@ export var SwaggerMcpServer = /*#__PURE__*/function () {
163
163
  var _doc$paths$path$metho2;
164
164
  var originalRef = (_doc$paths$path$metho2 = doc.paths[path][method].responses) === null || _doc$paths$path$metho2 === void 0 || (_doc$paths$path$metho2 = _doc$paths$path$metho2["200"]) === null || _doc$paths$path$metho2 === void 0 || (_doc$paths$path$metho2 = _doc$paths$path$metho2.schema) === null || _doc$paths$path$metho2 === void 0 ? void 0 : _doc$paths$path$metho2.originalRef;
165
165
  var resolvedDefinition = _this2.resolveRef(doc, originalRef);
166
- apis.push(_objectSpread(_objectSpread({
166
+ apis.push({
167
167
  path: path,
168
- method: method
169
- }, doc.paths[path][method]), {}, {
170
- definitions: resolvedDefinition
171
- }));
168
+ method: method,
169
+ summary: doc.paths[path][method].summary || ""
170
+ });
172
171
  }
173
172
  });
174
173
  });
@@ -237,7 +236,7 @@ export default function vitePluginSwaggerMcp(_ref) {
237
236
  enforce: "pre",
238
237
  configureServer: function configureServer(server) {
239
238
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
240
- var transport, swaggerServer, mcpServer;
239
+ var _server$config, transport, swaggerServer, mcpServer;
241
240
  return _regeneratorRuntime().wrap(function _callee9$(_context9) {
242
241
  while (1) switch (_context9.prev = _context9.next) {
243
242
  case 0:
@@ -372,7 +371,7 @@ export default function vitePluginSwaggerMcp(_ref) {
372
371
  _context9.next = 10;
373
372
  return mcpServer.connect(transport);
374
373
  case 10:
375
- console.log("MCP server connected");
374
+ console.log("MCP server connected:", "http://localhost:".concat((_server$config = server.config) === null || _server$config === void 0 || (_server$config = _server$config.server) === null || _server$config === void 0 ? void 0 : _server$config.port, "/_mcp/sse/swagger"));
376
375
  server.middlewares.use( /*#__PURE__*/function () {
377
376
  var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(req, res, next) {
378
377
  var _req$url;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-swagger-mcp",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "vite plugin for swagger mcp",
5
5
  "homepage": "https://github.com/mmctjj/vite-plugin-swagger-mcp",
6
6
  "repository": {