@react-native-nitro-device-info/mcp-server 1.0.0

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.
Files changed (42) hide show
  1. package/README.md +220 -0
  2. package/dist/cli/init.d.ts +12 -0
  3. package/dist/cli/init.d.ts.map +1 -0
  4. package/dist/cli/init.js +153 -0
  5. package/dist/cli/init.js.map +1 -0
  6. package/dist/index.d.ts +14 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +375 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/indexer/api-parser.d.ts +23 -0
  11. package/dist/indexer/api-parser.d.ts.map +1 -0
  12. package/dist/indexer/api-parser.js +404 -0
  13. package/dist/indexer/api-parser.js.map +1 -0
  14. package/dist/indexer/doc-parser.d.ts +38 -0
  15. package/dist/indexer/doc-parser.d.ts.map +1 -0
  16. package/dist/indexer/doc-parser.js +359 -0
  17. package/dist/indexer/doc-parser.js.map +1 -0
  18. package/dist/indexer/index.d.ts +54 -0
  19. package/dist/indexer/index.d.ts.map +1 -0
  20. package/dist/indexer/index.js +151 -0
  21. package/dist/indexer/index.js.map +1 -0
  22. package/dist/indexer/search.d.ts +36 -0
  23. package/dist/indexer/search.d.ts.map +1 -0
  24. package/dist/indexer/search.js +511 -0
  25. package/dist/indexer/search.js.map +1 -0
  26. package/dist/tools/get-api.d.ts +26 -0
  27. package/dist/tools/get-api.d.ts.map +1 -0
  28. package/dist/tools/get-api.js +229 -0
  29. package/dist/tools/get-api.js.map +1 -0
  30. package/dist/tools/list-apis.d.ts +32 -0
  31. package/dist/tools/list-apis.d.ts.map +1 -0
  32. package/dist/tools/list-apis.js +210 -0
  33. package/dist/tools/list-apis.js.map +1 -0
  34. package/dist/tools/search-docs.d.ts +32 -0
  35. package/dist/tools/search-docs.d.ts.map +1 -0
  36. package/dist/tools/search-docs.js +148 -0
  37. package/dist/tools/search-docs.js.map +1 -0
  38. package/dist/types/index.d.ts +166 -0
  39. package/dist/types/index.d.ts.map +1 -0
  40. package/dist/types/index.js +9 -0
  41. package/dist/types/index.js.map +1 -0
  42. package/package.json +59 -0
package/dist/index.js ADDED
@@ -0,0 +1,375 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ /**
4
+ * MCP Server for react-native-nitro-device-info
5
+ *
6
+ * Enables AI tools like Claude, Cursor, and Copilot to access
7
+ * accurate API documentation for the react-native-nitro-device-info library.
8
+ *
9
+ * Usage:
10
+ * npx @react-native-nitro-device-info/mcp-server # Start MCP server
11
+ * npx @react-native-nitro-device-info/mcp-server init # Initialize config files
12
+ * npx @react-native-nitro-device-info/mcp-server --help # Show help
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
16
+ const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
17
+ const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
18
+ const init_js_1 = require("./cli/init.js");
19
+ const index_js_2 = require("./indexer/index.js");
20
+ const search_docs_js_1 = require("./tools/search-docs.js");
21
+ const get_api_js_1 = require("./tools/get-api.js");
22
+ const list_apis_js_1 = require("./tools/list-apis.js");
23
+ // Tool timeout in milliseconds (2 seconds per spec)
24
+ const TOOL_TIMEOUT_MS = 2000;
25
+ /**
26
+ * Create and configure the MCP server
27
+ */
28
+ async function createServer() {
29
+ const server = new index_js_1.Server({
30
+ name: 'react-native-nitro-device-info',
31
+ version: '1.0.0',
32
+ }, {
33
+ capabilities: {
34
+ tools: {},
35
+ },
36
+ });
37
+ // Build search index
38
+ let index;
39
+ try {
40
+ console.error('Building documentation index...');
41
+ const startTime = Date.now();
42
+ index = (0, index_js_2.buildIndex)(__dirname);
43
+ const buildTime = Date.now() - startTime;
44
+ const stats = (0, index_js_2.getIndexStats)(index);
45
+ console.error(`Index built in ${buildTime}ms:`);
46
+ console.error(` - APIs: ${stats.apiCount}`);
47
+ console.error(` - Documentation chunks: ${stats.chunkCount}`);
48
+ console.error(` - Total documents: ${stats.totalDocuments}`);
49
+ // Validate index
50
+ const validation = (0, index_js_2.validateIndex)(index);
51
+ if (!validation.valid) {
52
+ console.error('Index validation warnings:');
53
+ for (const error of validation.errors) {
54
+ console.error(` - ERROR: ${error}`);
55
+ }
56
+ }
57
+ if (validation.warnings.length > 0 && validation.warnings.length <= 5) {
58
+ for (const warning of validation.warnings) {
59
+ console.error(` - WARNING: ${warning}`);
60
+ }
61
+ }
62
+ else if (validation.warnings.length > 5) {
63
+ console.error(` - ${validation.warnings.length} warnings (suppressed)`);
64
+ }
65
+ }
66
+ catch (error) {
67
+ console.error(`Failed to build index: ${error}`);
68
+ // Create empty index as fallback
69
+ index = {
70
+ apis: new Map(),
71
+ chunks: [],
72
+ invertedIndex: new Map(),
73
+ documentLengths: new Map(),
74
+ averageDocumentLength: 0,
75
+ documentCount: 0,
76
+ termDocumentFrequencies: new Map(),
77
+ };
78
+ }
79
+ // Register tool list handler
80
+ server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => {
81
+ return {
82
+ tools: [
83
+ {
84
+ name: 'search_docs',
85
+ description: 'Search react-native-nitro-device-info documentation using natural language queries. Returns relevant API methods, properties, and documentation sections with relevance scores.',
86
+ inputSchema: {
87
+ type: 'object',
88
+ properties: {
89
+ query: {
90
+ type: 'string',
91
+ description: "Natural language search query (e.g., 'how to get battery level')",
92
+ minLength: 1,
93
+ maxLength: 1000,
94
+ },
95
+ limit: {
96
+ type: 'number',
97
+ description: 'Maximum number of results to return (1-20, default: 5)',
98
+ minimum: 1,
99
+ maximum: 20,
100
+ default: 5,
101
+ },
102
+ type: {
103
+ type: 'string',
104
+ enum: ['all', 'api', 'guide'],
105
+ description: "Filter results by content type: 'api' = API definitions, 'guide' = documentation guides, 'all' = both",
106
+ default: 'all',
107
+ },
108
+ },
109
+ required: ['query'],
110
+ },
111
+ },
112
+ {
113
+ name: 'get_api',
114
+ description: 'Get detailed information about a specific API method or property from react-native-nitro-device-info. Returns signature, parameters, return type, platform support, examples, and related APIs.',
115
+ inputSchema: {
116
+ type: 'object',
117
+ properties: {
118
+ name: {
119
+ type: 'string',
120
+ description: "API method or property name (e.g., 'getBatteryLevel', 'deviceId'). Case-insensitive lookup.",
121
+ minLength: 1,
122
+ maxLength: 100,
123
+ },
124
+ },
125
+ required: ['name'],
126
+ },
127
+ },
128
+ {
129
+ name: 'list_apis',
130
+ description: 'List all available API methods and properties in react-native-nitro-device-info with optional filtering by category, platform, or kind.',
131
+ inputSchema: {
132
+ type: 'object',
133
+ properties: {
134
+ category: {
135
+ type: 'string',
136
+ enum: [
137
+ 'all',
138
+ 'device-info',
139
+ 'battery',
140
+ 'memory',
141
+ 'storage',
142
+ 'network',
143
+ 'capabilities',
144
+ 'application',
145
+ 'platform-specific',
146
+ 'display',
147
+ 'audio',
148
+ 'location',
149
+ 'identification',
150
+ ],
151
+ description: 'Filter by API category',
152
+ default: 'all',
153
+ },
154
+ platform: {
155
+ type: 'string',
156
+ enum: ['all', 'ios', 'android', 'both'],
157
+ description: "Filter by platform support: 'ios' = iOS only, 'android' = Android only, 'both' = must support both, 'all' = any platform",
158
+ default: 'all',
159
+ },
160
+ kind: {
161
+ type: 'string',
162
+ enum: ['all', 'method', 'property'],
163
+ description: "Filter by API kind: 'method' = functions with (), 'property' = readonly getters",
164
+ default: 'all',
165
+ },
166
+ },
167
+ },
168
+ },
169
+ ],
170
+ };
171
+ });
172
+ // Register tool call handler
173
+ server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
174
+ const { name, arguments: args } = request.params;
175
+ // Wrap execution with timeout
176
+ const executeWithTimeout = async (fn, timeoutMs) => {
177
+ return new Promise((resolve, reject) => {
178
+ const timer = setTimeout(() => {
179
+ reject(new Error(`Tool execution timed out after ${timeoutMs}ms`));
180
+ }, timeoutMs);
181
+ try {
182
+ const result = fn();
183
+ clearTimeout(timer);
184
+ resolve(result);
185
+ }
186
+ catch (error) {
187
+ clearTimeout(timer);
188
+ reject(error);
189
+ }
190
+ });
191
+ };
192
+ try {
193
+ // Check if index is empty
194
+ if (index.documentCount === 0) {
195
+ return {
196
+ content: [
197
+ {
198
+ type: 'text',
199
+ text: 'Error: Documentation index is empty or could not be built. Please check that the server is running from the correct directory.',
200
+ },
201
+ ],
202
+ isError: true,
203
+ };
204
+ }
205
+ switch (name) {
206
+ case 'search_docs': {
207
+ const parseResult = search_docs_js_1.searchDocsInputSchema.safeParse(args);
208
+ if (!parseResult.success) {
209
+ return {
210
+ content: [
211
+ {
212
+ type: 'text',
213
+ text: `Invalid input: ${parseResult.error.message}`,
214
+ },
215
+ ],
216
+ isError: true,
217
+ };
218
+ }
219
+ const result = await executeWithTimeout(() => (0, search_docs_js_1.executeSearchDocs)(index, parseResult.data), TOOL_TIMEOUT_MS);
220
+ return {
221
+ content: [{ type: 'text', text: result.content }],
222
+ isError: result.isError,
223
+ };
224
+ }
225
+ case 'get_api': {
226
+ const parseResult = get_api_js_1.getApiInputSchema.safeParse(args);
227
+ if (!parseResult.success) {
228
+ return {
229
+ content: [
230
+ {
231
+ type: 'text',
232
+ text: `Invalid input: ${parseResult.error.message}`,
233
+ },
234
+ ],
235
+ isError: true,
236
+ };
237
+ }
238
+ const result = await executeWithTimeout(() => (0, get_api_js_1.executeGetApi)(index, parseResult.data), TOOL_TIMEOUT_MS);
239
+ return {
240
+ content: [{ type: 'text', text: result.content }],
241
+ isError: result.isError,
242
+ };
243
+ }
244
+ case 'list_apis': {
245
+ const parseResult = list_apis_js_1.listApisInputSchema.safeParse(args ?? {});
246
+ if (!parseResult.success) {
247
+ return {
248
+ content: [
249
+ {
250
+ type: 'text',
251
+ text: `Invalid input: ${parseResult.error.message}`,
252
+ },
253
+ ],
254
+ isError: true,
255
+ };
256
+ }
257
+ const result = await executeWithTimeout(() => (0, list_apis_js_1.executeListApis)(index, parseResult.data), TOOL_TIMEOUT_MS);
258
+ return {
259
+ content: [{ type: 'text', text: result.content }],
260
+ isError: result.isError,
261
+ };
262
+ }
263
+ default:
264
+ return {
265
+ content: [
266
+ {
267
+ type: 'text',
268
+ text: `Unknown tool: ${name}. Available tools: search_docs, get_api, list_apis`,
269
+ },
270
+ ],
271
+ isError: true,
272
+ };
273
+ }
274
+ }
275
+ catch (error) {
276
+ const errorMessage = error instanceof Error ? error.message : String(error);
277
+ // Handle timeout specifically
278
+ if (errorMessage.includes('timed out')) {
279
+ return {
280
+ content: [
281
+ {
282
+ type: 'text',
283
+ text: `Request timed out after ${TOOL_TIMEOUT_MS}ms. Please try a simpler query.`,
284
+ },
285
+ ],
286
+ isError: true,
287
+ };
288
+ }
289
+ return {
290
+ content: [
291
+ {
292
+ type: 'text',
293
+ text: `Error executing tool: ${errorMessage}`,
294
+ },
295
+ ],
296
+ isError: true,
297
+ };
298
+ }
299
+ });
300
+ return server;
301
+ }
302
+ /**
303
+ * Show help message
304
+ */
305
+ function showHelp() {
306
+ console.log(`
307
+ @react-native-nitro-device-info/mcp-server
308
+
309
+ MCP server enabling AI tools to access react-native-nitro-device-info documentation.
310
+
311
+ Usage:
312
+ npx @react-native-nitro-device-info/mcp-server Start the MCP server (stdio)
313
+ npx @react-native-nitro-device-info/mcp-server init Initialize config files
314
+ npx @react-native-nitro-device-info/mcp-server --help Show this help message
315
+
316
+ Commands:
317
+ init Create .cursor/mcp.json and .mcp.json in your project
318
+ Enables Cursor IDE and Claude Code to use this MCP server
319
+
320
+ Examples:
321
+ # Initialize MCP config in your React Native project
322
+ cd my-react-native-app
323
+ npx @react-native-nitro-device-info/mcp-server init
324
+
325
+ # Then restart your IDE and ask:
326
+ "How do I get the device's battery level?"
327
+ `);
328
+ }
329
+ /**
330
+ * Main entry point
331
+ */
332
+ async function main() {
333
+ const args = process.argv.slice(2);
334
+ const command = args[0];
335
+ // Handle CLI commands
336
+ if (command === 'init') {
337
+ await (0, init_js_1.runInit)();
338
+ return;
339
+ }
340
+ if (command === '--help' || command === '-h' || command === 'help') {
341
+ showHelp();
342
+ return;
343
+ }
344
+ if (command && command !== '--stdio') {
345
+ console.error(`Unknown command: ${command}`);
346
+ console.error('Run with --help to see available commands.');
347
+ process.exit(1);
348
+ }
349
+ // Default: start MCP server
350
+ try {
351
+ const server = await createServer();
352
+ const transport = new stdio_js_1.StdioServerTransport();
353
+ await server.connect(transport);
354
+ console.error('MCP server started successfully');
355
+ }
356
+ catch (error) {
357
+ console.error('Failed to start MCP server:', error);
358
+ process.exit(1);
359
+ }
360
+ }
361
+ // Handle uncaught errors
362
+ process.on('uncaughtException', (error) => {
363
+ console.error('Uncaught exception:', error);
364
+ process.exit(1);
365
+ });
366
+ process.on('unhandledRejection', (reason) => {
367
+ console.error('Unhandled rejection:', reason);
368
+ process.exit(1);
369
+ });
370
+ // Run the server
371
+ main().catch((error) => {
372
+ console.error('Fatal error:', error);
373
+ process.exit(1);
374
+ });
375
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AACA;;;;;;;;;;GAUG;;AAEH,wEAAmE;AACnE,wEAAiF;AACjF,iEAG4C;AAC5C,2CAAwC;AAExC,iDAA8E;AAC9E,2DAIgC;AAChC,mDAI4B;AAC5B,uDAI8B;AAE9B,oDAAoD;AACpD,MAAM,eAAe,GAAG,IAAI,CAAC;AAE7B;;GAEG;AACH,KAAK,UAAU,YAAY;IACzB,MAAM,MAAM,GAAG,IAAI,iBAAM,CACvB;QACE,IAAI,EAAE,gCAAgC;QACtC,OAAO,EAAE,OAAO;KACjB,EACD;QACE,YAAY,EAAE;YACZ,KAAK,EAAE,EAAE;SACV;KACF,CACF,CAAC;IAEF,qBAAqB;IACrB,IAAI,KAAkB,CAAC;IACvB,IAAI,CAAC;QACH,OAAO,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACjD,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC7B,KAAK,GAAG,IAAA,qBAAU,EAAC,SAAS,CAAC,CAAC;QAC9B,MAAM,SAAS,GAAG,IAAI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EAAE,CAAC,oBAAoB,EAAE,CAAC,MAAM,EAAE,EAAE;IAC1C,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAAC;IAC9C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,iBAAiB;AACjB,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * API Parser for DeviceInfo.nitro.ts
3
+ *
4
+ * Extracts method signatures, JSDoc comments, and platform tags
5
+ * from the TypeScript interface definition.
6
+ */
7
+ import type { ApiDefinition } from '../types/index.js';
8
+ /**
9
+ * Parse DeviceInfo.nitro.ts file and extract all API definitions
10
+ */
11
+ export declare function parseDeviceInfoFile(filePath: string): ApiDefinition[];
12
+ /**
13
+ * Parse DeviceInfo content string and extract all API definitions
14
+ */
15
+ export declare function parseDeviceInfoContent(content: string): ApiDefinition[];
16
+ /**
17
+ * Get the path to DeviceInfo.nitro.ts relative to package
18
+ *
19
+ * When running from dist (packages/mcp-server/dist), we need to go up 3 levels
20
+ * to reach the repository root where src/DeviceInfo.nitro.ts lives.
21
+ */
22
+ export declare function getDeviceInfoPath(packageRoot: string): string;
23
+ //# sourceMappingURL=api-parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-parser.d.ts","sourceRoot":"","sources":["../../src/indexer/api-parser.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAoC,MAAM,mBAAmB,CAAC;AAyUzF;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa,EAAE,CAGrE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,EAAE,CAwCvE;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAuB7D"}