MCP server for Cloudflare Workers AI — LLM chat completions, text embeddings, and image generation for AI agents, with a generous free tier
This server demonstrates solid tool definition quality with well-documented tools and clear descriptions. All 4 tools have explicit registrations with input schemas and descriptions visible in src/index.ts. The naming is verb-forward and action-oriented (list_, chat_, embed_, generate_). Descriptions are substantial and context-aware, explaining WHEN to use each tool and what prerequisites exist. Parameter schemas are properly typed with Zod validation. However, there are gaps in error handling guidance, output schema documentation, and some missing parameter constraints (e.g., no enum for model names despite available options). The responses return structured text but lack formalized output schema documentation that would guide LLM planning.
Run an LLM chat completion using Cloudflare Workers AI. Use this tool when you need direct LLM inference with an explicit message list (system/user/assistant roles) — for example summarization, translation, Q&A, classification, or code generation. The request is sent to the Workers AI OpenAI-compatible endpoint and the full assistant reply is returned as a single text block together with the model id and finish reason. No streaming is performed. Requires CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN environment variables; costs are billed to your Cloudflare account (free tier available).
Generate numerical vector embeddings for one or more text inputs using Cloudflare Workers AI. Use this tool when you need semantic vector representations of text — for example similarity search, clustering, deduplication, or retrieval-augmented generation. Returns one embedding array (384-dimensional for BGE small, 768 for BGE base) per input text, in the same order as the inputs. Embeddings are generated by the native Workers AI endpoint and are deterministic for identical inputs. Requires CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN environment variables.
Generate an image from a text prompt using Cloudflare Workers AI (Flux 1 Schnell). Use this tool when the user asks for a picture, illustration, concept art, or visual asset — e.g. logos, scene descriptions, thumbnails, or design mockups. The image is generated by the Flux 1 Schnell model on Workers AI and returned as a base64-encoded string; decode it to obtain the image file (PNG or JPEG depending on the model output). Generation is asynchronous and typically takes a few seconds. Note: Cloudflare applies content moderation — prompts containing NSFW content are rejected with an error. Requires CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN environment variables.
Output schemas not formally documented. Tools return text responses with embedded metadata, but no structured schema is declared for downstream tool composition. LLMs cannot reliably extract fields like model_id, finish_reason, or embedding_arrays without parsing unstructured text.
Model parameters accept free-form strings instead of enums. chat_completion.model, embed_text.model, and generate_image lack enum constraints despite known, finite lists of valid models. This invites hallucinated model names and fails at runtime.
No error recovery guidance. Tool descriptions do not explain what to do if credentials are missing, the API fails, or a model is unsupported. Error messages from requireConfig() will throw but provide no fallback or retry strategy.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-23 | C | 61 | 2026-07-28+ | v2 |
List the Cloudflare Workers AI models supported by this server. Use this tool to discover available model ids before calling chat_completion, embed_text, or generate_image — it returns the complete catalog of chat models, embedding models, and image models with their roles. This tool does not call the Cloudflare API and works without credentials.
Numeric constraints missing. max_tokens and temperature in chat_completion lack min/max bounds in the schema. LLMs may pass temperature=100 or max_tokens=999999, both invalid for the Cloudflare API.
No idempotency or safety annotations. Tools that call external APIs (chat_completion, embed_text, generate_image) will incur costs and have side effects, but lack idempotentHint or destructiveHint annotations. LLMs cannot reason about retry safety.
embed_text returns JSON array as plain text. The response wraps embeddings in JSON.stringify(), but an LLM receiving a text block containing '[[-0.123, 0.456, ...]]' must parse it manually. Structured output with a proper embedding object (model, texts, embeddings array with count) would be more reliable.
generate_image returns base64 in text response without structure. The base64 string is embedded in a text block; there's no field marking it as binary or indicating format. Agents cannot reliably distinguish the encoded image from other text.
Parameter descriptions include example model names which LLMs may copy literally if not available. E.g., 'Available models: @cf/meta/llama-3.3-70b-instruct-fp8-fast' lists only examples; LLMs may assume these are the ONLY valid options and reject newer models.