temba-mcp 0.2.0 → 0.3.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.
Files changed (3) hide show
  1. package/package.json +1 -1
  2. package/src/cli.js +7 -2
  3. package/src/mcp.js +15 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "temba-mcp",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "MCP for Temba documentation",
5
5
  "author": "Bouwe (https://bouwe.io)",
6
6
  "scripts": {
package/src/cli.js CHANGED
@@ -1,6 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import { startMcpServer } from './mcp.js'
3
3
 
4
- console.error('✨ Temba Docs MCP starting...')
4
+ const args = process.argv.slice(2)
5
+ const isDebug = args.includes('--debug')
5
6
 
6
- startMcpServer().catch(console.error)
7
+ if (isDebug) {
8
+ console.error('✨ Temba Docs MCP running in DEBUG mode')
9
+ }
10
+
11
+ startMcpServer({ debug: isDebug }).catch(console.error)
package/src/mcp.js CHANGED
@@ -1,9 +1,19 @@
1
1
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
2
2
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
3
+ import fs from 'fs'
4
+ import path from 'path'
3
5
  import { z } from 'zod'
4
6
  import { searchDocs } from './searchDocs.js'
5
7
  import { version } from './version.js'
6
8
 
9
+ const LOG_FILE = path.join(process.cwd(), 'temba-mcp.log')
10
+
11
+ function log(message) {
12
+ const timestamp = new Date().toISOString()
13
+ const entry = `[${timestamp}] ${message}\n`
14
+ fs.appendFileSync(LOG_FILE, entry)
15
+ }
16
+
7
17
  let index = []
8
18
  let lastFetched = 0
9
19
  const CACHE_TTL = 3600000 // 1 hour in milliseconds
@@ -30,7 +40,7 @@ async function ensureFreshIndex() {
30
40
  }
31
41
  }
32
42
 
33
- export const startMcpServer = async () => {
43
+ export const startMcpServer = async ({ debug = false } = {}) => {
34
44
  const server = new McpServer({
35
45
  name: 'temba-docs-mcp',
36
46
  version,
@@ -45,6 +55,10 @@ export const startMcpServer = async () => {
45
55
  await ensureFreshIndex()
46
56
  const results = searchDocs(query, index).slice(0, 5) // Limit to top 5 results
47
57
 
58
+ if (debug) {
59
+ log(`Query: "${query}" | Results: ${results.length}`)
60
+ }
61
+
48
62
  if (results.length === 0) {
49
63
  return {
50
64
  content: [{ type: 'text', text: 'No documentation found for your query.' }],