better-gemini-mcp 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.

Potentially problematic release.


This version of better-gemini-mcp might be problematic. Click here for more details.

Files changed (88) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/LICENSE.md +13 -0
  3. package/README.md +291 -0
  4. package/dist/constants.d.ts +148 -0
  5. package/dist/constants.d.ts.map +1 -0
  6. package/dist/constants.js +295 -0
  7. package/dist/constants.js.map +1 -0
  8. package/dist/index.d.ts +11 -0
  9. package/dist/index.d.ts.map +1 -0
  10. package/dist/index.js +280 -0
  11. package/dist/index.js.map +1 -0
  12. package/dist/setup/index.d.ts +7 -0
  13. package/dist/setup/index.d.ts.map +1 -0
  14. package/dist/setup/index.js +6 -0
  15. package/dist/setup/index.js.map +1 -0
  16. package/dist/setup/wizard.d.ts +39 -0
  17. package/dist/setup/wizard.d.ts.map +1 -0
  18. package/dist/setup/wizard.js +222 -0
  19. package/dist/setup/wizard.js.map +1 -0
  20. package/dist/tools/analyze-directory.tool.d.ts +8 -0
  21. package/dist/tools/analyze-directory.tool.d.ts.map +1 -0
  22. package/dist/tools/analyze-directory.tool.js +195 -0
  23. package/dist/tools/analyze-directory.tool.js.map +1 -0
  24. package/dist/tools/deep-research.tool.d.ts +8 -0
  25. package/dist/tools/deep-research.tool.d.ts.map +1 -0
  26. package/dist/tools/deep-research.tool.js +153 -0
  27. package/dist/tools/deep-research.tool.js.map +1 -0
  28. package/dist/tools/fetch-chunk.tool.d.ts +8 -0
  29. package/dist/tools/fetch-chunk.tool.d.ts.map +1 -0
  30. package/dist/tools/fetch-chunk.tool.js +123 -0
  31. package/dist/tools/fetch-chunk.tool.js.map +1 -0
  32. package/dist/tools/health-check.tool.d.ts +8 -0
  33. package/dist/tools/health-check.tool.d.ts.map +1 -0
  34. package/dist/tools/health-check.tool.js +113 -0
  35. package/dist/tools/health-check.tool.js.map +1 -0
  36. package/dist/tools/index.d.ts +16 -0
  37. package/dist/tools/index.d.ts.map +1 -0
  38. package/dist/tools/index.js +35 -0
  39. package/dist/tools/index.js.map +1 -0
  40. package/dist/tools/quick-query.tool.d.ts +8 -0
  41. package/dist/tools/quick-query.tool.d.ts.map +1 -0
  42. package/dist/tools/quick-query.tool.js +154 -0
  43. package/dist/tools/quick-query.tool.js.map +1 -0
  44. package/dist/tools/registry.d.ts +52 -0
  45. package/dist/tools/registry.d.ts.map +1 -0
  46. package/dist/tools/registry.js +95 -0
  47. package/dist/tools/registry.js.map +1 -0
  48. package/dist/tools/validate-paths.tool.d.ts +8 -0
  49. package/dist/tools/validate-paths.tool.d.ts.map +1 -0
  50. package/dist/tools/validate-paths.tool.js +64 -0
  51. package/dist/tools/validate-paths.tool.js.map +1 -0
  52. package/dist/types.d.ts +221 -0
  53. package/dist/types.d.ts.map +1 -0
  54. package/dist/types.js +5 -0
  55. package/dist/types.js.map +1 -0
  56. package/dist/utils/commandExecutor.d.ts +28 -0
  57. package/dist/utils/commandExecutor.d.ts.map +1 -0
  58. package/dist/utils/commandExecutor.js +105 -0
  59. package/dist/utils/commandExecutor.js.map +1 -0
  60. package/dist/utils/geminiExecutor.d.ts +71 -0
  61. package/dist/utils/geminiExecutor.d.ts.map +1 -0
  62. package/dist/utils/geminiExecutor.js +281 -0
  63. package/dist/utils/geminiExecutor.js.map +1 -0
  64. package/dist/utils/ignorePatterns.d.ts +69 -0
  65. package/dist/utils/ignorePatterns.d.ts.map +1 -0
  66. package/dist/utils/ignorePatterns.js +178 -0
  67. package/dist/utils/ignorePatterns.js.map +1 -0
  68. package/dist/utils/index.d.ts +11 -0
  69. package/dist/utils/index.d.ts.map +1 -0
  70. package/dist/utils/index.js +18 -0
  71. package/dist/utils/index.js.map +1 -0
  72. package/dist/utils/logger.d.ts +39 -0
  73. package/dist/utils/logger.d.ts.map +1 -0
  74. package/dist/utils/logger.js +160 -0
  75. package/dist/utils/logger.js.map +1 -0
  76. package/dist/utils/pathValidator.d.ts +55 -0
  77. package/dist/utils/pathValidator.d.ts.map +1 -0
  78. package/dist/utils/pathValidator.js +137 -0
  79. package/dist/utils/pathValidator.js.map +1 -0
  80. package/dist/utils/responseCache.d.ts +80 -0
  81. package/dist/utils/responseCache.d.ts.map +1 -0
  82. package/dist/utils/responseCache.js +179 -0
  83. package/dist/utils/responseCache.js.map +1 -0
  84. package/dist/utils/responseChunker.d.ts +36 -0
  85. package/dist/utils/responseChunker.d.ts.map +1 -0
  86. package/dist/utils/responseChunker.js +96 -0
  87. package/dist/utils/responseChunker.js.map +1 -0
  88. package/package.json +62 -0
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Response chunker utility for splitting large responses
3
+ * Implements chunking with configurable size (PRD §5.2)
4
+ */
5
+ import { DEFAULTS } from "../constants.js";
6
+ /**
7
+ * Chunk a response string into smaller pieces
8
+ *
9
+ * @param response - The full response string to chunk
10
+ * @param chunkSizeKB - Size of each chunk in kilobytes (default: 10KB)
11
+ * @returns Array of CachedChunk objects with metadata
12
+ */
13
+ export function chunkResponse(response, chunkSizeKB = DEFAULTS.RESPONSE_CHUNK_SIZE_KB) {
14
+ const chunkSizeBytes = chunkSizeKB * 1024;
15
+ // If response fits in one chunk, return single chunk
16
+ if (response.length <= chunkSizeBytes) {
17
+ return [
18
+ {
19
+ content: response,
20
+ index: 1,
21
+ total: 1,
22
+ },
23
+ ];
24
+ }
25
+ const chunks = [];
26
+ // Split at natural boundaries (newlines) when possible
27
+ let currentPosition = 0;
28
+ let chunkIndex = 1;
29
+ while (currentPosition < response.length) {
30
+ let endPosition = currentPosition + chunkSizeBytes;
31
+ // If we're not at the end, try to find a natural break point
32
+ if (endPosition < response.length) {
33
+ // Look for the last newline within the chunk size
34
+ const searchStart = Math.max(currentPosition, endPosition - 500); // Search within last 500 chars
35
+ const lastNewline = response.lastIndexOf("\n", endPosition);
36
+ if (lastNewline > searchStart) {
37
+ endPosition = lastNewline + 1; // Include the newline
38
+ }
39
+ }
40
+ else {
41
+ endPosition = response.length;
42
+ }
43
+ const chunkContent = response.slice(currentPosition, endPosition);
44
+ chunks.push({
45
+ content: chunkContent,
46
+ index: chunkIndex,
47
+ total: 0, // Will be updated after all chunks are created
48
+ });
49
+ currentPosition = endPosition;
50
+ chunkIndex++;
51
+ }
52
+ // Update total count for all chunks
53
+ const totalChunks = chunks.length;
54
+ for (const chunk of chunks) {
55
+ chunk.total = totalChunks;
56
+ }
57
+ return chunks;
58
+ }
59
+ /**
60
+ * Check if a response needs chunking
61
+ *
62
+ * @param response - The response string to check
63
+ * @param chunkSizeKB - Chunk size threshold in KB
64
+ * @returns true if the response exceeds the chunk size
65
+ */
66
+ export function needsChunking(response, chunkSizeKB = DEFAULTS.RESPONSE_CHUNK_SIZE_KB) {
67
+ const chunkSizeBytes = chunkSizeKB * 1024;
68
+ return response.length > chunkSizeBytes;
69
+ }
70
+ /**
71
+ * Get the number of chunks that would be created for a response
72
+ *
73
+ * @param response - The response string
74
+ * @param chunkSizeKB - Chunk size in KB
75
+ * @returns Estimated number of chunks
76
+ */
77
+ export function estimateChunkCount(response, chunkSizeKB = DEFAULTS.RESPONSE_CHUNK_SIZE_KB) {
78
+ const chunkSizeBytes = chunkSizeKB * 1024;
79
+ return Math.ceil(response.length / chunkSizeBytes);
80
+ }
81
+ /**
82
+ * Get the chunk size configuration from environment or default
83
+ *
84
+ * @returns Chunk size in KB
85
+ */
86
+ export function getChunkSizeKB() {
87
+ const envValue = process.env.RESPONSE_CHUNK_SIZE_KB;
88
+ if (envValue) {
89
+ const parsed = parseInt(envValue, 10);
90
+ if (!isNaN(parsed) && parsed > 0) {
91
+ return parsed;
92
+ }
93
+ }
94
+ return DEFAULTS.RESPONSE_CHUNK_SIZE_KB;
95
+ }
96
+ //# sourceMappingURL=responseChunker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"responseChunker.js","sourceRoot":"","sources":["../../src/utils/responseChunker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM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C1D,CAAC,CAAC;QAEH,eAAe,GAAG,WAAW,CAAC;QAC9B,UAAU,EAAE,CAAC;IACf,CAAC;IAED,oCAAoC;IACpC,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC;IAClC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,KAAK,CAAC,KAAK,GAAG,WAAW,CAAC;IAC5B,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAC3B,QAAgB,EAChB,cAAsB,QAAQ,CAAC,sBAAsB;IAErD,MAAM,cAAc,GAAG,WAAW,GAAG,IAAI,CAAC;IAC1C,OAAO,QAAQ,CAAC,MAAM,GAAG,cAAc,CAAC;AAC1C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAChC,QAAgB,EAChB,cAAsB,QAAQ,CAAC,sBAAsB;IAErD,MAAM,cAAc,GAAG,WAAW,GAAG,IAAI,CAAC;IAC1C,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,cAAc,CAAC,CAAC;AACrD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc;IAC5B,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC;IACpD,IAAI,QAAQ,EAAE,CAAC;QACb,MAAM,MAAM,GAAG,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QACtC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;YACjC,OAAO,MAAM,CAAC;QAChB,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC,sBAAsB,CAAC;AACzC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "better-gemini-mcp",
3
+ "version": "1.0.0",
4
+ "description": "Stateless MCP server that proxies research queries to Gemini CLI, reducing agent context/model usage",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "bin": {
8
+ "better-gemini-mcp": "dist/index.js"
9
+ },
10
+ "scripts": {
11
+ "build": "tsc",
12
+ "dev": "tsc --watch",
13
+ "start": "node dist/index.js",
14
+ "lint": "tsc --noEmit",
15
+ "test": "node --test --experimental-strip-types tests/**/*.test.ts",
16
+ "test:unit": "node --test --experimental-strip-types tests/unit/**/*.test.ts",
17
+ "test:integration": "node --test --experimental-strip-types tests/integration/**/*.test.ts",
18
+ "prepublishOnly": "npm run build && npm test"
19
+ },
20
+ "keywords": [
21
+ "mcp",
22
+ "modelcontextprotocol",
23
+ "gemini",
24
+ "gemini-cli",
25
+ "ai",
26
+ "llm",
27
+ "research",
28
+ "proxy",
29
+ "agent",
30
+ "copilot",
31
+ "claude"
32
+ ],
33
+ "author": "capyBearista",
34
+ "license": "BSD-3-Clause",
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "https://github.com/capyBearista/better-gemini-mcp.git"
38
+ },
39
+ "bugs": {
40
+ "url": "https://github.com/capyBearista/better-gemini-mcp/issues"
41
+ },
42
+ "homepage": "https://github.com/capyBearista/better-gemini-mcp#readme",
43
+ "engines": {
44
+ "node": ">=18.0.0"
45
+ },
46
+ "files": [
47
+ "dist/",
48
+ "README.md",
49
+ "LICENSE.md",
50
+ "CHANGELOG.md"
51
+ ],
52
+ "dependencies": {
53
+ "@modelcontextprotocol/sdk": "^0.5.0",
54
+ "ignore": "^5.3.0",
55
+ "zod": "^3.22.0",
56
+ "zod-to-json-schema": "^3.24.0"
57
+ },
58
+ "devDependencies": {
59
+ "@types/node": "^20.0.0",
60
+ "typescript": "^5.0.0"
61
+ }
62
+ }