Skip to content

Commit cf39255

Browse files
committed
Cloning demo repo
1 parent ace3220 commit cf39255

File tree

9 files changed

+10351
-0
lines changed

9 files changed

+10351
-0
lines changed

examples/servers/cf-agents/.gitignore

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
# Logs
2+
3+
logs
4+
_.log
5+
npm-debug.log_
6+
yarn-debug.log*
7+
yarn-error.log*
8+
lerna-debug.log*
9+
.pnpm-debug.log*
10+
11+
# Diagnostic reports (https://nodejs.org/api/report.html)
12+
13+
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
14+
15+
# Runtime data
16+
17+
pids
18+
_.pid
19+
_.seed
20+
\*.pid.lock
21+
22+
# Directory for instrumented libs generated by jscoverage/JSCover
23+
24+
lib-cov
25+
26+
# Coverage directory used by tools like istanbul
27+
28+
coverage
29+
\*.lcov
30+
31+
# nyc test coverage
32+
33+
.nyc_output
34+
35+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
36+
37+
.grunt
38+
39+
# Bower dependency directory (https://bower.io/)
40+
41+
bower_components
42+
43+
# node-waf configuration
44+
45+
.lock-wscript
46+
47+
# Compiled binary addons (https://nodejs.org/api/addons.html)
48+
49+
build/Release
50+
51+
# Dependency directories
52+
53+
node_modules/
54+
jspm_packages/
55+
56+
# Snowpack dependency directory (https://snowpack.dev/)
57+
58+
web_modules/
59+
60+
# TypeScript cache
61+
62+
\*.tsbuildinfo
63+
64+
# Optional npm cache directory
65+
66+
.npm
67+
68+
# Optional eslint cache
69+
70+
.eslintcache
71+
72+
# Optional stylelint cache
73+
74+
.stylelintcache
75+
76+
# Microbundle cache
77+
78+
.rpt2_cache/
79+
.rts2_cache_cjs/
80+
.rts2_cache_es/
81+
.rts2_cache_umd/
82+
83+
# Optional REPL history
84+
85+
.node_repl_history
86+
87+
# Output of 'npm pack'
88+
89+
\*.tgz
90+
91+
# Yarn Integrity file
92+
93+
.yarn-integrity
94+
95+
# dotenv environment variable files
96+
97+
.env
98+
.env.development.local
99+
.env.test.local
100+
.env.production.local
101+
.env.local
102+
103+
# parcel-bundler cache (https://parceljs.org/)
104+
105+
.cache
106+
.parcel-cache
107+
108+
# Next.js build output
109+
110+
.next
111+
out
112+
113+
# Nuxt.js build / generate output
114+
115+
.nuxt
116+
dist
117+
118+
# Gatsby files
119+
120+
.cache/
121+
122+
# Comment in the public line in if your project uses Gatsby and not Next.js
123+
124+
# https://nextjs.org/blog/next-9-1#public-directory-support
125+
126+
# public
127+
128+
# vuepress build output
129+
130+
.vuepress/dist
131+
132+
# vuepress v2.x temp and cache directory
133+
134+
.temp
135+
.cache
136+
137+
# Docusaurus cache and generated files
138+
139+
.docusaurus
140+
141+
# Serverless directories
142+
143+
.serverless/
144+
145+
# FuseBox cache
146+
147+
.fusebox/
148+
149+
# DynamoDB Local files
150+
151+
.dynamodb/
152+
153+
# TernJS port file
154+
155+
.tern-port
156+
157+
# Stores VSCode versions used for testing VSCode extensions
158+
159+
.vscode-test
160+
161+
# yarn v2
162+
163+
.yarn/cache
164+
.yarn/unplugged
165+
.yarn/build-state.yml
166+
.yarn/install-state.gz
167+
.pnp.\*
168+
169+
# wrangler project
170+
171+
.dev.vars
172+
.wrangler/

examples/servers/cf-agents/README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Building a Remote MCP Server on Cloudflare (Without Auth)
2+
3+
This example allows you to deploy a remote MCP server that doesn't require authentication on Cloudflare Workers.
4+
5+
## Get started:
6+
7+
[![Deploy to Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/ai/tree/main/demos/remote-mcp-authless)
8+
9+
This will deploy your MCP server to a URL like: `remote-mcp-server-authless.<your-account>.workers.dev/sse`
10+
11+
Alternatively, you can use the command line below to get the remote MCP Server created on your local machine:
12+
```bash
13+
npm create cloudflare@latest -- my-mcp-server --template=cloudflare/ai/demos/remote-mcp-authless
14+
```
15+
16+
## Customizing your MCP Server
17+
18+
To add your own [tools](https://developers.cloudflare.com/agents/model-context-protocol/tools/) to the MCP server, define each tool inside the `init()` method of `src/index.ts` using `this.server.tool(...)`.
19+
20+
## Connect to Cloudflare AI Playground
21+
22+
You can connect to your MCP server from the Cloudflare AI Playground, which is a remote MCP client:
23+
24+
1. Go to https://playground.ai.cloudflare.com/
25+
2. Enter your deployed MCP server URL (`remote-mcp-server-authless.<your-account>.workers.dev/sse`)
26+
3. You can now use your MCP tools directly from the playground!
27+
28+
## Connect Claude Desktop to your MCP server
29+
30+
You can also connect to your remote MCP server from local MCP clients, by using the [mcp-remote proxy](https://www.npmjs.com/package/mcp-remote).
31+
32+
To connect to your MCP server from Claude Desktop, follow [Anthropic's Quickstart](https://modelcontextprotocol.io/quickstart/user) and within Claude Desktop go to Settings > Developer > Edit Config.
33+
34+
Update with this configuration:
35+
36+
```json
37+
{
38+
"mcpServers": {
39+
"calculator": {
40+
"command": "npx",
41+
"args": [
42+
"mcp-remote",
43+
"http://localhost:8787/sse" // or remote-mcp-server-authless.your-account.workers.dev/sse
44+
]
45+
}
46+
}
47+
}
48+
```
49+
50+
Restart Claude and you should see the tools become available.

examples/servers/cf-agents/biome.json

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/2.0.4/schema.json",
3+
"assist": {
4+
"actions": {
5+
"source": {
6+
"useSortedKeys": "on"
7+
}
8+
},
9+
"enabled": true
10+
},
11+
"files": {
12+
"includes": ["!worker-configuration.d.ts"]
13+
},
14+
"formatter": {
15+
"enabled": true,
16+
"indentWidth": 4,
17+
"lineWidth": 100
18+
},
19+
"linter": {
20+
"enabled": true,
21+
"rules": {
22+
"recommended": true,
23+
"style": {
24+
"noInferrableTypes": "error",
25+
"noNonNullAssertion": "off",
26+
"noParameterAssign": "error",
27+
"noUnusedTemplateLiteral": "error",
28+
"noUselessElse": "error",
29+
"useAsConstAssertion": "error",
30+
"useDefaultParameterLast": "error",
31+
"useEnumInitializers": "error",
32+
"useNumberNamespace": "error",
33+
"useSelfClosingElements": "error",
34+
"useSingleVarDeclarator": "error"
35+
},
36+
"suspicious": {
37+
"noConfusingVoidType": "off",
38+
"noDebugger": "off",
39+
"noExplicitAny": "off"
40+
}
41+
}
42+
},
43+
"root": false,
44+
"vcs": {
45+
"clientKind": "git",
46+
"enabled": true,
47+
"useIgnoreFile": true
48+
}
49+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "remote-mcp-server-authless",
3+
"version": "0.0.0",
4+
"private": true,
5+
"scripts": {
6+
"deploy": "wrangler deploy",
7+
"dev": "wrangler dev",
8+
"format": "biome format --write",
9+
"lint:fix": "biome lint --fix",
10+
"start": "wrangler dev",
11+
"cf-typegen": "wrangler types",
12+
"type-check": "tsc --noEmit"
13+
},
14+
"dependencies": {
15+
"@modelcontextprotocol/sdk": "^1.13.0",
16+
"zod": "^3.25.67"
17+
},
18+
"devDependencies": {
19+
"@biomejs/biome": "^2.0.4",
20+
"@types/node": "^24.0.7",
21+
"agents": "^0.0.100",
22+
"typescript": "^5.8.3",
23+
"wrangler": "^4.22.0"
24+
}
25+
}

0 commit comments

Comments
 (0)