Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
"node": "^20.19.0 || ^22.12.0 || >= 23.0.0"
},
"optionalDependencies": {
"@mongodb-js-preview/atlas-local": "^0.0.0-preview.1",
"@mongodb-js-preview/atlas-local": "^0.0.0-preview.2",
"kerberos": "^2.2.2"
}
}
9 changes: 6 additions & 3 deletions src/tools/atlasLocal/atlasLocalTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export abstract class AtlasLocalToolBase extends ToolBase {
return this.session.atlasLocalClient !== undefined && super.verifyAllowed();
}

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

Expand All @@ -35,10 +35,13 @@ please log a ticket here: https://github.com/mongodb-js/mongodb-mcp-server/issue
};
}

return this.executeWithAtlasLocalClient(client);
return this.executeWithAtlasLocalClient(client, ...args);
}

protected abstract executeWithAtlasLocalClient(client: Client): Promise<CallToolResult>;
protected abstract executeWithAtlasLocalClient(
client: Client,
...args: Parameters<ToolCallback<typeof this.argsShape>>
): Promise<CallToolResult>;

protected handleError(
error: unknown,
Expand Down
26 changes: 26 additions & 0 deletions src/tools/atlasLocal/delete/deleteDeployment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { z } from "zod";
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
import { AtlasLocalToolBase } from "../atlasLocalTool.js";
import type { OperationType, ToolArgs } from "../../tool.js";
import type { Client } from "@mongodb-js-preview/atlas-local";

export class DeleteDeploymentTool extends AtlasLocalToolBase {
public name = "atlas-local-delete-deployment";
protected description = "Delete a MongoDB Atlas local deployment";
public operationType: OperationType = "delete";
protected argsShape = {
deploymentName: z.string().describe("Name of the deployment to delete"),
};

protected async executeWithAtlasLocalClient(
client: Client,
{ deploymentName }: ToolArgs<typeof this.argsShape>
): Promise<CallToolResult> {
// Delete the deployment
await client.deleteDeployment(deploymentName);

return {
content: [{ type: "text", text: `Deployment "${deploymentName}" deleted successfully.` }],
};
}
}
3 changes: 2 additions & 1 deletion src/tools/atlasLocal/tools.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { DeleteDeploymentTool } from "./delete/deleteDeployment.js";
import { ListDeploymentsTool } from "./read/listDeployments.js";

export const AtlasLocalTools = [ListDeploymentsTool];
export const AtlasLocalTools = [ListDeploymentsTool, DeleteDeploymentTool];
Loading
Loading