-
Notifications
You must be signed in to change notification settings - Fork 6
Add splash page for MCP Everything Server #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Implemented a clean, informative splash page at the root endpoint that showcases: - Server features and capabilities - API endpoints documentation - Links to GitHub repository and MCP documentation - Black and white theme matching MCP branding - Responsive design for mobile and desktop The splash page provides users with an immediate overview of the server's functionality and serves as a landing page for the MCP Everything Server. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
app.get("/", (req, res) => { | ||
const splashPath = path.join(__dirname, "static", "index.html"); | ||
res.sendFile(splashPath); | ||
}); |
Check failure
Code scanning / CodeQL
Missing rate limiting High
a file system access
This autofix suggestion was applied.
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 8 days ago
To fix the problem, we should add a rate-limiting middleware to the route handler for /
(the splash page) in src/index.ts
. The recommended approach is to use the well-known express-rate-limit
package, which is compatible with Express and easy to configure. We will:
- Import
express-rate-limit
at the top of the file. - Create a rate limiter instance with reasonable defaults (e.g., 100 requests per 15 minutes per IP).
- Apply the rate limiter middleware to the
/
route only, so it does not affect other routes unnecessarily. - Ensure the fix is limited to the code shown, without changing existing functionality.
-
Copy modified line R5 -
Copy modified lines R19-R25 -
Copy modified line R179
@@ -2,6 +2,7 @@ | ||
import { AuthRouterOptions, getOAuthProtectedResourceMetadataUrl, mcpAuthRouter } from "@modelcontextprotocol/sdk/server/auth/router.js"; | ||
import cors from "cors"; | ||
import express from "express"; | ||
import rateLimit from "express-rate-limit"; | ||
import path from "path"; | ||
import { fileURLToPath } from "url"; | ||
import { EverythingAuthProvider } from "./auth/provider.js"; | ||
@@ -15,6 +16,13 @@ | ||
|
||
const app = express(); | ||
|
||
// Rate limiter for splash page | ||
const splashLimiter = rateLimit({ | ||
windowMs: 15 * 60 * 1000, // 15 minutes | ||
max: 100, // limit each IP to 100 requests per windowMs | ||
standardHeaders: true, // Return rate limit info in the `RateLimit-*` headers | ||
legacyHeaders: false, // Disable the `X-RateLimit-*` headers | ||
}); | ||
// Get the directory of the current module | ||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
@@ -168,7 +176,7 @@ | ||
}); | ||
|
||
// Splash page | ||
app.get("/", (req, res) => { | ||
app.get("/", splashLimiter, (req, res) => { | ||
const splashPath = path.join(__dirname, "static", "index.html"); | ||
res.sendFile(splashPath); | ||
}); |
-
Copy modified lines R35-R36
@@ -32,7 +32,8 @@ | ||
"cors": "^2.8.5", | ||
"dotenv": "^16.4.7", | ||
"express": "^4.21.2", | ||
"raw-body": "^3.0.0" | ||
"raw-body": "^3.0.0", | ||
"express-rate-limit": "^8.0.1" | ||
}, | ||
"overrides": { | ||
"@types/express": "^5.0.0", |
Package | Version | Security advisories |
express-rate-limit (npm) | 8.0.1 | None |
Refreshed package dependencies to ensure clean installation. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
3071db5
to
0e50f08
Compare
Summary
/
endpointChanges
src/static/index.html
splash page with:src/index.ts
to serve the splash page at/
Test Plan
/mcp-logo.png
endpointnpm run build
- builds successfullynpm run lint
- no linting errorsnpm test
- all tests pass🤖 Generated with Claude Code