Skip to content

Commit c82ea1a

Browse files
committed
feat: add r2 tools to bindings mcp
1 parent 7d6a3e4 commit c82ea1a

File tree

5 files changed

+1106
-34
lines changed

5 files changed

+1106
-34
lines changed

apps/workers-bindings/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
"check:lint": "run-eslint-workers",
77
"check:types": "run-tsc",
88
"deploy": "wrangler deploy",
9+
"deploy:staging": "wrangler deploy --env staging",
10+
"deploy:production": "wrangler deploy --env production",
911
"dev": "wrangler dev",
1012
"start": "wrangler dev",
1113
"types": "wrangler types",

apps/workers-bindings/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
} from '@repo/mcp-common/src/cloudflare-oauth-handler'
1010
import { registerAccountTools } from '@repo/mcp-common/src/tools/account'
1111
import { registerKVTools } from '@repo/mcp-common/src/tools/kv_namespace'
12+
import { registerR2BucketTools } from '@repo/mcp-common/src/tools/r2_bucket'
1213
import { registerWorkersTools } from '@repo/mcp-common/src/tools/worker'
1314

1415
import type { AccountSchema, UserSchema } from '@repo/mcp-common/src/cloudflare-oauth-handler'
@@ -37,6 +38,7 @@ export class WorkersBindingsMCP extends McpAgent
3738
registerAccountTools(this)
3839
registerKVTools(this)
3940
registerWorkersTools(this)
41+
registerR2BucketTools(this)
4042
}
4143
getActiveAccountId() {
4244
// TODO: Figure out why this fail sometimes, and why we need to wrap this in a try catch

apps/workers-bindings/wrangler.jsonc

Lines changed: 48 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -36,39 +36,53 @@
3636
},
3737
"vars": {
3838
"ENVIRONMENT": "development"
39+
},
40+
"workers_dev": false,
41+
"preview_urls": false,
42+
"env": {
43+
"staging": {
44+
"name": "mcp-cloudflare-workers-bindings-staging",
45+
"account_id": "8995c0f49cdcf57eb54d2c1e52b7d2f3",
46+
"routes": [{ "pattern": "bindings-staging.mcp.cloudflare.com", "custom_domain": true }],
47+
"durable_objects": {
48+
"bindings": [
49+
{
50+
"class_name": "WorkersBindingsMCP",
51+
"name": "MCP_OBJECT"
52+
}
53+
]
54+
},
55+
"kv_namespaces": [
56+
{
57+
"binding": "OAUTH_KV",
58+
"id": "18e839155d00407095d793dcf7e78f25"
59+
}
60+
],
61+
"vars": {
62+
"ENVIRONMENT": "staging"
63+
}
64+
},
65+
"production": {
66+
"name": "mcp-cloudflare-workers-bindings-production",
67+
"account_id": "8995c0f49cdcf57eb54d2c1e52b7d2f3",
68+
"routes": [{ "pattern": "bindings.mcp.cloudflare.com", "custom_domain": true }],
69+
"durable_objects": {
70+
"bindings": [
71+
{
72+
"class_name": "WorkersBindingsMCP",
73+
"name": "MCP_OBJECT"
74+
}
75+
]
76+
},
77+
"kv_namespaces": [
78+
{
79+
"binding": "OAUTH_KV",
80+
"id": "f9782295993747df90c29c45ca89edb1"
81+
}
82+
],
83+
"vars": {
84+
"ENVIRONMENT": "production"
85+
}
86+
}
3987
}
40-
/**
41-
* Smart Placement
42-
* Docs: https://developers.cloudflare.com/workers/configuration/smart-placement/#smart-placement
43-
*/
44-
// "placement": { "mode": "smart" },
45-
46-
/**
47-
* Bindings
48-
* Bindings allow your Worker to interact with resources on the Cloudflare Developer Platform, including
49-
* databases, object storage, AI inference, real-time communication and more.
50-
* https://developers.cloudflare.com/workers/runtime-apis/bindings/
51-
*/
52-
53-
/**
54-
* Environment Variables
55-
* https://developers.cloudflare.com/workers/wrangler/configuration/#environment-variables
56-
*/
57-
// "vars": { "MY_VARIABLE": "production_value" },
58-
/**
59-
* Note: Use secrets to store sensitive data.
60-
* https://developers.cloudflare.com/workers/configuration/secrets/
61-
*/
62-
63-
/**
64-
* Static Assets
65-
* https://developers.cloudflare.com/workers/static-assets/binding/
66-
*/
67-
// "assets": { "directory": "./public/", "binding": "ASSETS" },
68-
69-
/**
70-
* Service Bindings (communicate between multiple Workers)
71-
* https://developers.cloudflare.com/workers/wrangler/configuration/#service-bindings
72-
*/
73-
// "services": [{ "binding": "MY_SERVICE", "service": "my-service" }]
7488
}

0 commit comments

Comments
 (0)