### Pages Functions - Get Started
Source: https://developers.cloudflare.com/llms.txt
Guides on how to get started with Pages Functions, including setup and basic usage.
```APIDOC
## Getting Started with Pages Functions
### Description
This guide provides the fundamental steps to begin using Pages Functions in your Cloudflare Pages projects.
### Method
N/A (This is a guide, not an executable endpoint)
### Endpoint
N/A
### Parameters
N/A
### Request Example
N/A
### Response
N/A
For detailed instructions, please consult the Cloudflare Pages documentation on getting started with Functions.
```
--------------------------------
### Hono Basic Setup and Route
Source: https://hono.dev/
This snippet demonstrates the basic setup of a Hono application and defines a simple GET route that returns a 'Hello Hono!' text response. It imports the Hono class and creates an app instance. This is a fundamental example for starting with Hono.
```javascript
import { Hono } from 'hono'
const app = new Hono()
app.get('/', (c) => c.text('Hello Hono!'))
export default app
```
--------------------------------
### Install and Start MCP Server using npm
Source: https://github.com/cloudflare/ai/tree/main/demos/mcp-client
This snippet shows how to install project dependencies and start the MCP server using npm. It's a common setup for Node.js projects. Ensure you have Node.js and npm installed before running these commands.
```shell
npm install
npm start
```
--------------------------------
### Start Server Setup in Node.js
Source: https://github.com/modelcontextprotocol/typescript-sdk
This JavaScript code snippet demonstrates how to start a server using a setup function. It defines the port and uses a .then() block to handle the server's listening process. If an error occurs during startup, it logs the error to the console. This is a standard pattern for initializing and running Node.js servers.
```javascript
// Start the server
const PORT = 3000;
setupServer().then(() => {
app.listen(PORT, (error) => {
if (error) {
console.error(
```
--------------------------------
### Realtime Agents API - Getting Started
Source: https://developers.cloudflare.com/llms.txt
This section provides guidance on deploying your first Realtime Agent using the CLI.
```APIDOC
## Realtime Agents API - Getting Started
### Description
Deploy your first Realtime Agent using the CLI.
### Method
Not specified (CLI-based)
### Endpoint
Not applicable (CLI-based)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
```bash
# Example CLI command (specific command not provided in source text)
cloudflare-cli realtime-agents deploy --agent-name my-first-agent
```
### Response
#### Success Response
Deployment status and confirmation.
#### Response Example
```json
{
"status": "success",
"message": "Realtime Agent 'my-first-agent' deployed successfully."
}
```
```
--------------------------------
### Get Started with Miniflare for Cloudflare Workers Testing
Source: https://developers.cloudflare.com/llms.txt
This guide provides instructions on getting started with Miniflare, a local simulator for Cloudflare Workers. It's essential for local development and testing of your Workers applications.
```plaintext
This section focuses on the initial steps for using Miniflare. Practical examples and setup instructions are available in the linked documentation.
```
--------------------------------
### WebAuthn API
Source: https://stytch.com/docs/guides/connected-apps/mcp-servers
API documentation for WebAuthn, covering getting started with the API and SDK.
```APIDOC
## WebAuthn API
### Description
This section provides API documentation for WebAuthn, including getting started with both the API and the SDK.
### Resources
- Getting started with the API: [/docs/guides/webauthn/api]
- Getting started with the SDK: [/docs/guides/webauthn/sdk]
```
--------------------------------
### Example Command Execution (Shell)
Source: https://modelcontextprotocol.io/quickstart/user
This example shows how to execute the filesystem server using Node.js's npx tool. The command includes flags for automatic confirmation and specifies the package to install and run, along with the directories it can access.
```bash
npx @modelcontextprotocol/server-filesystem -y /path/to/directory1 /path/to/username
```
--------------------------------
### Deploy Realtime Agent using CLI
Source: https://developers.cloudflare.com/llms.txt
This guide provides instructions on deploying your first Cloudflare Realtime Agent using the command-line interface (CLI). It outlines the necessary steps and commands to get started.
```bash
# Example CLI command to deploy a Realtime Agent
# Note: Actual command will vary based on the specific CLI tool and agent configuration.
# Refer to the official Cloudflare Realtime Agents documentation for exact commands.
# cloudflare-realtime agent deploy --name my-agent --config ./agent-config.yaml
```
--------------------------------
### Getting Started with REST API
Source: https://developers.cloudflare.com/llms.txt
Begin using the Cloudflare Workers AI REST API to deploy your first large language model (LLM) with step-by-step guidance.
```APIDOC
## Getting Started with REST API
### Description
This guide provides instructions on how to deploy a large language model (LLM) using the Cloudflare Workers AI REST API. It is designed for users new to the platform.
### Endpoint
[https://developers.cloudflare.com/workers-ai/get-started/rest-api/](https://developers.cloudflare.com/workers-ai/get-started/rest-api/)
### Usage
Follow the steps in the linked guide to set up and start using the Workers AI REST API.
```
--------------------------------
### Cloudflare Images - Overview
Source: https://developers.cloudflare.com/llms.txt
This section provides an overview of Cloudflare Images, its capabilities, and links to key resources such as demos, getting started guides, pricing, and the full API reference.
```APIDOC
## Cloudflare Images Overview
Cloudflare Images allows you to streamline your image infrastructure by efficiently storing, transforming, and delivering images using Cloudflare's global network.
### Key Resources:
- **Demos and Architectures:** [https://developers.cloudflare.com/images/demos/index.md](https://developers.cloudflare.com/images/demos/index.md)
- **Getting Started:** [https://developers.cloudflare.com/images/get-started/index.md](https://developers.cloudflare.com/images/get-started/index.md)
- **Images API Reference:** [https://developers.cloudflare.com/images/images-api/index.md](https://developers.cloudflare.com/images/images-api/index.md)
- **Pricing:** [https://developers.cloudflare.com/images/pricing/index.md](https://developers.cloudflare.com/images/pricing/index.md)
- **Examples:** [https://developers.cloudflare.com/images/examples/index.md](https://developers.cloudflare.com/images/examples/index.md)
```
--------------------------------
### JavaScript: Start and Handle Errors for Stateless HTTP Server
Source: https://github.com/modelcontextprotocol/typescript-sdk
This JavaScript code snippet demonstrates how to start a stateless HTTP server and handle potential errors during its setup or execution. It logs server status and exits with an error code if setup fails. This approach is suitable for simple API wrappers, RESTful scenarios, and horizontally scaled deployments.
```javascript
try {
// ... server setup code ...
console.log(`MCP Stateless Streamable HTTP Server listening on port ${PORT}`);
} catch (error) {
console.error('Failed to set up the server:', error);
process.exit(1);
}
process.exit(0);
```
--------------------------------
### Build Client
Source: https://modelcontextprotocol.io/quickstart/user
Get started building your own client that can integrate with all MCP servers.
```APIDOC
## Build Client
### Description
Get started building your own client that can integrate with all MCP servers.
### Method
GET
### Endpoint
/docs/develop/build-client
### Parameters
None
### Request Example
None
### Response
None
```
--------------------------------
### Example Prompt: Get HTML Content
Source: https://github.com/cloudflare/mcp-server-cloudflare/tree/main/apps/browser-rendering
This is an example prompt demonstrating how to request the HTML content of a specific URL using the available tools. It specifies the action and the target URL.
```text
Get the HTML content of https://example.com.
```
--------------------------------
### Build Server
Source: https://modelcontextprotocol.io/quickstart/user
Get started building your own server to use in Claude for Desktop and other clients.
```APIDOC
## Build Server
### Description
Get started building your own server to use in Claude for Desktop and other clients.
### Method
GET
### Endpoint
/docs/develop/build-server
### Parameters
None
### Request Example
None
### Response
None
```
--------------------------------
### Low-Level Server Setup with Request Handlers
Source: https://github.com/modelcontextprotocol/typescript-sdk
Illustrates setting up a low-level Server instance with custom request handlers for specific schemas using the @modelcontextprotocol/sdk. This includes defining handlers for listing and getting prompts, and connecting the server to a StdioServerTransport. The server is configured with prompt capabilities.
```javascript
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import {
ListPromptsRequestSchema,
GetPromptRequestSchema
} from "@modelcontextprotocol/sdk/types.js";
const server = new Server(
{
name: "example-server",
version: "1.0.0"
},
{
capabilities: {
prompts: {}
}
}
);
server.setRequestHandler(ListPromptsRequestSchema, async () => {
return {
prompts: [{
name: "example-prompt",
description: "An example prompt template",
arguments: [{
name: "arg1",
description: "Example argument",
required: true
}]
}]
};
});
server.setRequestHandler(GetPromptRequestSchema, async (request) => {
if (request.params.name !== "example-prompt") {
throw new Error("Unknown prompt");
}
return {
description: "Example prompt",
messages: [{
role: "user",
content: {
type: "text",
text: "Example prompt text"
}
}]
};
});
const transport = new StdioServerTransport();
await server.connect(transport);
```
--------------------------------
### Install GitHub MCP Server with Flexible Configuration
Source: https://docs.windsurf.com/windsurf/cascade/mcp
This configuration allows users to install the GitHub MCP server with any valid configuration, as long as the server ID matches the plugin store entry. This provides flexibility in setup while maintaining a defined server identity.
```json
{
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-p",
"3000:3000",
"--add-host=host.docker.internal:host-gateway",
"ghcr.io/cloudflare/cloudflared:latest",
"--proxy-dns",
"--proxy-dns-upstream",
"8.8.8.8:53",
"--proxy-dns-upstream",
"1.1.1.1:53",
"--url",
"http://localhost:3000",
"tunnel",
"--token",
"$TUNNEL_TOKEN"
]
}
```
--------------------------------
### Deploy Example MCP Server to Cloudflare
Source: https://developers.cloudflare.com/agents/guides/remote-mcp-server/
This snippet utilizes a 'Deploy to Workers' button to facilitate the deployment of an example MCP server to a Cloudflare account. It assumes the user has a Cloudflare account and provides a direct link for easy setup. The deployment configures a new git repository for automatic deployments.
```HTML
```
--------------------------------
### Install and Run Cloudflare Agents LLMs Locally
Source: https://github.com/cloudflare/ai/tree/main/demos/remote-mcp-server
This snippet provides the necessary shell commands to clone the Cloudflare AI repository, install its dependencies using pnpm, and start the local development server. It assumes a Unix-like environment and the presence of git and pnpm. The output is a running local server accessible at http://localhost:8787/.
```shell
# clone the repository
git clone https://github.com/cloudflare/ai.git
# Or if using ssh:
# git clone git@github.com:cloudflare/ai.git
# install dependencies
cd ai
# Note: using pnpm instead of just "npm"
pnpm install
# run locally
npx nx dev remote-mcp-server
```
--------------------------------
### Flexible LLM Server Installation using Environment Variables
Source: https://docs.windsurf.com/windsurf/cascade/mcp
This code snippet demonstrates how to configure environment variables for installing the GitHub MCP server with a flexible configuration. It allows for any valid server configuration provided the server ID matches the plugin store entry. This is useful for dynamic setups where specific token values might change.
```json
{
"rm": ",",
"-e": ","
},
{
"GITHUB_PERSONAL_ACCESS_TOKEN": ","
},
{
"ghcr.io/github/github-mcp-server": ","
},
{
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_your_token_here"
}
}
```
--------------------------------
### Durable Objects Examples
Source: https://developers.cloudflare.com/durable-objects/what-are-durable-objects/
Practical examples demonstrating how to implement various features with Durable Objects.
```APIDOC
## Durable Objects Examples
### Build a Rate Limiter
Example code for creating a rate limiter using Durable Objects.
### Build a Counter
Demonstration of how to build a distributed counter with Durable Objects.
### Build a WebSocket Server
Example of implementing a WebSocket server using Durable Objects.
### Build a WebSocket Server with WebSocket Hibernation
Advanced example for WebSocket servers with hibernation support.
### Durable Object In-memory State
Example showcasing the use of in-memory state within Durable Objects.
### Testing with Durable Objects
Code examples and guidance for testing applications that utilize Durable Objects.
```
--------------------------------
### Setup Pipeline
Source: https://developers.cloudflare.com/workers/wrangler/commands/
Initiates an interactive setup process for creating a complete pipeline.
```APIDOC
## POST /pipelines/setup
### Description
Interactive setup for a complete pipeline.
### Method
POST
### Endpoint
/pipelines/setup
### Parameters
#### Query Parameters
- **--name** (string) - Optional - Pipeline name.
### Request Example
```json
{
"--name": "interactive-pipeline"
}
```
### Response
#### Success Response (201)
- **message** (string) - Confirmation message for the setup process.
#### Response Example
```json
{
"message": "Pipeline setup initiated successfully."
}
```
```
--------------------------------
### Example Container Styling
Source: https://developers.cloudflare.com/agents/api-reference/rag/
Provides specific styling for elements intended to display examples. It ensures these containers have a distinct background, border, and are displayed as blocks, making example code or content visually separate from the main page.
```css
.example-container {
display: block !important;
background-color: var(--sl-color-bg) !important;
border-color: var(--sl-color-hairline) !important;
}
```
--------------------------------
### Recipes and Examples for Vitest Workers Integration
Source: https://developers.cloudflare.com/llms.txt
Explore various recipes and examples demonstrating how to write unit and integration tests for Cloudflare Workers using the Vitest integration. These examples cover common use cases and patterns.
```plaintext
This section provides practical examples for testing Workers with Vitest. Code snippets and usage scenarios are available in the linked documentation.
```
--------------------------------
### JavaScript Example
Source: https://developers.cloudflare.com/agents/api-reference/http-sse/
Example of implementing the `onRequest` method in JavaScript.
```APIDOC
## JavaScript Agent Example
### Description
This example demonstrates how to create an Agent class in JavaScript and implement the `onRequest` method to handle HTTP requests.
### Method
POST
### Endpoint
/
### Request Body
- **request** (Request) - Required - The incoming HTTP request object.
### Code
```javascript
class MyAgent extends Agent {
// Handle HTTP requests coming to this Agent instance
// Returns a Response object
async onRequest(request) {
return new Response("Hello from Agent!");
}
async callAIModel(prompt) {
// Implement AI model call here
}
}
```
```
--------------------------------
### Install NPM Globally
Source: https://modelcontextprotocol.io/quickstart/user
This command installs Node Package Manager (NPM) globally on your system. Global installation is often a prerequisite for using commands like `npx` successfully, especially when troubleshooting server startup issues.
```shell
npm install -g npm
```
--------------------------------
### Rust - Basic 'Hello World' Program
Source: https://modelcontextprotocol.io/docs/concepts/resources
This snippet demonstrates a simple 'Hello, world!' program in Rust. It includes the standard main function and the println! macro for output. This is a fundamental example for getting started with Rust programming.
```rust
fn main() {
println!("Hello world!");
}
```
--------------------------------
### Create Cloudflare Agents Starter Project
Source: https://github.com/cloudflare/agents-starter
Use npx to create a new Cloudflare project with the agents-starter template. This command initializes a new project directory with the necessary files and configurations for a Cloudflare Agent application.
```shell
npx create-cloudflare@latest --template cloudflare/agents-starter
```
--------------------------------
### Example User Configuration (JSON) - Basic
Source: https://docs.windsurf.com/windsurf/cascade/mcp
This JSON snippet demonstrates a basic user configuration for MCP, likely intended to match a specific server. It includes settings for the server ID, command, and arguments, illustrating how users can define their own server configurations.
```json
{
"server_id": "github-mcp-server",
"command": "mcp:command",
"args": [
"arg1",
"arg2"
]
}
```
--------------------------------
### Install Agents Package in Existing Project
Source: https://developers.cloudflare.com/agents
Command to install the 'agents' npm package into an existing Cloudflare Workers project. This allows you to integrate Agent functionality into your current setup.
```shell
npm i agents
```
--------------------------------
### Configure Filesystem Server for Claude Desktop (JSON)
Source: https://modelcontextprotocol.io/quickstart/user
This JSON configuration tells Claude Desktop to start the Filesystem Server using npx. It specifies the server package and the directories the server will have access to. Ensure you replace 'username' with your actual username and adjust directory paths as needed.
```json
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/Users/username/Desktop",
"/Users/username/Downloads"
]
}
}
}
```
--------------------------------
### Initialize and Deploy Agent Starter Template
Source: https://developers.cloudflare.com/agents
Commands to install the Agent starter template and deploy it using Wrangler. This is the initial step to create a new Agent project.
```shell
# install it
npm create cloudflare@latest agents-starter -- --template=cloudflare/agents-starter
# and deploy it
npx wrangler@latest deploy
```
--------------------------------
### JavaScript Server Setup and Prompt Handling with Cloudflare Agents LLM SDK
Source: https://github.com/modelcontextprotocol/typescript-sdk
This snippet shows how to set up a server using the Cloudflare Agents LLM SDK in JavaScript. It includes importing necessary modules, initializing the server with a name, version, and prompt capabilities, and defining handlers for 'ListPrompts' and 'GetPrompt' requests. The handlers return predefined prompt data and handle unknown prompts with an error. Finally, it connects the server to the StdioServerTransport.
```javascript
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import {
ListPromptsRequestSchema,
GetPromptRequestSchema
} from "@modelcontextprotocol/sdk/types.js";
const server = new Server(
{
name: "example-server",
version: "1.0.0"
},
{
capabilities: {
prompts: {}
}
}
);
server.setRequestHandler(ListPromptsRequestSchema, async () => {
return {
prompts: [{
name: "example-prompt",
description: "An example prompt template",
arguments: [{
name: "arg1",
description: "Example argument",
required: true
}]
}]
};
});
server.setRequestHandler(GetPromptRequestSchema, async (request) => {
if (request.params.name !== "example-prompt") {
throw new Error("Unknown prompt");
}
return {
description: "Example prompt",
messages: [{
role: "user",
content: {
type: "text",
text: "Example prompt text"
}
}]
};
});
const transport = new StdioServerTransport();
await server.connect(transport);
```
--------------------------------
### README - Project Overview
Source: https://github.com/cloudflare/mcp-server-cloudflare/tree/main/apps/browser-rendering
This README file provides an overview of the Cloudflare Browser Rendering MCP Server. It includes a title and a brief description of the project's purpose.
```markdown
# Cloudflare Browser Rendering MCP Server 📡
This project provides a server for rendering web pages using Cloudflare Workers.
```
--------------------------------
### Passwords API
Source: https://stytch.com/docs/guides/connected-apps/mcp-servers
API documentation for Passwords, including getting started with the API and SDK, and password strength policy.
```APIDOC
## Passwords API
### Description
This section provides API documentation for Passwords, covering getting started with the API and SDK, and information on password strength policies.
### Resources
- Getting started with the API: [/docs/guides/passwords/api]
- Getting started with the SDK: [/docs/guides/passwords/sdk]
- Password strength policy: [/docs/guides/passwords/strength-policy]
- Email verification before password creation: [/docs/guides/passwords/email-verification/before-password-creation]
- Email verification after password creation: [/docs/guides/passwords/email-verification/after-password-creation]
```
--------------------------------
### Embeddable Magic Links API
Source: https://stytch.com/docs/guides/connected-apps/mcp-servers
API documentation for Embeddable Magic Links, focusing on how to get started with the API.
```APIDOC
## Embeddable Magic Links API
### Description
This section provides API documentation for Embeddable Magic Links.
### Resources
- Getting started with the API: [/docs/guides/magic-links/embeddable-magic-links/api]
```
--------------------------------
### MCP Server Configuration Example (JSON)
Source: https://docs.windsurf.com/windsurf/cascade/mcp
An example of the mcp_config.json file, demonstrating how to configure an MCP server connection for GitHub. This JSON file specifies the command and arguments to run for the MCP server.
```json
{
"mcpServers": {
"github": {
"command": "npx",
"args": [
"-y",
```
--------------------------------
### Passkeys API
Source: https://stytch.com/docs/guides/connected-apps/mcp-servers
API documentation for Passkeys, including overview and setup with the frontend SDK.
```APIDOC
## Passkeys API
### Description
This section details the API for Passkeys, including an overview and instructions for setting up Passkeys with the frontend SDK.
### Resources
- Passkeys overview: [/docs/guides/passkeys/overview]
- Set up Passkeys with the frontend SDK: [/docs/guides/passkeys/login-sdk]
```
--------------------------------
### Resource Annotations Example
Source: https://modelcontextprotocol.io/docs/concepts/resources
Example JSON structure demonstrating resource annotations for audience, priority, and lastModified. These annotations provide hints to clients on how to use or display resources.
```json
{
"uri": "file:///project/README.md",
"name": "README.md",
"title": "Project Documentation",
"mimeType": "text/markdown",
"annotations": {
"audience": ["user"],
"priority": 0.8,
"lastModified": "2025-01-12T15:00:58Z"
}
}
```
--------------------------------
### Passcodes API
Source: https://stytch.com/docs/guides/connected-apps/mcp-servers
API documentation for Passcodes, including getting started with the API and SDK, and information on SMS toll fraud prevention.
```APIDOC
## Passcodes API
### Description
This section provides API documentation for Passcodes, covering getting started with the API and SDK, and resources related to SMS toll fraud prevention.
### Resources
- Getting started with the API: [/docs/guides/passcodes/api]
- Getting started with the SDK: [/docs/guides/passcodes/sdk]
- What is SMS toll fraud?: [/docs/guides/passcodes/toll-fraud/overview]
- How you can prevent toll fraud: [/docs/guides/passcodes/toll-fraud/guide]
- Unsupported countries: [/docs/guides/passcodes/unsupported-countries]
```
--------------------------------
### Hono Application Deployment on Cloudflare Workers
Source: https://developers.cloudflare.com/llms.txt
This guide explains how to create and deploy a Hono application to Cloudflare Workers with Workers Assets. It includes setup and publishing instructions.
```javascript
import { Hono } from 'hono'
const app = new Hono()
app.get('/', (c) => {
return c.text('Hello Hono!')
})
export default {
async fetch(request, env) {
return app.fetch(request)
}
}
```
--------------------------------
### Manually Run Filesystem Server (Windows)
Source: https://modelcontextprotocol.io/quickstart/user
This command manually initiates the Filesystem Server from the command line on Windows. It requires specifying the absolute paths for the directories the server should access. Ensure Node Package Manager (NPM) is installed.
```shell
npx -y @modelcontextprotocol/server-filesystem C:\Users\username\Desktop C:\Users\username\Downloads
```
--------------------------------
### Example Package JSON (JSON)
Source: https://github.com/cloudflare/mcp-server-cloudflare/tree/main/apps/autorag
This is a package.json file, which manages project dependencies and scripts for a Node.js project. It lists development dependencies like TypeScript, ESLint, and Vitest, along with build and test scripts.
```json
{
"name": "autorag",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "wrangler dev",
"start": "wrangler dev",
"build": "tsc",
"test": "vitest"
},
"dependencies": {
"@cloudflare/workers-types": "^4.0.0",
"wrangler": "^3.0.0"
},
"devDependencies": {
"@types/node": "^18.0.0",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
"eslint": "^8.0.0",
"eslint-config-prettier": "^8.0.0",
"prettier": "^2.0.0",
"typescript": "^5.0.0",
"vitest": "^1.0.0"
}
}
```
--------------------------------
### Connect to PostgreSQL Database with Cloudflare Workers
Source: https://developers.cloudflare.com/llms.txt
This guide explains how to establish a connection to a PostgreSQL database from Cloudflare Workers. It outlines the necessary setup and code to perform database operations.
```javascript
import postgres from 'postgres'
const sql = postgres({
host: env.PGHOST,
port: env.PGPORT,
database: env.PGDATABASE,
username: env.PGUSER,
password: env.PGPASSWORD
})
export default {
async fetch(request) {
try {
const users = await sql`SELECT * FROM users`
return new Response(JSON.stringify(users))
} catch (error) {
return new Response(JSON.stringify({ error: error.message }), {
status: 500
})
}
}
}
```
--------------------------------
### Filesystem Server Configuration (JSON)
Source: https://modelcontextprotocol.io/quickstart/user
This JSON snippet demonstrates the configuration for a filesystem server, including its friendly name, the command to run it, and the package name. It also specifies the directories the server is allowed to access.
```json
{
"filesystem": "friendly_server_name",
"command": "npx",
"-y": "",
"@modelcontextprotocol/server-filesystem": "",
"args": [
"/path/to/directory1",
"/path/to/username"
]
}
```
--------------------------------
### Worker-to-Worker Communication via RPC Bindings
Source: https://developers.cloudflare.com/llms.txt
This guide details how to enable Worker-to-Worker communication using RPC (Remote Procedure Call) Bindings. It outlines the setup for invoking functions in one Worker from another.
```javascript
// In Worker A
export default {
async fetch(request, env) {
const result = await env.RPC_WORKER.increment(1)
return new Response(String(result))
}
}
// In Worker B (RPC_WORKER)
import { exportrpc } from '@cloudflare/workers-types'
let count = 0
export default {
async fetch(request) {
return exportrpc('increment', async (value) => {
count += value
return count
})
}
}
```
--------------------------------
### MCP Configuration JSON Example
Source: https://docs.windsurf.com/windsurf/cascade/mcp
This JSON snippet demonstrates the structure of `mcp_config.json`, used to define servers that Cascade can connect to. It includes server details like commands and arguments, following a schema compatible with Claude Desktop configurations. This example specifically configures a server for GitHub.
```json
{
"mcpServers": {
"github": {
"command": "npx",
"args": [
]
}
}
}
```
--------------------------------
### Get Traffic Anomalies List
Source: https://github.com/cloudflare/mcp-server-cloudflare/tree/main/apps/radar
Lists traffic anomalies and outages, with filtering capabilities by AS, location, start date, and end date. This function helps identify unusual network traffic patterns.
```python
get_traffic_anomalies()
```
--------------------------------
### Manually Run Filesystem Server (macOS/Linux)
Source: https://modelcontextprotocol.io/quickstart/user
This command manually initiates the Filesystem Server from the command line on macOS or Linux. It requires specifying the absolute paths for the directories the server should access. Ensure Node Package Manager (NPM) is installed.
```shell
npx -y @modelcontextprotocol/server-filesystem /Users/username/Desktop /Users/username/Downloads
```
--------------------------------
### Run Cloudflare Inspector with Docker
Source: https://github.com/modelcontextprotocol/inspector
This command starts the Cloudflare inspector within a Docker container. It allows for isolated execution of the inspector tool. Ensure Docker is installed and running on your system.
```shell
docker run -p 6274:6274 @modelcontextprotocol/inspector
```
--------------------------------
### Range Query with Strings for Prefix Filtering
Source: https://developers.cloudflare.com/vectorize/reference/metadata-filtering/
This example illustrates how range queries can be used for prefix searching on string metadata. By setting '$gte' to 'net' and '$lt' to 'neu', it effectively filters for string values that start with 'net'.
```json
{
"someKey": { "$gte": "net", "$lt": "neu" }
}
```
--------------------------------
### HTML Structure for MCP Client Demo
Source: https://github.com/cloudflare/ai/tree/main/demos/mcp-client
This is the main HTML file (`index.html`) for the MCP Client demo. It sets up the basic structure of the web page, including meta tags, a title, and links to the application's styles and scripts. It serves as the entry point for the user interface of the AI agent.
```html