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

> Source: <https://dev.to/zenovay/building-an-mcp-server-so-claude-can-query-my-saas-analytics-directly-49cg>
> Published: 2026-05-23 13:26:52+00:00

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

``` js
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

``` js
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](https://zenovay.com)

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

Valerio
