chore: code reivew comments

Signed-off-by: benjdlambert <ben@blam.sh>
This commit is contained in:
benjdlambert
2025-06-17 11:56:46 +02:00
parent 22c8b3d5df
commit 19774b2a55
4 changed files with 9 additions and 7 deletions
+1 -1
View File
@@ -2,4 +2,4 @@
'@backstage/plugin-mcp-actions-backend': minor
---
Initial implementation of an `mcp` backend
Initial implementation of an `mcp-actions` backend
+1 -1
View File
@@ -3,7 +3,7 @@
"version": "0.0.0",
"backstage": {
"role": "backend-plugin",
"pluginId": "mcp",
"pluginId": "mcp-actions",
"pluginPackages": [
"@backstage/plugin-mcp-actions-backend"
]
@@ -18,7 +18,6 @@ import { Router } from 'express';
import { McpService } from '../services/McpService';
import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js';
import { HttpAuthService } from '@backstage/backend-plugin-api';
import { InputError, NotFoundError } from '@backstage/errors';
/**
* Legacy SSE endpoint for older clients, hopefully will not be needed for much longer.
@@ -56,16 +55,18 @@ export const createSseRouter = ({
const sessionId = req.query.sessionId as string;
if (!sessionId) {
throw new InputError('sessionId is required');
res.status(400).contentType('text/plain').write('sessionId is required');
return;
}
const transport = transportsToSessionId.get(sessionId);
if (transport) {
await transport.handlePostMessage(req, res, req.body);
} else {
throw new NotFoundError(
`No transport found for sessionId "${sessionId}"`,
);
res
.status(400)
.contentType('text/plain')
.write(`No transport found for sessionId "${sessionId}"`);
}
});
return router;
@@ -42,6 +42,7 @@ export class McpService {
);
server.setRequestHandler(ListToolsRequestSchema, async () => {
// TODO: switch this to be configuration based later
const { actions } = await this.actions.list({ credentials });
return {