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
Discussion
Take the lead—comment now
Lead the way—your insights can inspire others.