Skip to content

Commit 7c11ef0

Browse files
JakeSCahillclaude
andcommitted
Add MCPcat analytics to MCP server
Adds MCPcat analytics tracking to the Redpanda docs MCP server. MCPcat is an open-source analytics platform for monitoring MCP usage. The integration is optional and only activates if the MCPCAT_PROJECT environment variable is set. Changes: - Added mcpcat as a dependency in package.json - Integrated MCPcat tracking in netlify/functions/mcp.mjs - Includes error handling to prevent server crashes if analytics fail Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent a7bff17 commit 7c11ef0

File tree

3 files changed

+40
-3
lines changed

3 files changed

+40
-3
lines changed

netlify/functions/mcp.mjs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,24 @@ const server = new McpServer({
146146
version: SERVER_VERSION,
147147
})
148148

149+
// -------------------- MCPcat Analytics --------------------
150+
// Initialize MCPcat tracking (if MCPCAT_PROJECT is set)
151+
// MCPcat is an open-source analytics platform for MCP usage tracking.
152+
// See https://www.mcpcat.com/ for details.
153+
154+
const MCPCAT_PROJECT = process.env.MCPCAT_PROJECT
155+
156+
if (MCPCAT_PROJECT) {
157+
try {
158+
// Dynamic import to avoid bundler issues
159+
const { track } = await import('mcpcat')
160+
track(server, MCPCAT_PROJECT)
161+
} catch (e) {
162+
// Don't crash the MCP server if analytics fail to load.
163+
console.warn('[mcpcat] disabled due to import error:', e)
164+
}
165+
}
166+
149167
server.registerTool(
150168
'ask_redpanda_question',
151169
{

package-lock.json

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@
1313
"@antora/cli": "3.1.2",
1414
"@antora/site-generator": "3.1.2",
1515
"@asciidoctor/tabs": "^1.0.0-beta.5",
16+
"@modelcontextprotocol/sdk": "1.17.0",
17+
"@modelfetch/netlify": "0.15.2",
1618
"@redpanda-data/docs-extensions-and-macros": "^4.15.2",
1719
"@sntke/antora-mermaid-extension": "^0.0.6",
1820
"algoliasearch": "^5.35.0",
19-
"puppeteer": "^24.15.0",
20-
"@modelcontextprotocol/sdk": "1.17.0",
21-
"@modelfetch/netlify": "0.15.2",
2221
"hono-rate-limiter": "0.1.0",
22+
"mcpcat": "^0.1.15",
23+
"puppeteer": "^24.15.0",
2324
"zod": "3.22.4"
2425
},
2526
"devDependencies": {

0 commit comments

Comments
 (0)