Cloudflare MCP Logging
A template for deploying MCP servers as Cloudflare Workers with integrated LogPush and R2 storage for detailed execution logging. It enables remote tool execution and provides utilities for retrieving logs directly from Cloudflare R2 buckets.
README
Setup
- Start up container
docker compose up -d - Initialize package.json
-
npm init -y(First time to create package.json) -
npm install
-
MCP Server Creation
- Create from CF template
-
npm create cloudflare@latest -- mcp-logging --template=cloudflare/ai/demos/remote-mcp-authless - If clone template failed, git clone cloudflare/ai repo below, then recreate
git clone https://github.com/cloudflare/ai.git
-
- Start dev server
- Update to use
wrangler dev --ip 0.0.0.0IP in package.json - Port mapping
8787:8787in docker-compose.yml npm startORwrangler dev --ip 0.0.0.0- Access via
localhost:8787/sse
- Update to use
Deploy CF Worker
- Set CF account ID to wrangler.jsonc
"account_id": "<EDIT-HERE>" - Set CF API key in env
- API's permission template:
Edit Cloudflare Workers - ENV:
CLOUDFLARE_API_TOKEN=<EDIT-HERE>
- API's permission template:
- Deploy worker to CF
npm run deployORnpx wrangler deploy
MCP Inspector
- Start inspector
npx @modelcontextprotocol/inspector@latest
Connect via MCP Host/Client
-
mcp-remote
{ "mcpServers": { "CF Remote MCP": { "command": "npx", "args": [ "-y", "mcp-remote", "https://<MCP_SERVER_URL>/sse" ] } } } -
supergateway
{ "mcpServers": { "Basic Calculator": { "command": "npx", "args": [ "-y", "supergateway", "--sse", "http://localhost:8787/sse", "--header", "X-UserID:USERID_123", "--header", "X-SecretKey:SKEY_456" ] } } }
LogPush
- Enable
logpushfor CF worker- Set
"logpush": truein wrangler.jsonc - Deploy to CF & check settings
- Set
- Create R2 API token
- Create R2 bucket
- Create LogPush job
- Set env (edit the value)
R2_BUCKET_NAME="EDIT: R2 BUCKET NAME"
R2_LOG_BASE_PREFIX="EDIT: R2 FOLDER NAME"
CF_R2_ACCESS_KEY_ID="EDIT: R2 ACCESS KEY ID"
CF_R2_SECRET_ACCESS_KEY="EDIT: R2 ACCESS SECRET"
- Run
utils/download_r2_logs.jsscript to get logsnode utils/download_r2_logs.js --start-date "2025-06-27 07:00:00" --end-date "2025-06-27 08:00:00"
Pass Variable to Tool Function
-
Set
ctx.propsin fetch entrypoint.export default { fetch(request: Request, env: Env, ctx: ExecutionContext) { const userId: string | null = request.headers.get('X-UserID'); const secretKey: string | null = request.headers.get('X-SecretKey'); ctx.props = { userId, secretKey }; // add this -
Use
this.props.<VARIABLE_NAME>in tool.this.server.tool( "calculate", { operation: z.enum(["add", "subtract", "multiply", "divide"]), a: z.number(), b: z.number() }, async ({ operation, a, b,}) => { try { // retrieve here const userId: string | null = this.props.userId as string; const secretKey: string | null = this.props.secretKey as string;
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。