Skip to content

Commit 0344e89

Browse files
committed
Move observability server to it's own subdomain
1 parent 5ba47c9 commit 0344e89

File tree

16 files changed

+77
-53
lines changed

16 files changed

+77
-53
lines changed

apps/sandbox-container/container/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import { Hono } from 'hono'
77
import { streamText } from 'hono/streaming'
88
import mime from 'mime'
99

10-
import { ExecParams, FilesWrite } from '../shared/schema.ts'
11-
import { get_file_name_from_path } from './fileUtils.ts'
10+
import { ExecParams, FilesWrite } from '../shared/schema'
11+
import { get_file_name_from_path } from './fileUtils'
1212

1313
import type { FileList } from '../shared/schema.ts'
1414

apps/sandbox-container/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"zod": "^3.24.2"
4141
},
4242
"devDependencies": {
43+
"@cloudflare/vitest-pool-workers": "0.8.14",
4344
"ai": "^4.3.6",
4445
"concurrently": "^9.1.2",
4546
"wrangler": "^4.9.1"

apps/sandbox-container/server/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ export type Props = {
3030
}
3131

3232
export default new OAuthProvider({
33-
apiRoute: '/workers/sandbox/sse',
33+
apiRoute: '/sse',
3434
// @ts-ignore
35-
apiHandler: ContainerMcpAgent.mount('/workers/sandbox/sse', { binding: 'CONTAINER_MCP_AGENT' }),
35+
apiHandler: ContainerMcpAgent.mount('/sse', { binding: 'CONTAINER_MCP_AGENT' }),
3636
// @ts-ignore
3737
defaultHandler: CloudflareAuthHandler,
3838
authorizeEndpoint: '/oauth/authorize',

apps/sandbox-container/worker-configuration.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ declare namespace Cloudflare {
99
CONTAINER_MCP_AGENT: DurableObjectNamespace<import("./server/index").ContainerMcpAgent>;
1010
CONTAINER_MANAGER: DurableObjectNamespace<import("./server/index").ContainerManager>;
1111
AI: Ai;
12+
ENVIRONMENT: string
1213
}
1314
}
1415
interface Env extends Cloudflare.Env {}

apps/sandbox-container/wrangler.jsonc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "node_modules/wrangler/config-schema.json",
3-
"name": "sandbox-container",
3+
"name": "sandbox-container-dev",
44
"main": "server/index.ts",
55
"compatibility_date": "2025-04-03",
66
"compatibility_flags": ["nodejs_compat"],
@@ -48,6 +48,7 @@
4848
},
4949
"vars": {
5050
"CLOUDFLARE_CLIENT_ID": "<PLACEHOLDER>",
51-
"CLOUDFLARE_CLIENT_SECRET": "<PLACEHOLDER>"
51+
"CLOUDFLARE_CLIENT_SECRET": "<PLACEHOLDER>",
52+
"ENVIRONMENT": "development"
5253
}
5354
}

apps/workers-bindings/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ export class WorkersBindingsMCP extends McpAgent<Env, WorkersBindingsMCPState, P
6262

6363
// Export the OAuth handler as the default
6464
export default new OAuthProvider({
65-
apiRoute: '/workers/bindings/sse',
65+
apiRoute: '/sse',
6666
// @ts-ignore
67-
apiHandler: WorkersBindingsMCP.mount('/workers/bindings/sse'),
67+
apiHandler: WorkersBindingsMCP.mount('/sse'),
6868
// @ts-ignore
6969
defaultHandler: CloudflareAuthHandler,
7070
authorizeEndpoint: '/oauth/authorize',

apps/workers-bindings/worker-configuration.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ declare namespace Cloudflare {
55
OAUTH_KV: KVNamespace;
66
CLOUDFLARE_CLIENT_ID: string;
77
CLOUDFLARE_CLIENT_SECRET: string;
8+
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
89
MCP_OBJECT: DurableObjectNamespace<import("./src/index").WorkersBindingsMCP>;
10+
ENVIRONMENT: string
911
}
1012
}
1113
interface Env extends Cloudflare.Env {}

apps/workers-bindings/wrangler.jsonc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55
{
66
"$schema": "node_modules/wrangler/config-schema.json",
7-
"name": "workers-bindings",
7+
"name": "workers-bindings-dev",
88
"main": "src/index.ts",
99
"compatibility_date": "2025-03-10",
1010
"compatibility_flags": ["nodejs_compat"],
@@ -33,6 +33,9 @@
3333
},
3434
"dev": {
3535
"port": 8976
36+
},
37+
"vars": {
38+
"ENVIRONMENT": "development"
3639
}
3740
/**
3841
* Smart Placement

apps/workers-observability/README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,8 @@ Once the Tools (under 🔨) show up in the interface, you can ask Claude to use
6969

7070
### For Local Development
7171

72-
If you'd like to iterate and test your MCP server, you can do so in local development. This will require you to create another OAuth App on GitHub:
72+
If you'd like to iterate and test your MCP server, you can do so in local development. This will require you to create another OAuth App on Cloudflare:
7373

74-
- For the Homepage URL, specify `http://localhost:8788`
75-
- For the Authorization callback URL, specify `http://localhost:8788/callback`
76-
- Note your Client ID and generate a Client secret.
7774
- Create a `.dev.vars` file in your project root with:
7875

7976
```
@@ -107,7 +104,7 @@ You can connect your MCP server to other MCP clients like Windsurf by opening th
107104
The OAuth Provider library serves as a complete OAuth 2.1 server implementation for Cloudflare Workers. It handles the complexities of the OAuth flow, including token issuance, validation, and management. In this project, it plays the dual role of:
108105

109106
- Authenticating MCP clients that connect to your server
110-
- Managing the connection to GitHub's OAuth services
107+
- Managing the connection to Cloudflare's OAuth services
111108
- Securely storing tokens and authentication state in KV storage
112109

113110
#### Durable MCP

apps/workers-observability/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
"devDependencies": {
2525
"@cloudflare/vitest-pool-workers": "0.8.14",
2626
"@cloudflare/workers-types": "4.20250410.0",
27-
"@types/jsonwebtoken": "9.0.9",
2827
"prettier": "3.5.3",
2928
"typescript": "5.5.4",
3029
"vitest": "3.0.9",

0 commit comments

Comments
 (0)