Skip to main content
Glama
plaid-mcp

plaid-mcp

by cikasfm
README.md
# plaid-mcp

[![CI](https://github.com/cikasfm/plaid-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/cikasfm/plaid-mcp/actions/workflows/ci.yml)
[![Coverage](https://img.shields.io/badge/coverage-100%25%20lines%20%7C%2090%25%2B%20enforced-brightgreen)](https://github.com/cikasfm/plaid-mcp/actions/workflows/ci.yml)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)

A local-first, **Cloudflare-Workers-ready** TypeScript [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server for querying your personal banking accounts, transactions, recurring bills, liabilities, and investments via **Plaid**.

---

## Agent Self-Setup (Zero-Friction)

Want your AI coding agent (Antigravity, Claude Code, Codex, Cursor, etc.) to install and wire this up for you automatically? Paste this into your agent:

> Set up `https://github.com/cikasfm/plaid-mcp` for me following the **Agent Runbook** in its README.

### Agent Runbook

If you are an AI agent setting up `plaid-mcp` for the user, follow these steps in order:

1. **Prerequisites check**
   - Verify Node.js `>= 18` (`node -v`) and `npm` are available.
   - Choose an install directory (default: `~/dev/plaid-mcp`).

2. **Clone, install, and build**
   ```bash
   git clone https://github.com/cikasfm/plaid-mcp.git ~/dev/plaid-mcp
   cd ~/dev/plaid-mcp
   npm install
   npm run build
   ```

3. **Configure Plaid credentials securely (DO NOT ask the user to paste secrets in chat)**
   - Ask the user to copy their Plaid `client_id` and `secret` from the [Plaid Dashboard](https://dashboard.plaid.com/developers/keys) and run these commands locally in their own terminal (keeps secrets out of chat history, git, and MCP config files):
   - **macOS (`pbpaste`):**
     ```bash
     mkdir -p ~/.plaid-mcp && chmod 700 ~/.plaid-mcp
     # After copying PLAID_CLIENT_ID:
     printf 'PLAID_CLIENT_ID=%s\n' "$(pbpaste | tr -d '\r\n')" > ~/.plaid-mcp/.env
     # After copying PLAID_SECRET (use PLAID_ENV=sandbox to test first, or production for live banks):
     printf 'PLAID_SECRET=%s\nPLAID_ENV=production\nPLAID_PRODUCTS=transactions\nPLAID_COUNTRY_CODES=US\n' "$(pbpaste | tr -d '\r\n')" >> ~/.plaid-mcp/.env
     chmod 600 ~/.plaid-mcp/.env
     ```
   - **Linux / Windows:** Instruct the user to copy `.env.example` to `~/.plaid-mcp/.env`, fill in `PLAID_CLIENT_ID`, `PLAID_SECRET`, and `PLAID_ENV` (`production` or `sandbox`), and restrict permissions (`chmod 600 ~/.plaid-mcp/.env`).
   - *Optional:* If the user wants brokerage holdings (`get_investments`) or APR/loan details (`get_liabilities`) and has those products enabled in Plaid, set `PLAID_PRODUCTS=transactions,investments,liabilities`.

4. **Link bank accounts via local Plaid Link**
   - Once the user confirms `~/.plaid-mcp/.env` is written, start the local Link helper in the background:
     ```bash
     node ~/dev/plaid-mcp/dist/link.js
     ```
     *(For quick Sandbox testing without a browser, run `node ~/dev/plaid-mcp/dist/link.js --sandbox` instead.)*
   - Tell the user to open `http://localhost:8787`, click **Connect Bank via Plaid Link**, and link all desired institutions.
   - Tokens are saved locally to `~/.plaid-mcp/tokens.json` (`0600`).
   - **Important:** Once the user says they are done linking banks, **stop the background `link.js` server** so the local token-exchange endpoint is not left running.

5. **Register `plaid-mcp` in the user's MCP config**
   - Merge the following entry into the existing `mcpServers` object (do not overwrite other servers):
     - **Antigravity:** `~/.gemini/config/mcp_config.json`
     - **Claude Desktop (macOS):** `~/Library/Application Support/Claude/claude_desktop_config.json`
     - **Cursor:** `~/.cursor/mcp.json`
   ```json
   {
     "mcpServers": {
       "plaid-mcp": {
         "command": "node",
         "args": ["/ABSOLUTE/PATH/TO/plaid-mcp/dist/index.js"]
       }
     }
   }
   ```
   *(Replace `/ABSOLUTE/PATH/TO/plaid-mcp` with the resolved absolute path—never use `~` in `args`.)*

6. **Verify end-to-end**
   - Run `node ~/dev/plaid-mcp/dist/link.js --list` to confirm all linked institutions are saved.
   - Once the MCP client loads `plaid-mcp`, call `list_institutions` and `get_accounts` to verify live balances and present a clean summary to the user.

---

## Tools Exposed

| Tool | Description |
| :--- | :--- |
| `list_institutions` | List connected banks / Plaid Items |
| `get_accounts` | List all accounts with balances (uses `/accounts/get` by default; optional `realtime_balance: true`) |
| `get_transactions` | Query & filter transactions by date, institution, account, merchant, category, and amount |
| `get_spending_summary` | Aggregate spend & income by category, month, and top merchants (excludes internal transfers & overdraft protection transfers by default) |
| `sync_transactions` | Incremental `/transactions/sync` with persisted cursor |
| `get_recurring_transactions` | Recurring bills, subscriptions, and paychecks |
| `get_liabilities` | Credit card APRs, minimum payments, and loan balances (if enabled) |
| `get_investments` | Brokerage holdings and securities (if enabled) |

---

## Manual CLI Reference

```bash
# Link one or more banks in your browser (http://localhost:8787)
npm run link

# Instantly link Plaid's sandbox test bank (requires PLAID_ENV=sandbox)
npm run link -- --sandbox

# List currently linked banks
npm run link -- --list

# Remove a linked bank
npm run link -- --remove <item_id>
```

---

## Architecture & Cloudflare Workers Readiness

- **`src/plaid-client.ts`** — Pure Web-standard `fetch` Plaid REST client (zero Node-only dependencies).
- **`src/server.ts`** — Runtime-agnostic `McpServer` factory (`createPlaidMcpServer(client, store)`).
- **`src/types.ts`** — Pluggable `TokenStore` interface so local JSON storage (`src/store.ts`) can be swapped for **Cloudflare KV / D1 / Durable Objects** without changing any MCP tool logic.
- **`src/index.ts`** — Local Stdio MCP entrypoint.
- **`src/link.ts`** — Local browser Plaid Link helper with OAuth redirect support (`/oauth-return`).

To deploy to **Cloudflare Workers**:
1. Implement `TokenStore` backed by Cloudflare KV or D1.
2. Mount `createPlaidMcpServer(client, kvStore)` behind Cloudflare's `agents` (`McpAgent`) or Streamable HTTP transport with OAuth/Bearer auth.

## Security Notes

- All API keys (`~/.plaid-mcp/.env`) and Plaid `access_token`s (`~/.plaid-mcp/tokens.json`) are stored strictly outside this repository with `0600` permissions.
- All MCP tools are **read-only**—they cannot initiate transfers, payments, or trades.
- Never commit `.env` or `tokens.json`.

TDQS

A3.7/5.0

Scored across 8 tools

Disambiguation5/5

The four transaction-related tools are cleanly separated: get_transactions fetches raw data, get_spending_summary aggregates it, sync_transactions manages the incremental cursor, and get_recurring_transactions detects subscriptions/paychecks. Each tool targets a distinct resource or operation with no genuine overlap.

Naming Consistency4/5

All names are snake_case with a verb_noun structure (get_accounts, sync_transactions, list_institutions), which is highly predictable. The minor blemish is mixing 'get_' and 'list_' for retrieval operations (list_institutions vs get_accounts), but this is a small deviation.

Tool Count5/5

Eight tools is well within the sweet spot and each maps to a concrete Plaid data domain (accounts, transactions, spending, recurring, liabilities, investments). No tool feels redundant or filler.

Completeness4/5

The read/query surface is broad: institutions, accounts, raw and aggregated transactions, incremental sync, recurring streams, liabilities, and investments. Gaps exist around item lifecycle (creating a link token, removing/disconnecting an item) and the higher-level /identity or balance endpoints, but core analysis workflows are covered.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues