Skip to main content
This recipe stands up a minimal TypeScript project that authenticates against the Glide MCP gateway, calls accounts.balance, and prints the parsed response. The wrapper uses fetch with a typed JSON-RPC helper — no heavy SDK required. Audience: TypeScript backend engineers who want a runnable baseline before building their agent logic.

Prerequisites

  • Node 22+ and pnpm.
  • Glide running locally per the main quickstart, or access to a hosted instance.
  • MCP_TOKEN_VERIFIER_DEV_SECRET set in your shell (or in the repo .env).

Steps

1. Clone the example

2. Install dependencies

The example only needs two direct dependencies: jose for JWT signing and zod for runtime receipt validation.

3. Set environment variables

Copy the example env file and fill in your values:
If you have a production Ory endpoint instead of a dev secret, set GLIDE_TOKEN_URL and GLIDE_CLIENT_ID / GLIDE_CLIENT_SECRETsrc/auth.ts detects which path to use.

4. Review the auth helper

src/auth.ts mints a short-lived HMAC-SHA256 JWT for dev, or does client_credentials against Ory for production. The resulting token is stored in module scope with auto-refresh 60 seconds before expiry.

5. Review the RPC helper

src/rpc.ts is a typed wrapper around a single fetch call. It throws on JSON-RPC errors with the error code and data attached so callers can distinguish policy rejections (-32003) from network errors.

6. Run the example

src/main.ts calls accounts.balance, prints the balance, then calls payments.initiate with a $1.00 test payment to a sandbox address.

Run it

Expected output:

Extend it

  • Replace src/main.ts with an Express server that exposes a /pay endpoint — the RPC helper is already reusable.
  • Swap the dev HMAC auth for production Ory client_credentials by setting GLIDE_TOKEN_URL in .env.
  • Add a zod schema on receipt and log a structured event to Datadog on each payment.
  • Chain audit.stream after payments.initiate to confirm event delivery before returning to the caller.
  • Move the token refresh logic to an Inngest function for long-running agent processes.

Source

github.com/darshanbathija/axtior-neobank/tree/main/examples/typescript-quickstart

Reading list