Skip to content

Commit 46c71a9

Browse files
Tidying up static files
1 parent d67ef14 commit 46c71a9

6 files changed

Lines changed: 12 additions & 102 deletions

File tree

debug-test-hang.sh

Lines changed: 0 additions & 98 deletions
This file was deleted.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"scripts": {
88
"start": "node dist/index.js",
99
"dev": "tsx watch src/index.ts",
10-
"build": "tsc",
10+
"build": "tsc && npm run copy-static",
11+
"copy-static": "mkdir -p dist/static && cp -r src/static/* dist/static/",
1112
"lint": "eslint src/",
1213
"test": "NODE_OPTIONS=--experimental-vm-modules jest"
1314
},

src/handlers/sse.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export async function handleSSEConnection(req: Request, res: Response) {
7272

7373
logger.info('Listening on Redis channel', {
7474
sessionId: transport.sessionId,
75-
channel: redisChannel
75+
channel: redisChannelForSession(transport.sessionId)
7676
});
7777
await mcpServer.connect(transport);
7878
}

src/index.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { BearerAuthMiddlewareOptions, requireBearerAuth } from "@modelcontextpro
22
import { AuthRouterOptions, mcpAuthRouter } from "@modelcontextprotocol/sdk/server/auth/router.js";
33
import cors from "cors";
44
import express from "express";
5+
import path from "path";
6+
import { fileURLToPath } from "url";
57
import { EverythingAuthProvider } from "./auth/provider.js";
68
import { BASE_URI, PORT } from "./config.js";
79
import { authContext } from "./handlers/common.js";
@@ -13,6 +15,10 @@ import { logger } from "./utils/logger.js";
1315

1416
const app = express();
1517

18+
// Get the directory of the current module
19+
const __filename = fileURLToPath(import.meta.url);
20+
const __dirname = path.dirname(__filename);
21+
1622
// Base security middleware - applied to all routes
1723
const baseSecurityHeaders = (req: express.Request, res: express.Response, next: express.NextFunction) => {
1824
// Basic security headers
@@ -150,7 +156,8 @@ app.delete("/mcp", cors(corsOptions), bearerAuth, authContext, handleStreamableH
150156

151157
// Static assets
152158
app.get("/mcp-logo.png", (req, res) => {
153-
res.sendFile("mcp.png", { root: "." });
159+
const logoPath = path.join(__dirname, "static", "mcp.png");
160+
res.sendFile(logoPath);
154161
});
155162

156163
// Upstream auth routes
File renamed without changes.

src/utils/logger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,4 +169,4 @@ class StructuredLogger {
169169
export const logger = new StructuredLogger();
170170

171171
// Re-export for convenience
172-
export { LogContext, StructuredLogEntry };
172+
export type { LogContext, StructuredLogEntry };

0 commit comments

Comments
 (0)