Skip to content

Commit c4a44e0

Browse files
fix: Small changes from PR suggestions
1 parent 5afc312 commit c4a44e0

File tree

11 files changed

+32
-31
lines changed

11 files changed

+32
-31
lines changed

.github/workflows/code-health.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
- name: Run tests
3636
run: npm test
3737
env:
38+
SKIP_ATLAS_TESTS: "true"
3839
SKIP_ATLAS_LOCAL_TESTS: "true"
3940
- name: Upload test results
4041
if: always() && matrix.os == 'ubuntu-latest'

src/common/session.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,6 @@ export class Session extends EventEmitter<SessionEvents> {
101101
this.connectionManager.setClientName(this.mcpClient.name || "unknown");
102102
}
103103

104-
setAtlasLocalClient(atlasLocalClient: Client): void {
105-
this.atlasLocalClient = atlasLocalClient;
106-
}
107-
108104
async disconnect(): Promise<void> {
109105
const atlasCluster = this.connectedAtlasCluster;
110106

src/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ export class Server {
236236
const client = AtlasLocalClient.connect();
237237

238238
// Set Atlas Local client
239-
this.session.setAtlasLocalClient(client);
239+
this.session.atlasLocalClient = client;
240240

241241
// Register Atlas Local tools
242242
for (const toolConstructor of AtlasLocalTools) {

src/tools/atlasLocal/atlasLocalTool.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,14 @@ export abstract class AtlasLocalToolBase extends ToolBase {
1313
}
1414

1515
protected async execute(...args: Parameters<ToolCallback<typeof this.argsShape>>): Promise<CallToolResult> {
16-
// Get the client
1716
const client = this.session.atlasLocalClient;
1817

1918
// If the client is not found, throw an error
2019
// This should never happen:
2120
// - atlas-local tools are only added after the client is set
2221
// this means that if we were unable to get the client, the tool will not be registered
2322
// - in case the tool was registered by accident
24-
// verifyAllowed in the base class would still return false preventing the tool from being registered,
23+
// verifyAllowed would still return false preventing the tool from being registered,
2524
// preventing the tool from being executed
2625
if (!client) {
2726
return {

src/tools/atlasLocal/create/createDeployment.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export class CreateDeploymentTool extends AtlasLocalToolBase {
2222
type: "MCPServer" as CreationSourceType,
2323
source: "MCPServer",
2424
},
25+
doNotTrack: !this.telemetry.isTelemetryEnabled(),
2526
};
2627
// Create the deployment
2728
const deployment = await client.createDeployment(deploymentOptions);

tests/integration/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ export function waitUntil<T extends ConnectionState>(
377377
});
378378
}
379379

380-
export function waitUntilMcpClientIsSet(
380+
export function waitUntilAtlasLocalClientIsSet(
381381
mcpServer: Server,
382382
signal: AbortSignal,
383383
timeout: number = 5000

tests/integration/tools/atlas-local/connectDeployment.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
getResponseElements,
77
setupIntegrationTest,
88
validateToolMetadata,
9-
waitUntilMcpClientIsSet,
9+
waitUntilAtlasLocalClientIsSet,
1010
} from "../../helpers.js";
1111
import { afterEach, describe, expect, it } from "vitest";
1212

@@ -20,7 +20,7 @@ const integration = setupIntegrationTest(
2020
// That's why we skip the tests on macOS in GitHub Actions
2121
describe.skipIf(isMacOSInGitHubActions)("atlas-local-connect-deployment", () => {
2222
beforeEach(async ({ signal }) => {
23-
await waitUntilMcpClientIsSet(integration.mcpServer(), signal);
23+
await waitUntilAtlasLocalClientIsSet(integration.mcpServer(), signal);
2424
});
2525

2626
validateToolMetadata(integration, "atlas-local-connect-deployment", "Connect to a MongoDB Atlas Local deployment", [
@@ -57,7 +57,7 @@ describe.skipIf(isMacOSInGitHubActions)("atlas-local-connect-deployment with dep
5757
let deploymentNamesToCleanup: string[] = [];
5858

5959
beforeEach(async ({ signal }) => {
60-
await waitUntilMcpClientIsSet(integration.mcpServer(), signal);
60+
await waitUntilAtlasLocalClientIsSet(integration.mcpServer(), signal);
6161

6262
// Create deployments
6363
deploymentName = `test-deployment-1-${Date.now()}`;
@@ -105,7 +105,7 @@ describe.skipIf(isMacOSInGitHubActions)("atlas-local-connect-deployment with dep
105105
describe.skipIf(!isMacOSInGitHubActions)("atlas-local-connect-deployment [MacOS in GitHub Actions]", () => {
106106
it("should not have the atlas-local-connect-deployment tool", async ({ signal }) => {
107107
// This should throw an error because the client is not set within the timeout of 5 seconds (default)
108-
await expect(waitUntilMcpClientIsSet(integration.mcpServer(), signal)).rejects.toThrow();
108+
await expect(waitUntilAtlasLocalClientIsSet(integration.mcpServer(), signal)).rejects.toThrow();
109109

110110
const { tools } = await integration.mcpClient().listTools();
111111
const connectDeployment = tools.find((tool) => tool.name === "atlas-local-connect-deployment");

tests/integration/tools/atlas-local/createDeployment.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
expectDefined,
55
getResponseElements,
66
setupIntegrationTest,
7-
waitUntilMcpClientIsSet,
7+
waitUntilAtlasLocalClientIsSet,
88
} from "../../helpers.js";
99
import { afterEach, describe, expect, it } from "vitest";
1010

@@ -35,7 +35,7 @@ describe("atlas-local-create-deployment", () => {
3535
);
3636

3737
it.skipIf(isMacOSInGitHubActions)("should have the atlas-local-create-deployment tool", async ({ signal }) => {
38-
await waitUntilMcpClientIsSet(integration.mcpServer(), signal);
38+
await waitUntilAtlasLocalClientIsSet(integration.mcpServer(), signal);
3939

4040
const { tools } = await integration.mcpClient().listTools();
4141
const createDeployment = tools.find((tool) => tool.name === "atlas-local-create-deployment");
@@ -46,7 +46,7 @@ describe("atlas-local-create-deployment", () => {
4646
"[MacOS in GitHub Actions] should not have the atlas-local-create-deployment tool",
4747
async ({ signal }) => {
4848
// This should throw an error because the client is not set within the timeout of 5 seconds (default)
49-
await expect(waitUntilMcpClientIsSet(integration.mcpServer(), signal)).rejects.toThrow();
49+
await expect(waitUntilAtlasLocalClientIsSet(integration.mcpServer(), signal)).rejects.toThrow();
5050

5151
const { tools } = await integration.mcpClient().listTools();
5252
const createDeployment = tools.find((tool) => tool.name === "atlas-local-create-deployment");
@@ -55,7 +55,7 @@ describe("atlas-local-create-deployment", () => {
5555
);
5656

5757
it.skipIf(isMacOSInGitHubActions)("should have correct metadata", async ({ signal }) => {
58-
await waitUntilMcpClientIsSet(integration.mcpServer(), signal);
58+
await waitUntilAtlasLocalClientIsSet(integration.mcpServer(), signal);
5959
const { tools } = await integration.mcpClient().listTools();
6060
const createDeployment = tools.find((tool) => tool.name === "atlas-local-create-deployment");
6161
expectDefined(createDeployment);
@@ -65,7 +65,7 @@ describe("atlas-local-create-deployment", () => {
6565
});
6666

6767
it.skipIf(isMacOSInGitHubActions)("should create a deployment when calling the tool", async ({ signal }) => {
68-
await waitUntilMcpClientIsSet(integration.mcpServer(), signal);
68+
await waitUntilAtlasLocalClientIsSet(integration.mcpServer(), signal);
6969
const deploymentName = `test-deployment-${Date.now()}`;
7070

7171
// Check that deployment doesn't exist before creation
@@ -98,7 +98,7 @@ describe("atlas-local-create-deployment", () => {
9898
it.skipIf(isMacOSInGitHubActions)(
9999
"should return an error when creating a deployment that already exists",
100100
async ({ signal }) => {
101-
await waitUntilMcpClientIsSet(integration.mcpServer(), signal);
101+
await waitUntilAtlasLocalClientIsSet(integration.mcpServer(), signal);
102102

103103
// Create a deployment
104104
const deploymentName = `test-deployment-${Date.now()}`;
@@ -120,7 +120,7 @@ describe("atlas-local-create-deployment", () => {
120120
);
121121

122122
it.skipIf(isMacOSInGitHubActions)("should create a deployment with the correct name", async ({ signal }) => {
123-
await waitUntilMcpClientIsSet(integration.mcpServer(), signal);
123+
await waitUntilAtlasLocalClientIsSet(integration.mcpServer(), signal);
124124

125125
// Create a deployment
126126
const deploymentName = `test-deployment-${Date.now()}`;
@@ -148,7 +148,7 @@ describe("atlas-local-create-deployment", () => {
148148
});
149149

150150
it.skipIf(isMacOSInGitHubActions)("should create a deployment when name is not provided", async ({ signal }) => {
151-
await waitUntilMcpClientIsSet(integration.mcpServer(), signal);
151+
await waitUntilAtlasLocalClientIsSet(integration.mcpServer(), signal);
152152

153153
// Create a deployment
154154
const createResponse = await integration.mcpClient().callTool({

tests/integration/tools/atlas-local/deleteDeployment.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
expectDefined,
55
getResponseElements,
66
setupIntegrationTest,
7-
waitUntilMcpClientIsSet,
7+
waitUntilAtlasLocalClientIsSet,
88
} from "../../helpers.js";
99
import { describe, expect, it } from "vitest";
1010

@@ -19,7 +19,7 @@ describe("atlas-local-delete-deployment", () => {
1919
);
2020

2121
it.skipIf(isMacOSInGitHubActions)("should have the atlas-local-delete-deployment tool", async ({ signal }) => {
22-
await waitUntilMcpClientIsSet(integration.mcpServer(), signal);
22+
await waitUntilAtlasLocalClientIsSet(integration.mcpServer(), signal);
2323

2424
const { tools } = await integration.mcpClient().listTools();
2525
const deleteDeployment = tools.find((tool) => tool.name === "atlas-local-delete-deployment");
@@ -30,7 +30,7 @@ describe("atlas-local-delete-deployment", () => {
3030
"[MacOS in GitHub Actions] should not have the atlas-local-delete-deployment tool",
3131
async ({ signal }) => {
3232
// This should throw an error because the client is not set within the timeout of 5 seconds (default)
33-
await expect(waitUntilMcpClientIsSet(integration.mcpServer(), signal)).rejects.toThrow();
33+
await expect(waitUntilAtlasLocalClientIsSet(integration.mcpServer(), signal)).rejects.toThrow();
3434

3535
const { tools } = await integration.mcpClient().listTools();
3636
const deleteDeployment = tools.find((tool) => tool.name === "atlas-local-delete-deployment");
@@ -39,7 +39,7 @@ describe("atlas-local-delete-deployment", () => {
3939
);
4040

4141
it.skipIf(isMacOSInGitHubActions)("should have correct metadata", async ({ signal }) => {
42-
await waitUntilMcpClientIsSet(integration.mcpServer(), signal);
42+
await waitUntilAtlasLocalClientIsSet(integration.mcpServer(), signal);
4343
const { tools } = await integration.mcpClient().listTools();
4444
const deleteDeployment = tools.find((tool) => tool.name === "atlas-local-delete-deployment");
4545
expectDefined(deleteDeployment);
@@ -51,7 +51,7 @@ describe("atlas-local-delete-deployment", () => {
5151
it.skipIf(isMacOSInGitHubActions)(
5252
"should return 'no such container' error when deployment to delete does not exist",
5353
async ({ signal }) => {
54-
await waitUntilMcpClientIsSet(integration.mcpServer(), signal);
54+
await waitUntilAtlasLocalClientIsSet(integration.mcpServer(), signal);
5555
const deploymentName = "non-existent";
5656

5757
const response = await integration.mcpClient().callTool({
@@ -67,7 +67,7 @@ describe("atlas-local-delete-deployment", () => {
6767
);
6868

6969
it.skipIf(isMacOSInGitHubActions)("should delete a deployment when calling the tool", async ({ signal }) => {
70-
await waitUntilMcpClientIsSet(integration.mcpServer(), signal);
70+
await waitUntilAtlasLocalClientIsSet(integration.mcpServer(), signal);
7171
// Create a deployment
7272
const deploymentName = `test-deployment-${Date.now()}`;
7373
await integration.mcpClient().callTool({

tests/integration/tools/atlas-local/listDeployments.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
expectDefined,
55
getResponseElements,
66
setupIntegrationTest,
7-
waitUntilMcpClientIsSet,
7+
waitUntilAtlasLocalClientIsSet,
88
} from "../../helpers.js";
99
import { describe, expect, it } from "vitest";
1010

@@ -19,7 +19,7 @@ describe("atlas-local-list-deployments", () => {
1919
);
2020

2121
it.skipIf(isMacOSInGitHubActions)("should have the atlas-local-list-deployments tool", async ({ signal }) => {
22-
await waitUntilMcpClientIsSet(integration.mcpServer(), signal);
22+
await waitUntilAtlasLocalClientIsSet(integration.mcpServer(), signal);
2323

2424
const { tools } = await integration.mcpClient().listTools();
2525
const listDeployments = tools.find((tool) => tool.name === "atlas-local-list-deployments");
@@ -30,7 +30,7 @@ describe("atlas-local-list-deployments", () => {
3030
"[MacOS in GitHub Actions] should not have the atlas-local-list-deployments tool",
3131
async ({ signal }) => {
3232
// This should throw an error because the client is not set within the timeout of 5 seconds (default)
33-
await expect(waitUntilMcpClientIsSet(integration.mcpServer(), signal)).rejects.toThrow();
33+
await expect(waitUntilAtlasLocalClientIsSet(integration.mcpServer(), signal)).rejects.toThrow();
3434

3535
const { tools } = await integration.mcpClient().listTools();
3636
const listDeployments = tools.find((tool) => tool.name === "atlas-local-list-deployments");
@@ -39,7 +39,7 @@ describe("atlas-local-list-deployments", () => {
3939
);
4040

4141
it.skipIf(isMacOSInGitHubActions)("should have correct metadata", async ({ signal }) => {
42-
await waitUntilMcpClientIsSet(integration.mcpServer(), signal);
42+
await waitUntilAtlasLocalClientIsSet(integration.mcpServer(), signal);
4343
const { tools } = await integration.mcpClient().listTools();
4444
const listDeployments = tools.find((tool) => tool.name === "atlas-local-list-deployments");
4545
expectDefined(listDeployments);
@@ -49,7 +49,7 @@ describe("atlas-local-list-deployments", () => {
4949
});
5050

5151
it.skipIf(isMacOSInGitHubActions)("should not crash when calling the tool", async ({ signal }) => {
52-
await waitUntilMcpClientIsSet(integration.mcpServer(), signal);
52+
await waitUntilAtlasLocalClientIsSet(integration.mcpServer(), signal);
5353

5454
const response = await integration.mcpClient().callTool({
5555
name: "atlas-local-list-deployments",

0 commit comments

Comments
 (0)