@@ -14,7 +14,6 @@ import { ContainerManager } from './containerManager'
1414import { ContainerMcpAgent } from './containerMcp'
1515import { UserContainer } from './userContainer'
1616
17- import type { McpAgent } from 'agents/mcp'
1817import type { AuthProps } from '@repo/mcp-common/src/cloudflare-oauth-handler'
1918import type { Env } from './context'
2019
@@ -40,30 +39,16 @@ const ContainerScopes = {
4039
4140export default {
4241 fetch : async ( req : Request , env : Env , ctx : ExecutionContext ) => {
43- // @ts -ignore
44- if ( env . ENVIRONMENT === 'test' ) {
45- ctx . props = {
46- accessToken : 'foobar' ,
47- user : {
48- id : '123def' ,
49- 50- } ,
51- accounts : [ ] ,
52- } as Props
53- return ContainerMcpAgent . mount ( '/sse' , { binding : 'CONTAINER_MCP_AGENT' } ) . fetch (
54- req ,
55- env as Record < string , DurableObjectNamespace < McpAgent > | any > ,
56- ctx
57- )
58- }
59-
60- if ( env . ENVIRONMENT === 'dev' && env . DEV_DISABLE_OAUTH === 'true' ) {
42+ if (
43+ ( env . ENVIRONMENT === 'dev' || env . ENVIRONMENT === 'test' ) &&
44+ env . DEV_DISABLE_OAUTH === 'true'
45+ ) {
6146 return await handleDevMode ( ContainerMcpAgent , req , env , ctx )
6247 }
6348
6449 return new OAuthProvider ( {
6550 apiRoute : [ '/mcp' , '/sse' ] ,
66- apiHandler : createApiHandler ( ContainerMcpAgent , { binding : 'CONTAINER_MCP_AGENT' } ) ,
51+ apiHandler : createApiHandler ( ContainerMcpAgent ) ,
6752 // @ts -ignore
6853 defaultHandler : createAuthHandlers ( { scopes : ContainerScopes , metrics } ) ,
6954 authorizeEndpoint : '/oauth/authorize' ,
0 commit comments