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.
MCP access is included on Growth and Enterprise. The organization you query must have an active paid subscription.

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

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:
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)

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:
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 August 5, 2026