diff --git a/README.md b/README.md index d508b755..96ad4333 100644 --- a/README.md +++ b/README.md @@ -284,6 +284,10 @@ npx -y mongodb-mcp-server@latest --transport http --httpHost=0.0.0.0 --httpPort= NOTE: atlas tools are only available when you set credentials on [configuration](#configuration) section. +#### MongoDB Atlas Local Tools + +- + #### MongoDB Database Tools - `connect` - Connect to a MongoDB instance diff --git a/src/server.ts b/src/server.ts index ded91618..006dc7cd 100644 --- a/src/server.ts +++ b/src/server.ts @@ -2,6 +2,7 @@ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import type { Session } from "./common/session.js"; import type { Transport } from "@modelcontextprotocol/sdk/shared/transport.js"; import { AtlasTools } from "./tools/atlas/tools.js"; +import { AtlasLocalTools } from "./tools/atlasLocal/tools.js"; import { MongoDbTools } from "./tools/mongodb/tools.js"; import { Resources } from "./resources/resources.js"; import type { LogLevel } from "./common/logger.js"; @@ -193,7 +194,7 @@ export class Server { } private registerTools(): void { - for (const toolConstructor of [...AtlasTools, ...MongoDbTools]) { + for (const toolConstructor of [...AtlasTools, ...AtlasLocalTools, ...MongoDbTools]) { const tool = new toolConstructor(this.session, this.userConfig, this.telemetry); if (tool.register(this)) { this.tools.push(tool); diff --git a/src/tools/atlasLocal/atlasLocalTool.ts b/src/tools/atlasLocal/atlasLocalTool.ts new file mode 100644 index 00000000..b5c7899f --- /dev/null +++ b/src/tools/atlasLocal/atlasLocalTool.ts @@ -0,0 +1,17 @@ +import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js"; +import type { ToolArgs, ToolCategory } from "../tool.js"; +import { ToolBase } from "../tool.js"; + +export abstract class AtlasLocalToolBase extends ToolBase { + public category: ToolCategory = "atlas-local"; + + protected handleError( + error: unknown, + args: ToolArgs + ): Promise | CallToolResult { + // Error Handling for expected Atlas Local errors go here + + // For other types of errors, use the default error handling from the base class + return super.handleError(error, args); + } +} diff --git a/src/tools/atlasLocal/tools.ts b/src/tools/atlasLocal/tools.ts new file mode 100644 index 00000000..be1a9552 --- /dev/null +++ b/src/tools/atlasLocal/tools.ts @@ -0,0 +1 @@ +export const AtlasLocalTools = []; diff --git a/src/tools/tool.ts b/src/tools/tool.ts index 538d8c9b..2c3587ca 100644 --- a/src/tools/tool.ts +++ b/src/tools/tool.ts @@ -12,7 +12,7 @@ import type { Server } from "../server.js"; export type ToolArgs = z.objectOutputType; export type OperationType = "metadata" | "read" | "create" | "delete" | "update" | "connect"; -export type ToolCategory = "mongodb" | "atlas"; +export type ToolCategory = "mongodb" | "atlas" | "atlas-local"; export type TelemetryToolMetadata = { projectId?: string; orgId?: string;