@nirvana-labs/nirvana-mcp 1.62.0 → 1.63.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/options.ts CHANGED
@@ -18,6 +18,8 @@ export type McpOptions = {
18
18
  includeCodeTool?: boolean | undefined;
19
19
  includeDocsTools?: boolean | undefined;
20
20
  stainlessApiKey?: string | undefined;
21
+ docsSearchMode?: 'stainless-api' | 'local' | undefined;
22
+ docsDir?: string | undefined;
21
23
  codeAllowHttpGets?: boolean | undefined;
22
24
  codeAllowedMethods?: string[] | undefined;
23
25
  codeBlockedMethods?: string[] | undefined;
@@ -58,6 +60,18 @@ export function parseCLIOptions(): CLIOptions {
58
60
  description: 'Path to custom instructions for the MCP server',
59
61
  })
60
62
  .option('debug', { type: 'boolean', description: 'Enable debug logging' })
63
+ .option('docs-dir', {
64
+ type: 'string',
65
+ description:
66
+ 'Path to a directory of local documentation files (markdown/JSON) to include in local docs search.',
67
+ })
68
+ .option('docs-search-mode', {
69
+ type: 'string',
70
+ choices: ['stainless-api', 'local'],
71
+ default: 'stainless-api',
72
+ description:
73
+ "Where to search documentation; 'stainless-api' uses the Stainless-hosted search API whereas 'local' uses an in-memory search index built from embedded SDK method data and optional local docs files.",
74
+ })
61
75
  .option('log-format', {
62
76
  type: 'string',
63
77
  choices: ['json', 'pretty'],
@@ -118,6 +132,8 @@ export function parseCLIOptions(): CLIOptions {
118
132
  ...(includeDocsTools !== undefined && { includeDocsTools }),
119
133
  debug: !!argv.debug,
120
134
  stainlessApiKey: argv.stainlessApiKey,
135
+ docsSearchMode: argv.docsSearchMode as 'stainless-api' | 'local' | undefined,
136
+ docsDir: argv.docsDir,
121
137
  codeAllowHttpGets: argv.codeAllowHttpGets,
122
138
  codeAllowedMethods: argv.codeAllowedMethods,
123
139
  codeBlockedMethods: argv.codeBlockedMethods,
@@ -163,5 +179,7 @@ export function parseQueryOptions(defaultOptions: McpOptions, query: unknown): M
163
179
  ...(codeTool !== undefined && { includeCodeTool: codeTool }),
164
180
  ...(docsTools !== undefined && { includeDocsTools: docsTools }),
165
181
  codeExecutionMode: defaultOptions.codeExecutionMode,
182
+ docsSearchMode: defaultOptions.docsSearchMode,
183
+ docsDir: defaultOptions.docsDir,
166
184
  };
167
185
  }
package/src/server.ts CHANGED
@@ -11,6 +11,8 @@ import { ClientOptions } from '@nirvana-labs/nirvana';
11
11
  import NirvanaLabs from '@nirvana-labs/nirvana';
12
12
  import { codeTool } from './code-tool';
13
13
  import docsSearchTool from './docs-search-tool';
14
+ import { setLocalSearch } from './docs-search-tool';
15
+ import { LocalDocsSearch } from './local-docs-search';
14
16
  import { getInstructions } from './instructions';
15
17
  import { McpOptions } from './options';
16
18
  import { blockedMethodsForCodeTool } from './methods';
@@ -26,7 +28,7 @@ export const newMcpServer = async ({
26
28
  new McpServer(
27
29
  {
28
30
  name: 'nirvana_labs_nirvana_api',
29
- version: '1.62.0',
31
+ version: '1.63.1',
30
32
  },
31
33
  {
32
34
  instructions: await getInstructions({ stainlessApiKey, customInstructionsPath }),
@@ -62,6 +64,12 @@ export async function initMcpServer(params: {
62
64
  error: logAtLevel('error'),
63
65
  };
64
66
 
67
+ if (params.mcpOptions?.docsSearchMode === 'local') {
68
+ const docsDir = params.mcpOptions?.docsDir;
69
+ const localSearch = await LocalDocsSearch.create(docsDir ? { docsDir } : undefined);
70
+ setLocalSearch(localSearch);
71
+ }
72
+
65
73
  let _client: NirvanaLabs | undefined;
66
74
  let _clientError: Error | undefined;
67
75
  let _logLevel: 'debug' | 'info' | 'warn' | 'error' | 'off' | undefined;