File tree Expand file tree Collapse file tree 5 files changed +27
-3
lines changed
Expand file tree Collapse file tree 5 files changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -284,6 +284,10 @@ npx -y mongodb-mcp-server@latest --transport http --httpHost=0.0.0.0 --httpPort=
284284
285285NOTE: 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
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
22import type { Session } from "./common/session.js" ;
33import type { Transport } from "@modelcontextprotocol/sdk/shared/transport.js" ;
44import { AtlasTools } from "./tools/atlas/tools.js" ;
5+ import { AtlasLocalTools } from "./tools/atlas-local/tools.js" ;
56import { MongoDbTools } from "./tools/mongodb/tools.js" ;
67import { Resources } from "./resources/resources.js" ;
78import 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 ) ;
@@ -217,7 +218,7 @@ export class Server {
217218 console . error ( "Connection string validation failed with error: " , error ) ;
218219 throw new Error (
219220 "Connection string validation failed with error: " +
220- ( error instanceof Error ? error . message : String ( error ) )
221+ ( error instanceof Error ? error . message : String ( error ) )
221222 ) ;
222223 }
223224 }
Original file line number Diff line number Diff line change 1+ import { CallToolResult } from "@modelcontextprotocol/sdk/types.js" ;
2+ import { ToolArgs , ToolBase , ToolCategory } from "../tool.js" ;
3+
4+ export abstract class AtlasToolBase extends ToolBase {
5+ public category : ToolCategory = "atlas-local" ;
6+
7+
8+ protected handleError (
9+ error : unknown ,
10+ args : ToolArgs < typeof this . argsShape >
11+ ) : Promise < CallToolResult > | CallToolResult {
12+
13+ // Error Handling for expected atlas-local errors go here
14+
15+ // For other types of errors, use the default error handling from the base class
16+ return super . handleError ( error , args ) ;
17+ }
18+ }
Original file line number Diff line number Diff line change 1+ export const AtlasLocalTools = [ ] ;
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import type { Server } from "../server.js";
1212export type ToolArgs < Args extends ZodRawShape > = z . objectOutputType < Args , ZodNever > ;
1313
1414export type OperationType = "metadata" | "read" | "create" | "delete" | "update" | "connect" ;
15- export type ToolCategory = "mongodb" | "atlas" ;
15+ export type ToolCategory = "mongodb" | "atlas" | "atlas-local" ;
1616export type TelemetryToolMetadata = {
1717 projectId ?: string ;
1818 orgId ?: string ;
You can’t perform that action at this time.
0 commit comments