yt-transcript-strapi-plugin 0.1.3 → 0.1.4

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.
@@ -1039,7 +1039,30 @@ const mcpController = ({ strapi }) => ({
1039
1039
  plugin.sessions.set(sessionId, session);
1040
1040
  strapi.log.debug(`[yt-transcript-mcp] New session created: ${sessionId} (auth: ${ctx.state.authMethod})`);
1041
1041
  }
1042
- await session.transport.handleRequest(ctx.req, ctx.res, ctx.request.body);
1042
+ try {
1043
+ await session.transport.handleRequest(ctx.req, ctx.res, ctx.request.body);
1044
+ } catch (transportError) {
1045
+ strapi.log.warn(`[yt-transcript-mcp] Transport error, cleaning up session: ${requestedSessionId}`, {
1046
+ error: transportError instanceof Error ? transportError.message : String(transportError)
1047
+ });
1048
+ try {
1049
+ session.server.close();
1050
+ } catch {
1051
+ }
1052
+ plugin.sessions.delete(requestedSessionId);
1053
+ if (!ctx.res.headersSent) {
1054
+ ctx.status = 400;
1055
+ ctx.body = {
1056
+ jsonrpc: "2.0",
1057
+ error: {
1058
+ code: -32e3,
1059
+ message: "Session transport error. Please reinitialize the connection."
1060
+ },
1061
+ id: null
1062
+ };
1063
+ }
1064
+ return;
1065
+ }
1043
1066
  ctx.respond = false;
1044
1067
  } catch (error) {
1045
1068
  strapi.log.error("[yt-transcript-mcp] Error handling MCP request", {
@@ -1038,7 +1038,30 @@ const mcpController = ({ strapi }) => ({
1038
1038
  plugin.sessions.set(sessionId, session);
1039
1039
  strapi.log.debug(`[yt-transcript-mcp] New session created: ${sessionId} (auth: ${ctx.state.authMethod})`);
1040
1040
  }
1041
- await session.transport.handleRequest(ctx.req, ctx.res, ctx.request.body);
1041
+ try {
1042
+ await session.transport.handleRequest(ctx.req, ctx.res, ctx.request.body);
1043
+ } catch (transportError) {
1044
+ strapi.log.warn(`[yt-transcript-mcp] Transport error, cleaning up session: ${requestedSessionId}`, {
1045
+ error: transportError instanceof Error ? transportError.message : String(transportError)
1046
+ });
1047
+ try {
1048
+ session.server.close();
1049
+ } catch {
1050
+ }
1051
+ plugin.sessions.delete(requestedSessionId);
1052
+ if (!ctx.res.headersSent) {
1053
+ ctx.status = 400;
1054
+ ctx.body = {
1055
+ jsonrpc: "2.0",
1056
+ error: {
1057
+ code: -32e3,
1058
+ message: "Session transport error. Please reinitialize the connection."
1059
+ },
1060
+ id: null
1061
+ };
1062
+ }
1063
+ return;
1064
+ }
1042
1065
  ctx.respond = false;
1043
1066
  } catch (error) {
1044
1067
  strapi.log.error("[yt-transcript-mcp] Error handling MCP request", {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.1.3",
2
+ "version": "0.1.4",
3
3
  "keywords": [
4
4
  "yt-transcript-strapi-plugin",
5
5
  "youtube",