Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added public/favicon.ico
Binary file not shown.
12 changes: 12 additions & 0 deletions public/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ import { createServer } from "./server.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
import { createServer as createHttpServer, type IncomingMessage, type ServerResponse } from "node:http";
import { readFileSync } from "node:fs";
import { resolve, dirname } from "node:path";
import { fileURLToPath } from "node:url";

const __dirname = dirname(fileURLToPath(import.meta.url));
const publicDir = resolve(__dirname, "..", "public");

// Parse CLI args
const args = process.argv.slice(2);
Expand Down Expand Up @@ -45,6 +51,22 @@ async function runHttp() {
return;
}

// Favicon (ICO)
if (url.pathname === "/favicon.ico") {
const buf = readFileSync(resolve(publicDir, "favicon.ico"));
res.writeHead(200, { "Content-Type": "image/x-icon", "Cache-Control": "public, max-age=86400" });
res.end(buf);
return;
}

// Favicon (SVG)
if (url.pathname === "/favicon.svg") {
const svg = readFileSync(resolve(publicDir, "favicon.svg"), "utf-8");
res.writeHead(200, { "Content-Type": "image/svg+xml", "Cache-Control": "public, max-age=86400" });
res.end(svg);
return;
}

if (url.pathname === "/mcp" || url.pathname === "/mcp/") {
setCorsHeaders(res);

Expand Down
3 changes: 3 additions & 0 deletions wrangler.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ main = "src/index.ts"
compatibility_date = "2025-01-29"
compatibility_flags = ["nodejs_compat"]

[assets]
directory = "./public"

# Your default GitHub PAT is stored as a secret (never in code)
# Run: npx wrangler secret put GITHUB_PAT
# Then paste your fine-grained token
Expand Down