Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

revenuecat-mcp

A Model Context Protocol server for the RevenueCat Developer API v2, exposing all 68 endpoints through two tools instead of 68 — using the code-mode pattern.

Why two tools instead of 68?

Most MCP servers map one MCP tool to one API endpoint. That works for small APIs, but it eats tool-list tokens linearly and forces the agent to orchestrate many small calls.

This server uses code mode: the agent writes JavaScript that runs inside a sandboxed VM with two globals — spec (the full OpenAPI spec) and api (an authenticated REST client) — and the LLM orchestrates whatever sequence it needs in a single round trip.

  • search(code) — write JS that queries the OpenAPI spec (e.g. "find all offering-related endpoints")
  • execute(code) — write JS that calls the authenticated API (e.g. "list projects → fetch offerings for the first one → return just the lookup_keys")
  • test_connection — zero-arg sanity check

Benefits: fixed tool-list cost, multi-step workflows in one execution, full spec introspection, error handling via plain try/catch.

Install

git clone https://github.com/TrialAndErrorAI/revenuecat-mcp.git
cd revenuecat-mcp
npm install
cp .env.example .env
# Edit .env with your REVENUECAT_API_KEY (sk_... from RevenueCat dashboard → Project settings → API keys v2)
npm run build
npm run test:connection  # live GET /projects sanity check

Register with Claude Code (or any MCP host)

Add to your project's .mcp.json:

{
  "mcpServers": {
    "revenuecat": {
      "command": "node",
      "args": ["/absolute/path/to/revenuecat-mcp/dist/index.js"],
      "env": {
        "REVENUECAT_API_KEY": "sk_xxxxxxxxxxxxxxxxxxxxxxxxxx"
      }
    }
  }
}

Restart the host. Tools appear as mcp__revenuecat__search, mcp__revenuecat__execute, mcp__revenuecat__test_connection.

Tool usage

search — explore the spec

// List every offering-related endpoint with its HTTP method and summary
Object.entries(spec.paths)
  .filter(([p]) => p.toLowerCase().includes('offering'))
  .map(([path, methods]) => ({
    path,
    methods: Object.entries(methods).map(([m, op]) => ({
      method: m.toUpperCase(),
      summary: op.summary
    }))
  }))

Globals available in search:

  • spec — resolved OpenAPI spec (spec.paths, spec.info, spec.tags)
  • Standard JS: JSON, Object, Array, Math, Date, Promise, etc.
  • No fs, network, or process — sandbox is sealed.

execute — call the API

// List projects, then fetch offerings for the first one
const projects = await api.request({ method: 'GET', path: '/projects' });
const projectId = projects.items[0].id;
const offerings = await api.request({
  method: 'GET',
  path: '/projects/' + projectId + '/offerings'
});
return {
  project: projects.items[0].name,
  offerings: offerings.items.map(o => ({ id: o.id, lookup_key: o.lookup_key }))
};

Globals available in execute:

  • api.request({ method, path, params?, body? }) — authenticated client
  • Base URL is pre-set to https://api.revenuecat.com/v2, so paths start with /.
  • Same standard JS as search.

Endpoint coverage

68 endpoints across 16 tags: App, Audit Log, Charts & Metrics, Collaborator, Customer, Entitlement, Offering, Package, Product, Virtual Currency, Purchase, Subscription, Invoice, Paywall, Integration, Project.

Spec is bundled at src/spec/openapi.yaml — update in place and npm run build when RevenueCat ships new endpoints.

Auth

RevenueCat v2 uses Bearer tokens. Generate a key in the RevenueCat dashboard:

  • Secret key (sk_*) — full read/write scope, server-side only. Use this.
  • Public key (pk_*) — read-only, client-safe. Not used by this server.

Keep your secret key in .env (gitignored). Never commit it, never pass it via CLI args.

Project layout

src/
  index.ts                 # entry point — env load + bootstrap
  server/mcp-server.ts     # two-tool MCP server
  auth/bearer.ts           # Bearer header builder
  api/client.ts            # axios wrapper for api.revenuecat.com/v2
  executor/sandbox.ts      # vm-based JS sandbox
  spec/loader.ts           # OpenAPI YAML parser + $ref resolver
  spec/openapi.yaml        # bundled RevenueCat Developer API spec
  types/                   # config + api types
  test-connection.ts       # standalone live connectivity test

Development

npm run dev             # tsx watch on src/index.ts
npm run type-check      # tsc --noEmit
npm run build           # emit dist/ and copy the spec
npm run test:connection # live smoke test (requires .env)

Inspired by

The code-mode pattern here is ported from appstore-connect-mcp (same authors). See that repo for the App Store Connect version of this pattern (923 endpoints, same two tools).

License

MIT — see LICENSE.

Disclaimer

This is an unofficial, community-maintained MCP server. It is not affiliated with or endorsed by RevenueCat, Inc. "RevenueCat" is a trademark of RevenueCat, Inc.

About

Code-mode MCP server for the RevenueCat Developer API — 68 endpoints through 2 tools

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages