# Deploy a private sales analytics MCP server

A sales analytics MCP server lets an AI agent summarize revenue, find customers, inspect recent orders, and rank products without opening the whole database. Tokay runs it as one Web Service with durable SQLite storage and optional machine access.

Use this pattern when an automation or backend agent needs its own revocable identity instead of a person's login. The tool boundary keeps every request read only and limits the amount of order data returned.

## Facts

- Runtime: Node.js
- Framework: Express and MCP SDK
- Service types: Web Service
- Resources: SQLite
- Required secrets: None

## What it does

The landing page shows the MCP endpoint and ready to run commands for Claude Code and MCP Inspector.

Ask how sales performed over a period, search for a customer such as Maya, request recent orders, or compare the products leading revenue. Each tool accepts a small bounded input rather than arbitrary SQL.

You can test the endpoint while the Project is public, then protect it with a Tokay machine token before a headless agent begins regular work.

## Deploy it

Bring this folder to Tokay any way you like. Paste or upload it in the dashboard, push it with git, or hand it to your AI agent along with [our agent instructions](https://app.tokay.io/llms.txt). Tokay figures out the rest.

Working in Claude, ChatGPT, VS Code, or another MCP client? Connect the [Tokay MCP server](https://tokay.io/docs/platform-mcp) and ask your agent to deploy this example. It signs in through your browser, so there is no token to paste.

New to Tokay? The [getting started guide](https://tokay.io/getting-started) walks you through your first deploy.

## Test it while the Project is public

The landing page gives you the exact command for connecting Claude Code. Run it, then ask Claude `How were sales last week?`

If you want to test the tools without a model, use the MCP Inspector command shown on the same page.

## Connect a headless agent with a machine token

1. Choose **App audience** in the Project.
2. Set **Audience** to **Specific people**. Keep the people you want, then choose **Save audience** and confirm with **Save**.
3. Under **Machine tokens**, choose **Create token**. Name it `claude-orders`, choose **Create**, and copy the full token from the next dialog. Save it now because Tokay shows it once.
4. Run the private Claude Code command shown on the app's landing page. Replace `<machine-token>` with the value you just copied.
5. Ask Claude `What sold best in the last 30 days?` Then check **Access log** in Tokay to see the machine token call.

This machine token only lets a program call the private app. It cannot deploy code or manage Tokay.

The token represents the automation, not a person, and can be revoked independently from any human account. Claude Code and other MCP clients that accept bearer headers can use it directly.

## Try it

1. Ask `How were sales last week?` and note the order count and revenue.
2. Deploy the same code again.
3. Repeat the question. The same seeded order history remains in SQLite.

## How it works

You can trust the access boundary because the server exposes named MCP tools rather than a database prompt. Each tool validates its inputs, runs one bounded query, and returns only the requested result.

The app adds its fictional order history only when the SQLite database is empty. Tokay preserves that file through restarts and deployments. Read [Files and persistent storage](https://tokay.io/docs/persistent-storage) to see how the data is protected.

## Secrets

You do not need a Project Secret. Private access uses a machine token created under **App audience**, while public smoke tests need no credential.

## Grow from here

Try the [OAuth task inbox](/examples/node-express-sqlite-oauth-mcp-task-list) when each person should authorize an MCP client with their own email and see only their own data.

## Source files

- [package.json](https://tokay.io/examples/src/node-express-sqlite-mcp-orders/package.json)
- [src/server.ts](https://tokay.io/examples/src/node-express-sqlite-mcp-orders/src/server.ts)
- [tsconfig.json](https://tokay.io/examples/src/node-express-sqlite-mcp-orders/tsconfig.json)

## Download and source

- [Download the complete project](https://tokay.io/examples/downloads/node-express-sqlite-mcp-orders.zip)
- Last updated: 2026-07-31
- Example revision: `52c7b7f`
- [View this revision on GitHub](https://github.com/tokayio/tokay-examples/tree/52c7b7ffd52e157375b08f1f11ff4fbe6c498642/node-express-sqlite-mcp-orders)
- [Deploy an MCP server](https://tokay.io/use-cases/deploy-mcp-server)
