@@ -19,6 +19,7 @@ export function describeWithAtlas(name: string, fn: IntegrationTestFunction): vo
1919 ...defaultTestConfig ,
2020 apiClientId : process . env . MDB_MCP_API_CLIENT_ID ,
2121 apiClientSecret : process . env . MDB_MCP_API_CLIENT_SECRET ,
22+ apiBaseUrl : process . env . MDB_MCP_API_BASE_URL ?? "https://cloud-dev.mongodb.com" ,
2223 } ) ,
2324 ( ) => defaultDriverOptions
2425 ) ;
@@ -39,6 +40,13 @@ export function withProject(integration: IntegrationTest, fn: ProjectTestFunctio
3940 beforeAll ( async ( ) => {
4041 const apiClient = integration . mcpServer ( ) . session . apiClient ;
4142
43+ // check that it has credentials
44+ if ( ! apiClient . hasCredentials ( ) ) {
45+ throw new Error ( "No credentials available" ) ;
46+ }
47+
48+ // validate access token
49+ await apiClient . validateAccessToken ( ) ;
4250 try {
4351 const group = await createProject ( apiClient ) ;
4452 projectId = group . id ;
@@ -111,5 +119,22 @@ async function createProject(apiClient: ApiClient): Promise<Group & Required<Pic
111119 throw new Error ( "Failed to create project" ) ;
112120 }
113121
122+ // add current IP to project access list
123+ const { currentIpv4Address } = await apiClient . getIpInfo ( ) ;
124+ await apiClient . createProjectIpAccessList ( {
125+ params : {
126+ path : {
127+ groupId : group . id ,
128+ } ,
129+ } ,
130+ body : [
131+ {
132+ ipAddress : currentIpv4Address ,
133+ groupId : group . id ,
134+ comment : "Added by MongoDB MCP Server to enable tool access" ,
135+ } ,
136+ ] ,
137+ } ) ;
138+
114139 return group as Group & Required < Pick < Group , "id" > > ;
115140}
0 commit comments