Skip to main content

Overview

Grain exposes a read-only remote MCP server for AI agents and connector platforms, including ChatGPT, Claude, Cursor, and other MCP clients. MCP uses the same Grain OAuth identity and organization permissions as the REST API.
ItemValue
MCP endpointhttps://api.grainledger.com/mcp
TransportStreamable HTTP
AuthOAuth 2.1 (Sign in with Grain)
Access modeRead-only tools only, with structured JSON results
Org scopingPer tool call via organizationId

Authentication flow

  1. MCP client discovers protected resource metadata from Grain.
  2. Client completes OAuth 2.1 authorization code + PKCE with the Grain authorization server.
  3. Grain issues a Supabase OAuth access token for the signed-in user.
  4. Client calls MCP tools with Authorization: Bearer <access_token>.
  5. For data tools, pass organizationId from list_organizations.

Protected resource metadata

GET https://api.grainledger.com/.well-known/oauth-protected-resource
Returns OAuth Protected Resource Metadata (RFC 9728) with:
  • resource: https://api.grainledger.com/mcp
  • authorization_servers: Grain OAuth issuer
Unauthenticated MCP requests receive 401 with:
WWW-Authenticate: Bearer resource_metadata="https://api.grainledger.com/.well-known/oauth-protected-resource"
See Authentication for OAuth endpoints and consent.

Organization scoping

MCP access tokens identify the signed-in user. Every data tool also requires organizationId so Grain knows which church’s data to read:
  1. Call list_organizations to get church IDs the user belongs to.
  2. Pass organizationId on subsequent tool calls.
  3. Permissions follow the user’s role in that organization (same as the REST API).
Optional: call get_my_permissions to inspect allowed actions before querying data.

Available tools (read-only)

ToolDescription
list_organizationsChurches the user can access
get_my_permissionsUser permissions in one organization
list_transactions / get_transactionMinimized bank transaction data
list_bills / get_billMinimized vendor bills and payment summaries
list_donors / get_donorDonors; contact PII is opt-in on detail calls
list_contributions / get_contributionContributions without processor metadata
list_pledges / get_pledgePledges and progress
list_households / get_householdHouseholds; member contact PII is opt-in
list_accountsChart of accounts
list_fundsFund summaries
list_vendorsVendors without contact, bank, or tax identifiers
list_journal_entriesJournal entry summaries and posting status
list_budgetsAccessible budgets and IDs for budget reporting
get_financial_overviewCustomer-ready period summary with comparison, transfers, balance sheet, funds, budget, reconciliation, and warnings
get_statement_of_activitiesStatement of Activities for a period
get_balance_sheetBalance Sheet with validation warnings
get_fund_balance_reportFund balances, including cash-only view
get_trial_balanceTrial balance and balance validation
get_general_ledgerAccount-scoped general ledger activity
get_budget_vs_actualBudget-versus-actual reporting
get_reconciliation_statusReconcilable accounts and in-progress work
All tools are annotated readOnlyHint: true and return structuredContent validated against an output schema. JSON text is included for compatibility. Write operations are not exposed through MCP. For broad prompts such as “Give me last month’s financial picture,” start with get_financial_overview. It separates interfund transfers from operating results, compares with the previous period or prior year, rounds currency amounts to cents, and surfaces accounting-quality warnings. Use the detailed report tools for follow-up questions. List tools intentionally return summary DTOs rather than Grain’s internal database or UI models. Billing identifiers, integration metadata, provider payloads, and unrelated PII are excluded. Organization permissions still apply on every tool call.

Connect in Cursor

Install Grain in Cursor with one click, or add the configuration manually.

Add to Cursor

Install Grain’s remote MCP server in Cursor.
Manual configuration:
{
  "mcpServers": {
    "grain": {
      "url": "https://api.grainledger.com/mcp"
    }
  }
}
Cursor will prompt you to complete Sign in with Grain when it connects to the production MCP endpoint.

Connect in ChatGPT

In ChatGPT, add Grain as a connector when it is available to your workspace. Use the MCP URL https://api.grainledger.com/mcp and complete the Sign in with Grain flow when prompted.

Revoking access

Users approve access on the Grain OAuth consent screen. To revoke:
  1. Sign in to Grain at https://app.grainledger.com
  2. Remove the connected application from your account (OAuth connected apps)
  3. Or deny future authorization requests from that client

Example prompts

After connecting an MCP client, these prompts are useful smoke tests:
  1. “List my Grain organizations”
  2. “What permissions do I have in organization {orgId}?”
  3. “Show the 10 most recent transactions for organization {orgId}
  4. “List open bills for organization {orgId}
Expected behavior: read-only structured JSON results. If the user’s role lacks the required permission, Grain returns a stable permission error. Invalid dates should be corrected to YYYY-MM-DD.
Last modified on July 9, 2026