temba-mcp 0.4.0 → 0.4.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/package.json +1 -1
- package/src/cli.js +24 -0
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -1,11 +1,35 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { startMcpServer } from './mcp.js'
|
|
3
|
+
import { searchDocs } from './searchDocs.js'
|
|
3
4
|
|
|
4
5
|
const args = process.argv.slice(2)
|
|
5
6
|
const isDebug = args.includes('--debug')
|
|
7
|
+
const queryIndex = args.findIndex((a) => a === '-q' || a === '--query')
|
|
6
8
|
|
|
7
9
|
if (isDebug) {
|
|
8
10
|
console.error('✨ Temba Docs MCP running in DEBUG mode')
|
|
9
11
|
}
|
|
10
12
|
|
|
13
|
+
// Check for the testing flag
|
|
14
|
+
if (queryIndex !== -1 && args[queryIndex + 1]) {
|
|
15
|
+
const query = args[queryIndex + 1]
|
|
16
|
+
|
|
17
|
+
try {
|
|
18
|
+
// 1. Fetch from the exact same remote location the MCP server uses
|
|
19
|
+
const response = await fetch('https://temba.bouwe.io/search_index.json')
|
|
20
|
+
if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`)
|
|
21
|
+
const index = await response.json()
|
|
22
|
+
|
|
23
|
+
// 2. Execute logic
|
|
24
|
+
const results = searchDocs(query, index)
|
|
25
|
+
|
|
26
|
+
// 3. Output raw JSON (Agent-fidelity)
|
|
27
|
+
process.stdout.write(JSON.stringify(results, null, 2))
|
|
28
|
+
process.exit(0)
|
|
29
|
+
} catch (err) {
|
|
30
|
+
console.error('❌ Failed to fetch remote index for test:', err.message)
|
|
31
|
+
process.exit(1)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
11
35
|
startMcpServer({ debug: isDebug }).catch(console.error)
|