Skip to content

Commit af09d94

Browse files
Merge pull request #2 from frankmeszaros/fm/v0
Connect Metrics
2 parents 7b030c5 + 3631999 commit af09d94

File tree

2 files changed

+16
-26
lines changed

2 files changed

+16
-26
lines changed

apps/cloudflare-one-casb/src/index.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,16 @@ import {
99
import { CloudflareMCPServer } from '@repo/mcp-common/src/server'
1010
import { registerAccountTools } from '@repo/mcp-common/src/tools/account'
1111

12+
import { MetricsTracker } from '../../../packages/mcp-observability/src'
1213
import { registerIntegrationsTools } from './tools/integrations'
1314

1415
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+
})
1522

1623
// Context from the auth process, encrypted & stored in the auth token
1724
// and provided to the DurableMCP as this.props
@@ -29,7 +36,7 @@ export class CASBMCP extends McpAgent<Env, State, Props> {
2936
})
3037

3138
async init() {
32-
registerAccountTools(this)
39+
registerAccountTools(this as unknown as CloudflareMcpAgent)
3340
registerIntegrationsTools(this)
3441
}
3542

@@ -66,7 +73,7 @@ export default new OAuthProvider({
6673
// @ts-ignore
6774
apiHandler: CASBMCP.mount('/sse'),
6875
// @ts-ignore
69-
defaultHandler: createAuthHandlers({ scopes: CloudflareOneCasbScopes }),
76+
defaultHandler: createAuthHandlers({ scopes: CloudflareOneCasbScopes, metrics }),
7077
authorizeEndpoint: '/oauth/authorize',
7178
tokenEndpoint: '/token',
7279
tokenExchangeCallback: (options) =>

pnpm-lock.yaml

Lines changed: 7 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)