diff --git a/package-lock.json b/package-lock.json index 8775fc6..4e06f60 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0", "dependencies": { "@modelcontextprotocol/sdk": "^1.25.2", - "agents": "^0.3.10", + "agents": "0.3.10", "zod": "^3.23.0" }, "bin": { diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..c04a123 Binary files /dev/null and b/public/favicon.ico differ diff --git a/public/favicon.svg b/public/favicon.svg new file mode 100644 index 0000000..b607b57 --- /dev/null +++ b/public/favicon.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/main.ts b/src/main.ts index cff898f..d1ec179 100644 --- a/src/main.ts +++ b/src/main.ts @@ -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); @@ -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); diff --git a/wrangler.toml b/wrangler.toml index 44939ad..14346e4 100644 --- a/wrangler.toml +++ b/wrangler.toml @@ -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