Skip to content

Commit 3b4a437

Browse files
committed
chore: add deprecated parseArgsWithCliOptions
1 parent 666ab2b commit 3b4a437

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

MCP_SERVER_LIBRARY.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -820,10 +820,17 @@ _Note: This is what MongoDB MCP server uses internally._
820820
**Example:**
821821

822822
```typescript
823-
import { parseUserConfig, StdioRunner } from "mongodb-mcp-server";
823+
import { parseUserConfig, StdioRunner, UserConfigSchema } from "mongodb-mcp-server";
824824

825825
// Parse config from process.argv and environment variables
826-
const config = parseUserConfig();
826+
const config = parseUserConfig({
827+
args: process.argv.slice(2),
828+
// You can optionally specify overrides for the config
829+
// This can be used, for example, to set new defaults.
830+
overrides: {
831+
readOnly: UserConfigSchema.shape.readOnly.default(true),
832+
}
833+
});
827834

828835
const runner = new StdioRunner({ userConfig: config });
829836
await runner.start();

src/lib.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@ export { Server, type ServerOptions } from "./server.js";
22
export { Session, type SessionOptions } from "./common/session.js";
33
export { type UserConfig, UserConfigSchema } from "./common/config/userConfig.js";
44
export { parseUserConfig, defaultParserOptions, type ParserOptions } from "./common/config/parseUserConfig.js";
5+
6+
import { parseUserConfig } from "./common/config/parseUserConfig.js";
7+
import type { UserConfig } from "./common/config/userConfig.js";
8+
9+
/** @deprecated Use `parseUserConfig` instead. */
10+
export function parseArgsWithCliOptions(cliArguments: string[]): {
11+
warnings: string[];
12+
parsed: UserConfig | undefined;
13+
error: string | undefined;
14+
} {
15+
return parseUserConfig({
16+
args: cliArguments,
17+
});
18+
}
19+
520
export { LoggerBase, type LogPayload, type LoggerType, type LogLevel } from "./common/logger.js";
621
export { StreamableHttpRunner } from "./transports/streamableHttp.js";
722
export { StdioRunner } from "./transports/stdio.js";

0 commit comments

Comments
 (0)