@@ -9,9 +9,16 @@ import {
9
9
import { CloudflareMCPServer } from '@repo/mcp-common/src/server'
10
10
import { registerAccountTools } from '@repo/mcp-common/src/tools/account'
11
11
12
+ import { MetricsTracker } from '../../../packages/mcp-observability/src'
12
13
import { registerIntegrationsTools } from './tools/integrations'
13
14
14
15
import type { AccountSchema , UserSchema } from '@repo/mcp-common/src/cloudflare-oauth-handler'
16
+ import type { CloudflareMcpAgent } from '@repo/mcp-common/src/types/cloudflare-mcp-agent'
17
+
18
+ const metrics = new MetricsTracker ( env . MCP_METRICS , {
19
+ name : env . MCP_SERVER_NAME ,
20
+ version : env . MCP_SERVER_VERSION ,
21
+ } )
15
22
16
23
// Context from the auth process, encrypted & stored in the auth token
17
24
// and provided to the DurableMCP as this.props
@@ -29,7 +36,7 @@ export class CASBMCP extends McpAgent<Env, State, Props> {
29
36
} )
30
37
31
38
async init ( ) {
32
- registerAccountTools ( this )
39
+ registerAccountTools ( this as unknown as CloudflareMcpAgent )
33
40
registerIntegrationsTools ( this )
34
41
}
35
42
@@ -66,7 +73,7 @@ export default new OAuthProvider({
66
73
// @ts -ignore
67
74
apiHandler : CASBMCP . mount ( '/sse' ) ,
68
75
// @ts -ignore
69
- defaultHandler : createAuthHandlers ( { scopes : CloudflareOneCasbScopes } ) ,
76
+ defaultHandler : createAuthHandlers ( { scopes : CloudflareOneCasbScopes , metrics } ) ,
70
77
authorizeEndpoint : '/oauth/authorize' ,
71
78
tokenEndpoint : '/token' ,
72
79
tokenExchangeCallback : ( options ) =>
0 commit comments