Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:AI4Finance Foundation FinGPT Plaid MCP Server

From Leeroopedia
Knowledge Sources
Domains MCP_Server, Bank_Connectivity, Fintech_Infrastructure
Last Updated 2026-10-18 00:00 GMT

Overview

Concrete tool for bank account connectivity (Plaid Link + Plaid Transfer) behind the MCP tool interface for collections flow provided by the Finogrid platform within FinGPT.

Description

The Plaid MCP Server is a FastAPI app (port 9006) that abstracts Plaid Link and Plaid Transfer behind a standard MCP tool interface. Capabilities include: creating a Plaid Link token, exchanging a public token for an access token, retrieving verified account metadata + balance, initiating an ACH pull (collection from a payer bank → Finogrid USDC), polling transfer status, and processing Plaid transfer webhooks. Settings are loaded from environment variables via `PlaidSettings`.

Usage

Run this server when you need to integrate bank-account-linked collections (ACH debit pulls) into the Finogrid platform. Requires Plaid API credentials (client ID, secret, environment).

Code Reference

Source Location

Signature

class PlaidSettings(BaseSettings):
    plaid_client_id: str = ""
    plaid_secret: str = ""
    plaid_env: str = "sandbox"          # sandbox | development | production
    plaid_country_codes: list[str] = ["US", "GB", "CA"]
    plaid_redirect_uri: str = ""
    app_host: str = "0.0.0.0"
    app_port: int = 9006

class CreateLinkTokenRequest(BaseModel):
    client_id: str
    user_legal_name: str
    user_email: str
    products: list[str] = ["auth", "transactions"]

class ExchangePublicTokenRequest(BaseModel):
    client_id: str
    public_token: str

class InitiateAchPullRequest(BaseModel):
    client_id: str
    amount_usd: float
    description: str = "Finogrid USDC top-up"
    idempotency_key: str

app: FastAPI  # title="Finogrid Plaid MCP", version="1.0.0"

def _get_plaid_client():
    """Return a configured plaid.ApiClient instance and plaid_api module."""

# Endpoints:
@app.get("/health") -> dict
@app.post("/tools/create_link_token") -> dict
@app.post("/tools/exchange_public_token") -> dict
@app.post("/tools/get_account_info") -> dict
@app.post("/tools/initiate_ach_pull") -> dict
@app.post("/tools/get_transfer_status") -> dict
@app.post("/tools/handle_webhook") -> dict

Import

from finogrid.mcp.plaid.server import app, PlaidSettings
# Or run as: uvicorn finogrid.mcp.plaid.server:app --port 9006

I/O Contract

Inputs

Name Type Required Description
client_id str Yes Finogrid client identifier
public_token str Yes (exchange) Plaid Link public token from client-side flow
amount_usd float Yes (ach_pull) ACH debit amount in USD
idempotency_key str Yes (ach_pull) Idempotency key for the transfer
transfer_id str Yes (status) Plaid transfer identifier

Outputs

Name Type Description
link_token str Plaid Link token for client-side widget
access_token str Stored Plaid access token (in-memory for MVP)
account_info dict Verified account metadata + balance
transfer_id str Plaid transfer identifier for ACH pull
transfer_status dict Transfer status record

Usage Examples

Initiate a Bank-Linked Collection

import httpx

base = "http://localhost:9006"

# 1. Create a Plaid Link token for the client
resp = httpx.post(f"{base}/tools/create_link_token", json={
    "client_id": "client-123",
    "user_legal_name": "Jane Doe",
    "user_email": "jane@example.com",
})
link_token = resp.json()["link_token"]
# ... client completes Plaid Link UI, returns public_token ...

# 2. Exchange public token for access token
resp = httpx.post(f"{base}/tools/exchange_public_token", json={
    "client_id": "client-123",
    "public_token": "public-sandbox-xxx",
})

# 3. Initiate an ACH pull for collection
resp = httpx.post(f"{base}/tools/initiate_ach_pull", json={
    "client_id": "client-123",
    "amount_usd": 500.0,
    "idempotency_key": "unique-key-001",
})
transfer_id = resp.json()["transfer_id"]

# 4. Poll transfer status
status = httpx.post(f"{base}/tools/get_transfer_status",
                    json={"transfer_id": transfer_id})
print(status.json())

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment