@@ -19,6 +19,7 @@ export function describeWithAtlas(name: string, fn: IntegrationTestFunction): vo
19
19
...defaultTestConfig ,
20
20
apiClientId : process . env . MDB_MCP_API_CLIENT_ID ,
21
21
apiClientSecret : process . env . MDB_MCP_API_CLIENT_SECRET ,
22
+ apiBaseUrl : process . env . MDB_MCP_API_BASE_URL ?? "https://cloud-dev.mongodb.com" ,
22
23
} ) ,
23
24
( ) => defaultDriverOptions
24
25
) ;
@@ -39,6 +40,13 @@ export function withProject(integration: IntegrationTest, fn: ProjectTestFunctio
39
40
beforeAll ( async ( ) => {
40
41
const apiClient = integration . mcpServer ( ) . session . apiClient ;
41
42
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 ( ) ;
42
50
try {
43
51
const group = await createProject ( apiClient ) ;
44
52
projectId = group . id ;
@@ -111,5 +119,22 @@ async function createProject(apiClient: ApiClient): Promise<Group & Required<Pic
111
119
throw new Error ( "Failed to create project" ) ;
112
120
}
113
121
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
+
114
139
return group as Group & Required < Pick < Group , "id" > > ;
115
140
}
0 commit comments