Cloudflare Guide¶
This guide shows Cloudflare MCP direct usage and HTTP bridge usage.
What Code Mode Is (short intro)¶
Code Mode is a code-first MCP usage pattern where the model works through a small tool surface (often discovery + execution) and generates code for multi-step actions.
Related references:
- Cloudflare MCP Code Mode blog:
https://blog.cloudflare.com/code-mode-mcp/ - UTCP Code Mode implementation:
https://github.com/universal-tool-calling-protocol/code-mode
Fit for Cloudflare Users¶
Cloudflare users often have a two tool pattern:
- search tool for capability discovery
- execute tool for running code
SuperCodeMode improves the client side text that decides when to use each tool.
Option A: Cloudflare MCP Direct¶
Use the public MCP endpoint:
https://mcp.cloudflare.com/mcp
Run showcase:
Run optimization:
Override endpoint if needed:
Expected Demo Output¶
For the current Cloudflare demo dataset, a run can show:
- first case uses
searchand returns JSON tool metadata - second case uses
executeand returns{"result": 42} - average score can be
0.5
This is expected with the current metric. The first example currently checks for
the literal word search in final_answer, but Cloudflare may return structured
JSON without that word. In that case integration is still working if:
selected_tool=searchfor case 1selected_tool=executefor case 2- case 2 returns
42
Option B: HTTP Bridge¶
Use this when you run your own bridge service.
Request fields expected by the bridge:
user_querysystem_promptcodemode_descriptiontool_alias_maptool_description_overridesadditional_context
Response fields:
final_answergenerated_codeselected_tooltool_callslogserror
Run showcase:
Run optimization:
Save artifact:
Why This Is Valuable Without Server Side Auto Optimization¶
You still get strong gains by improving:
- tool routing text
- planning instructions
- output consistency
- tool call quality
Server code can remain unchanged while client policy gets better.
For a detailed GEPA explanation, read guides/gepa-adapter.md.