Building an MCP server so Claude can query my SaaS analytics directly

Iniciado por joomlamz, 23 de Maio de 2026, 15:35

Respostas: 0   |   Visualizações: 25

Tópico anterior - Tópico seguinte

0 Membros e 1 Visitante estão a ver este tópico.

Building an MCP server so Claude can query my SaaS analytics directly



Tópico: Building an MCP server so Claude can query my SaaS analytics directly
Categoria: Tutoriais | Programação & Tecnologia
Idioma Principal: Português (Conteúdo de Tecnologia)

Descrição do Conteúdo / Informações:
-------------------------------------------------------------------------
Last week I shipped a Model Context Protocol (MCP) server for my analytics SaaS. Now Claude Desktop, Cursor, and any MCP compatible client can query traffic, revenue, and funnel data directly.

This is a walkthrough of how I built it, what worked, and a couple of patterns that surprised me.



What MCP is, briefly


MCP is a protocol that lets AI clients invoke tools and read resources from external servers. Think of it as REST for LLM tool calling, with a stable schema and discovery.



Server skeleton


import { Server } from '@modelcontextprotocol/sdk/server/index.js'
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'

const server = new Server({
name: 'zenovay',
version: '1.0.0',
}, {
capabilities: {
tools: {},
resources: {}
}
})



Defining tools


server.setRequestHandler('tools/list', async () => ({
tools: [
{
name: 'get_traffic',
description: 'Get pageview and visitor counts for a site over a date range',
inputSchema: {
type: 'object',
properties: {
site: { type: 'string' },
from: { type: 'string' },
to: { type: 'string' }
},
required: ['site', 'from', 'to']
}
}
]
}))



The pattern that surprised me: structured returns


Way better than raw JSON: return a short natural language summary plus the data. Claude uses the summary for its response and the JSON for follow up questions.



What I did not expect


Users started asking Claude to do things I had not built dashboards for:

• "Compare my paid traffic conversion rate this week vs last week"

• "Which 5 pages had the biggest week over week drop in pageviews"

• "Summarize what changed in my funnel completion rate over the last 30 days"

Claude does this by chaining multiple tool calls. I did not need to build any of those views. The tools are atomic, Claude composes.

This is the part I think is genuinely new about MCP. The interface is the LLM, the backend is just well shaped tools.



Install


npm install -g @zenovay/mcp then add to your Claude Desktop config.

Site: zenovay.com

Open source MCP server work happening here too? Curious what patterns others have found.

Valerio


Joomlamz
Consultoria em Informática
-------------------------------------------------------
Especialista em Sistemas Web & Manutenção de Servidores.
A desenvolver o novo AplPortal com suporte a PHP 8.
Precisa de ajuda profissional? Contacte-me.

Tags: