Skip to content

Commit eecdf16

Browse files
committed
update
1 parent 67895cd commit eecdf16

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

tests/integration/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export function setupIntegrationTest(
8484
});
8585

8686
// Mock hasValidAccessToken for tests
87-
if (userConfig.apiClientId && userConfig.apiClientSecret) {
87+
if (!userConfig.apiClientId && !userConfig.apiClientSecret) {
8888
const mockFn = vi.fn().mockResolvedValue(true);
8989
session.apiClient.validateAccessToken = mockFn;
9090
}

tests/integration/tools/atlas/atlasHelpers.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,6 @@ export function withProject(integration: IntegrationTest, fn: ProjectTestFunctio
4242
try {
4343
const group = await createProject(apiClient);
4444
projectId = group.id;
45-
46-
// add current IP to project access list
47-
const { currentIpv4Address } = await apiClient.getIpInfo();
48-
await apiClient.createProjectIpAccessList({
49-
params: {
50-
path: {
51-
groupId: projectId,
52-
},
53-
},
54-
body: [
55-
{
56-
ipAddress: currentIpv4Address,
57-
groupId: projectId,
58-
comment: "Added by MongoDB MCP Server to enable tool access",
59-
},
60-
],
61-
});
6245
} catch (error) {
6346
console.error("Failed to create project:", error);
6447
throw error;
@@ -128,5 +111,22 @@ async function createProject(apiClient: ApiClient): Promise<Group & Required<Pic
128111
throw new Error("Failed to create project");
129112
}
130113

114+
// add current IP to project access list
115+
const { currentIpv4Address } = await apiClient.getIpInfo();
116+
await apiClient.createProjectIpAccessList({
117+
params: {
118+
path: {
119+
groupId: group.id,
120+
},
121+
},
122+
body: [
123+
{
124+
ipAddress: currentIpv4Address,
125+
groupId: group.id,
126+
comment: "Added by MongoDB MCP Server to enable tool access",
127+
},
128+
],
129+
});
130+
131131
return group as Group & Required<Pick<Group, "id">>;
132132
}

0 commit comments

Comments
 (0)