Skip to main content
Glama
Saifalkayali

YNAB MCP Starter

by Saifalkayali

YNAB MCP Starter

Production-style TypeScript starter repo for a read-only YNAB MCP server.

This starter is intentionally small and explicit:

  • Node.js 18+

  • TypeScript with strict compiler settings

  • Zod-validated tool inputs and outputs

  • Read-only YNAB API client with retries and timeout handling

  • Unit tests with mocked YNAB responses

  • Clear TODO markers where MCP transport wiring should be connected

What This Repo Includes

src/
  clients/   YNAB API client, environment config, and error types
  schemas/   strict Zod schemas for tool contracts
  server/    MCP server composition and transport TODO placeholders
  tools/     read-only business logic for each YNAB capability
  types/     shared API and service types
tests/       unit tests with mocked API responses

Implemented read-only capabilities:

  • list budgets

  • list accounts

  • list categories

  • list recent transactions

  • find uncategorized transactions

  • monthly spend by category

Write access is intentionally not implemented.

Related MCP server: MCP Server Starter

Setup

  1. Install dependencies:

npm install
  1. Copy the example environment file:

cp .env.example .env
  1. Set your YNAB token in .env:

YNAB_TOKEN=your-token-here
  1. Run local development mode:

npm run dev

Scripts

  • npm run build compiles TypeScript into dist/

  • npm run dev runs the starter entrypoint with file watching

  • npm run lint runs ESLint

  • npm run test runs unit tests with Vitest

  • npm run typecheck runs TypeScript in no-emit mode

MCP Wiring

The repo includes the server composition layer, but it does not lock you into one transport yet.

Look for TODO comments in:

That is where you should:

  1. Instantiate the MCP server

  2. Register tool definitions and schemas

  3. Connect stdio, SSE, or another transport

  4. Add structured logging and operational hooks

Security Notes

  • This starter expects a YNAB_TOKEN personal access token in environment variables.

  • Never hardcode the token in source files, tests, prompts, or logs.

  • Keep the token scoped to read-only operational use and rotate it if it is exposed.

  • Avoid logging raw YNAB API responses in production because they may contain transaction memos or other sensitive financial metadata.

  • This starter only performs GET requests to the YNAB API. No write endpoints are implemented.

Design Notes

  • The YNAB client centralizes retries, timeout handling, and error normalization.

  • Tool modules are isolated from HTTP details and operate on a small service interface.

  • Zod schemas validate both tool inputs and tool outputs to catch drift early.

  • Money amounts are exposed in both YNAB milliunits and human-friendly decimal amounts.

  • Monthly category spend only counts outflows for the requested month.

Example Prompts

  • "List my YNAB budgets."

  • "Show the accounts in budget budget-id-123."

  • "List categories for budget budget-id-123."

  • "Show the most recent 20 transactions in budget budget-id-123."

  • "Find uncategorized transactions in budget budget-id-123 since 2026-04-01."

  • "Summarize monthly spend by category for budget budget-id-123 in 2026-04."

Testing

The tests mock YNAB API responses so you can validate behavior without a live token:

npm run test

Production Hardening Ideas

  • Add request correlation IDs and structured logs

  • Add metrics around retries, rate limiting, and latency

  • Add integration tests against a mocked HTTP layer

  • Add result pagination controls if your MCP client expects larger result sets

  • Add a secrets manager integration instead of local .env files for deployment

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    A minimal, production-ready TypeScript starter template for building Model Context Protocol (MCP) servers with auto-loading architecture for tools, resources, and prompts. Provides boilerplate code, generators, and examples to quickly create MCP servers that can connect AI applications to any data source or tool.
    -
  • -
    license
    Not graded
    quality
    Not graded
    maintenance
    A production-ready starter template for building Model Context Protocol (MCP) servers with TypeScript. Includes automated tooling for creating new MCP tools, testing, and deployment to Claude Desktop.
    28 npm
    -
  • A
    license
    A
    quality
    Not graded
    maintenance
    A production-ready TypeScript template for building MCP servers with dual transport support (stdio/HTTP), OAuth 2.1 foundations, SQLite caching, observability, and security features including PII sanitization and rate limiting.
    4
    9 npm
    -
  • A
    license
    B
    quality
    D
    maintenance
    A TypeScript starter template for building MCP servers with example tools (echo, math operations, time, flight status) and resources (server info, greetings). Provides a modular architecture for easily extending with custom tools and resources.
    4
    13 npm
    ISC