Skip to content

Commit 7a27749

Browse files
feat: Adds scaffolding for atlas-local tools MCP-155 (#498)
1 parent d1e0ee3 commit 7a27749

File tree

5 files changed

+25
-2
lines changed

5 files changed

+25
-2
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,10 @@ npx -y mongodb-mcp-server@latest --transport http --httpHost=0.0.0.0 --httpPort=
284284

285285
NOTE: atlas tools are only available when you set credentials on [configuration](#configuration) section.
286286

287+
#### MongoDB Atlas Local Tools
288+
289+
-
290+
287291
#### MongoDB Database Tools
288292

289293
- `connect` - Connect to a MongoDB instance

src/server.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
22
import type { Session } from "./common/session.js";
33
import type { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
44
import { AtlasTools } from "./tools/atlas/tools.js";
5+
import { AtlasLocalTools } from "./tools/atlasLocal/tools.js";
56
import { MongoDbTools } from "./tools/mongodb/tools.js";
67
import { Resources } from "./resources/resources.js";
78
import type { LogLevel } from "./common/logger.js";
@@ -193,7 +194,7 @@ export class Server {
193194
}
194195

195196
private registerTools(): void {
196-
for (const toolConstructor of [...AtlasTools, ...MongoDbTools]) {
197+
for (const toolConstructor of [...AtlasTools, ...AtlasLocalTools, ...MongoDbTools]) {
197198
const tool = new toolConstructor(this.session, this.userConfig, this.telemetry);
198199
if (tool.register(this)) {
199200
this.tools.push(tool);
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
2+
import type { ToolArgs, ToolCategory } from "../tool.js";
3+
import { ToolBase } from "../tool.js";
4+
5+
export abstract class AtlasLocalToolBase extends ToolBase {
6+
public category: ToolCategory = "atlas-local";
7+
8+
protected handleError(
9+
error: unknown,
10+
args: ToolArgs<typeof this.argsShape>
11+
): Promise<CallToolResult> | CallToolResult {
12+
// Error Handling for expected Atlas Local errors go here
13+
14+
// For other types of errors, use the default error handling from the base class
15+
return super.handleError(error, args);
16+
}
17+
}

src/tools/atlasLocal/tools.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const AtlasLocalTools = [];

src/tools/tool.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import type { Server } from "../server.js";
1212
export type ToolArgs<Args extends ZodRawShape> = z.objectOutputType<Args, ZodNever>;
1313

1414
export type OperationType = "metadata" | "read" | "create" | "delete" | "update" | "connect";
15-
export type ToolCategory = "mongodb" | "atlas";
15+
export type ToolCategory = "mongodb" | "atlas" | "atlas-local";
1616
export type TelemetryToolMetadata = {
1717
projectId?: string;
1818
orgId?: string;

0 commit comments

Comments
 (0)