Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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);
Expand Down
17 changes: 17 additions & 0 deletions src/tools/atlasLocal/atlasLocalTool.ts
Original file line number Diff line number Diff line change
@@ -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 = "atlasLocal";

protected handleError(
error: unknown,
args: ToolArgs<typeof this.argsShape>
): Promise<CallToolResult> | 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);
}
}
1 change: 1 addition & 0 deletions src/tools/atlasLocal/tools.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const AtlasLocalTools = [];
2 changes: 1 addition & 1 deletion src/tools/tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type { Server } from "../server.js";
export type ToolArgs<Args extends ZodRawShape> = z.objectOutputType<Args, ZodNever>;

export type OperationType = "metadata" | "read" | "create" | "delete" | "update" | "connect";
export type ToolCategory = "mongodb" | "atlas";
export type ToolCategory = "mongodb" | "atlas" | "atlasLocal";
export type TelemetryToolMetadata = {
projectId?: string;
orgId?: string;
Expand Down
Loading