revenue-mcp

v1.1.0
@amitsaini4142/revenue-mcp Checked 2 days ago Published 3 months ago

MCP server providing a ping health check and paginated raw 2026 revenue data

MCP server (TypeScript + official SDK) with demo ping and revenue tools. The explicit --registry matters when your default npm registry is a private mirror. Check yours with npm config get registry. yarn start:http serves Streamable HTTP on POST /mcp, bound to 127.0.0.1 on PORT (default 3000). GET and DELETE return 405, and each request gets a fresh stateless server, so there is no session state to keep.

Summary extracted from the README.

@amitsaini4142/revenue-mcp

MCP server (TypeScript + official SDK) with demo ping and revenue tools.

Requires Node.js ≥ 20.

Install / run (stdio)

npx -y --registry=https://registry.npmjs.org/ @amitsaini4142/revenue-mcp

The explicit --registry matters when your default npm registry is a private mirror. Check yours with npm config get registry.

Local development (this repo):

yarn install
yarn start          # stdio via tsx
yarn start:http     # Streamable HTTP on PORT/3000
yarn build          # emit dist/ for publish

HTTP transport

yarn start:http serves Streamable HTTP on POST /mcp, bound to 127.0.0.1 on PORT (default 3000). GET and DELETE return 405, and each request gets a fresh stateless server, so there is no session state to keep.

Set MCP_AUTH_TOKEN to require a bearer token on every /mcp request:

MCP_AUTH_TOKEN=$(openssl rand -hex 32) yarn start:http

Requests then need an Authorization: Bearer <token> header; anything missing, malformed, or wrong gets a 401 with WWW-Authenticate: Bearer. Tokens are compared against a SHA-256 digest with timingSafeEqual, so comparison time does not leak the value. Leaving MCP_AUTH_TOKEN unset disables the check entirely, which is only appropriate on loopback — the startup banner states which mode is active.

Client config for the HTTP transport:

{
  "mcpServers": {
    "revenue-mcp-http": {
      "url": "http://127.0.0.1:3000/mcp",
      "headers": { "Authorization": "Bearer <token>" }
    }
  }
}

Prefer 127.0.0.1 over localhost here: the server binds IPv4 only, and localhost can resolve to ::1. Note the client must already be running for this entry to connect, since nothing launches it on demand the way stdio servers are launched.

Cursor config

Copy this as-is — it contains no machine-specific paths, so it works for anyone on the team. The package is fetched from npm on each launch, so @latest picks up new publishes with no config change.

{
  "mcpServers": {
    "revenue-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "--registry=https://registry.npmjs.org/",
        "--prefix=/tmp",
        "@amitsaini4142/revenue-mcp@latest"
      ]
    }
  }
}

Do not use yarn start for Cursor — it writes to stdout and breaks MCP stdio framing.

Why the two extra flags

Without them Cursor reports only Connection closed, and the real cause is visible in the MCP output panel:

  • --registry avoids npm error code ENOVERSIONS / No versions available, which happens when your default registry is a private mirror that does not proxy this package. Check yours with npm config get registry.
  • --prefix=/tmp avoids npm error code ENOENT on lstat '.../Cursor.app/Contents/Resources/app/resources/lib'. Cursor runs npx under its own bundled Node at Resources/app/resources/helpers/node, and npm derives its global prefix as two directories above the Node binary. That resolves to .../app/resources, so npm looks for a lib directory that does not exist inside the read-only app bundle and aborts. Pointing the prefix at a real directory sidesteps the bad derivation. npm exec installs into npm's own cache rather than the prefix, so nothing is written to /tmp.

Developing tools

  1. Add src/tools/<name>.ts with a registerXTool(server) helper.
  2. Call it from createServer() in src/server.ts.
  3. yarn build before publish.

Demo tool: ping → returns pong.