@@ -14,13 +14,12 @@ import type { AccountSchema, UserSchema } from '@repo/mcp-common/src/cloudflare-
1414
1515export { ContainerManager , ContainerMcpAgent }
1616
17- export type Env = {
18- CONTAINER_MCP_AGENT : DurableObjectNamespace < ContainerMcpAgent >
19- CONTAINER_MANAGER : DurableObjectNamespace < ContainerManager >
20- ENVIRONMENT : 'dev' | 'prod' | 'test'
21- CLOUDFLARE_CLIENT_ID : string
22- CLOUDFLARE_CLIENT_SECRET : string
23- }
17+ import { MetricsTracker } from "@repo/mcp-observability"
18+
19+ const metrics = new MetricsTracker ( env . MCP_METRICS , {
20+ name : env . MCP_SERVER_NAME ,
21+ version : env . MCP_SERVER_VERSION
22+ } )
2423
2524// Context from the auth process, encrypted & stored in the auth token
2625// and provided to the DurableMCP as this.props
@@ -41,6 +40,7 @@ const ContainerScopes = {
4140
4241export default {
4342 fetch : ( req : Request , env : Env , ctx : ExecutionContext ) => {
43+ // @ts -ignore
4444 if ( env . ENVIRONMENT === 'test' ) {
4545 ctx . props = { }
4646 return ContainerMcpAgent . mount ( '/sse' , { binding : 'CONTAINER_MCP_AGENT' } ) . fetch (
@@ -55,7 +55,7 @@ export default {
5555 // @ts -ignore
5656 apiHandler : ContainerMcpAgent . mount ( '/sse' , { binding : 'CONTAINER_MCP_AGENT' } ) ,
5757 // @ts -ignore
58- defaultHandler : createAuthHandlers ( { scopes : ContainerScopes } ) ,
58+ defaultHandler : createAuthHandlers ( { scopes : ContainerScopes , metrics } ) ,
5959 authorizeEndpoint : '/oauth/authorize' ,
6060 tokenEndpoint : '/token' ,
6161 tokenExchangeCallback : ( options ) =>
0 commit comments