firefox-relay-mcp

firefox-relay-mcp

Enables managing Firefox Relay masks (random and domain) via MCP tools, including listing, creating, updating, and disabling masks.

Category
访问服务器

README

Firefox Relay MCP Gateway

CI License: MIT

Stateless Streamable HTTP MCP gateway for Firefox Relay, built for Cloudflare Workers.

Features

  • Stateless remote MCP server for Firefox Relay
  • OAuth Authorization Code + PKCE (S256) for MCP clients
  • Encrypted Firefox Relay API key envelope inside signed JWT artifacts
  • Streamable HTTP MCP endpoint at /mcp
  • Random mask list/create/update/disable operations
  • Optional custom-domain mask listing when the Relay account supports it

Requirements

  • Node.js 20+
  • npm
  • Cloudflare account with Wrangler authentication
  • A Firefox Relay account with an API key

Connector values

MCP Server URL: https://your-worker.example.com/mcp
Authorization server base URL: https://your-worker.example.com
Resource: https://your-worker.example.com/mcp

What it does

  • Exposes MCP Streamable HTTP at /mcp
  • Acts as its own OAuth Authorization Server for remote MCP clients
  • Collects a user-provided Firefox Relay API key during OAuth consent
  • Encrypts that API key into signed JWT artifacts and does not store it in a database
  • Lets MCP clients list, create, update, and disable Firefox Relay masks

Firefox Relay API key

Users can find the Firefox Relay API key in Firefox Relay under profile icon → Settings.

Supported MCP tools

  • relay_list_random_masks
  • relay_create_random_mask
  • relay_update_random_mask
  • relay_disable_random_mask
  • relay_list_domain_masks

Install

npm install

Quick start

  1. Install dependencies.
  2. Set Worker secrets.
  3. Configure non-secret vars in wrangler.toml or via deploy-time environment overrides.
  4. Run npm run dev for local testing.
  5. Run npm test and npm run typecheck.
  6. Deploy with npm run deploy.

Configure non-secret Worker vars

Update wrangler.toml or your deployment environment with:

  • OAUTH_ISSUER
  • MCP_RESOURCE
  • MCP_AUDIENCE
  • OAUTH_REDIRECT_HTTPS_HOSTS
  • RELAY_DEFAULT_BASE_URL
  • ACCESS_TOKEN_DEFAULT_TTL_DAYS
  • ACCESS_TOKEN_MAX_TTL_DAYS
  • AUTH_CODE_TTL_SECONDS

For public release, wrangler.toml intentionally uses placeholder URLs. Set these to your real deployment values before production deploys:

  • OAUTH_ISSUER=https://your-worker.example.com
  • MCP_RESOURCE=https://your-worker.example.com/mcp
  • MCP_AUDIENCE=https://your-worker.example.com/mcp

Set Worker secrets

Generate and pipe each secret directly into Wrangler:

openssl rand -base64 48 | tr -d '\n' | wrangler secret put OAUTH_JWT_SIGNING_KEY_B64
openssl rand -base64 32 | tr -d '\n' | wrangler secret put UPSTREAM_CONFIG_ENC_KEY_B64
openssl rand -base64 48 | tr -d '\n' | wrangler secret put CSRF_SIGNING_KEY_B64

Deploy sequence

If you do not know the final public Worker URL yet, use this order:

  1. Bootstrap deploy once to get the real workers.dev URL.
  2. Set the three Worker secrets.
  3. Redeploy with real OAUTH_ISSUER, MCP_RESOURCE, and MCP_AUDIENCE values.

Run locally

npm run dev

Validate

npm test
npm run typecheck

Deploy

npm run deploy

Public connector values

After deployment, configure remote MCP clients with:

MCP Server URL: https://your-worker.example.com/mcp
Authorization server base URL: https://your-worker.example.com
Resource: https://your-worker.example.com/mcp

OAuth and stateless design summary

  • /register issues deterministic public client_id values for allowlisted redirect URIs
  • /authorize validates PKCE S256, renders consent, validates the Firefox Relay API key, and issues a short-lived signed auth-code JWT
  • /token exchanges the auth code for bearer access and refresh JWTs
  • JWTs carry an AES-GCM encrypted Relay config envelope; plaintext credentials are never persisted server-side
  • /mcp verifies the access token, decrypts the Relay config, creates a fresh Worker-safe MCP server and transport, and serves the request

Stateless caveats

  • Auth codes are not one-time-use across all isolates because no server-side state is stored
  • Refresh tokens cannot be globally revoked without a stateful primitive
  • Strict global rate limiting requires Durable Objects, KV, or Cloudflare-managed rate limiting

Manual smoke test notes

  1. Register a client with an allowlisted redirect URI.
  2. Complete /authorize with a Firefox Relay API key.
  3. Exchange the returned code at /token.
  4. Call /mcp with the returned bearer token.
  5. Confirm tools list and successful mask operations.

Privacy and security notes

  • The Worker encrypts the Firefox Relay API key into MCP JWT artifacts and does not store it in a database.
  • The Worker is designed to avoid logging API keys, bearer tokens, decrypted envelopes, cookies, or CSRF tokens.
  • Upstream Relay errors are sanitized before they are returned to MCP clients.

Known limitations

  • Auth codes are not globally one-time-use without stateful storage.
  • Refresh tokens cannot be globally revoked without stateful storage.
  • Strict global rate limiting requires Durable Objects, KV, or a Cloudflare-managed alternative.
  • Domain-mask behavior depends on account capabilities and may require Relay premium/custom-domain support.

Project docs

  • docs/PRODUCT_REQUIREMENTS.md
  • docs/IMPLEMENTATION_PLAN.md
  • docs/PROJECT_STATE.md
  • docs/DECISIONS.md
  • docs/RUNBOOK.md

Contributing

See CONTRIBUTING.md.

Security

See SECURITY.md.

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选