Skip to content

Add favicon support for both Cloudflare Workers and Node.js#4

Merged
MahammadNuriyev62 merged 3 commits intomasterfrom
claude/add-worker-icon-zFZYm
Feb 10, 2026
Merged

Add favicon support for both Cloudflare Workers and Node.js#4
MahammadNuriyev62 merged 3 commits intomasterfrom
claude/add-worker-icon-zFZYm

Conversation

@MahammadNuriyev62
Copy link
Copy Markdown
Owner

Summary

This PR adds favicon support to the MCP server, providing both ICO and SVG formats for better branding and user experience. The implementation works across both Cloudflare Workers and Node.js HTTP server environments.

Changes

  • New file: src/icon.ts - Contains icon assets:

    • ICON_SVG: An SVG favicon featuring a stylized eye/bracket design with dark background and light blue accent
    • ICON_ICO_BASE64: Base64-encoded ICO file with multiple resolutions (16x16, 32x32, 64x64 PNG images)
  • Updated src/index.ts (Cloudflare Workers):

    • Added favicon.ico endpoint that decodes base64 ICO data and returns it with appropriate caching headers
    • Added favicon.svg endpoint that serves the SVG icon with caching headers
    • Both endpoints use 24-hour cache control for performance
  • Updated src/main.ts (Node.js HTTP server):

    • Added matching favicon.ico endpoint using Node.js Buffer for base64 decoding
    • Added matching favicon.svg endpoint
    • Consistent caching strategy with Cloudflare Workers implementation

Implementation Details

  • Both favicon formats are served with Cache-Control: public, max-age=86400 for optimal caching
  • The ICO file is stored as base64 to keep it as a string constant in the codebase
  • SVG is stored as a raw string for easy modification
  • Endpoints are placed before the main MCP endpoint to ensure they're matched first
  • Implementation is identical across both server environments for consistency

https://claude.ai/code/session_01TF2N6ru2CZX9Uy4xdfBKgf

Serves the project icon at /favicon.ico (multi-size ICO) and /favicon.svg
so Google's favicon service can discover it for the MCP Directory listing.

https://claude.ai/code/session_01TF2N6ru2CZX9Uy4xdfBKgf
- Add public/favicon.ico and public/favicon.svg as actual files
- Cloudflare Worker: use [assets] in wrangler.toml for automatic static serving
- Node.js server: read favicon files from disk via fs.readFileSync
- Remove src/icon.ts (base64 blob no longer needed)

https://claude.ai/code/session_01TF2N6ru2CZX9Uy4xdfBKgf
@MahammadNuriyev62 MahammadNuriyev62 merged commit 946d0fa into master Feb 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants