Grist MCP Server

Connects Claude Desktop to Grist spreadsheets

README.md

Grist MCP Server

MCP (Model Context Protocol) server that connects Claude Desktop to Grist spreadsheets. It dynamically discovers documents, tables, and columns, and lets you read, write, and query data using natural language.

Features

  • list_documents -- browse all orgs, workspaces, and docs
  • list_tables -- discover tables inside a document
  • list_columns -- inspect column names, types, and labels
  • get_records -- read rows with filters, sorting, and limits
  • add_records -- insert new rows
  • update_records -- modify existing rows
  • delete_records -- remove rows by ID
  • query_sql -- run SQL SELECT queries directly

Quick Start

1. Clone and install

git clone <repo-url>
cd grist-mcp-server
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt

2. Configure environment

Copy the example file and fill in your credentials:

cp .env.example .env
Variable Required Description
GRIST_API_KEY Yes API key from your Grist profile
GRIST_BASE_URL Yes Base URL of your Grist instance
GRIST_DOC_ID No Default document ID (saves typing)

3. Run locally (stdio transport)

python server.py

4. Run with HTTP transport (for Render)

MCP_TRANSPORT=streamable-http python server.py

Connect to Claude Desktop

Add the following to your claude_desktop_config.json:

Local (stdio)

{
  "mcpServers": {
    "grist": {
      "command": "python",
      "args": ["/absolute/path/to/server.py"],
      "env": {
        "GRIST_API_KEY": "your_api_key",
        "GRIST_BASE_URL": "https://altitudedm.getgrist.com",
        "GRIST_DOC_ID": "9PRy5Jf5ayS3dDL9iYRHmU"
      }
    }
  }
}

Remote (Render deployment)

{
  "mcpServers": {
    "grist": {
      "url": "https://your-app.onrender.com/mcp"
    }
  }
}

Set environment variables on Render instead of in the config file.

Deploy on Render

  1. Push this repo to GitHub.
  2. Create a new Web Service on Render.
  3. Connect the GitHub repo.
  4. Render will auto-detect the render.yaml configuration.
  5. Add GRIST_API_KEY in the Render dashboard environment variables.
  6. Deploy.

The server will be available at https://your-app.onrender.com/mcp.

Usage Examples

Explore data

You: What documents do I have in Grist?
Claude: (calls list_documents) You have 3 documents: ...

You: Show me the tables in "Client Tracker"
Claude: (calls list_tables) The document has 4 tables: Clients, Projects, Invoices, Notes

You: What columns does the Clients table have?
Claude: (calls list_columns) Columns: name (Text), email (Text), status (Choice), ...

Read and filter

You: Show me the first 10 active clients
Claude: (calls get_records with filter={"status":["active"]}, limit=10)

You: How many invoices were created this month?
Claude: (calls query_sql with SQL: SELECT COUNT(*) FROM Invoices WHERE date >= '2025-01-01')

Write data

You: Add a new client: name=ACME Corp, status=active
Claude: (calls add_records) Created record with ID 42.

You: Mark client 42 as inactive
Claude: (calls update_records with id=42, fields={"status":"inactive"})

You: Delete client 99
Claude: (calls delete_records with record_ids=[99])

Running Tests

pip install pytest pytest-asyncio
pytest tests/ -v

Project Structure

grist-mcp-server/
├── server.py          # MCP server entry point (8 tools)
├── grist_client.py    # Async Grist API client
├── requirements.txt   # Python dependencies
├── render.yaml        # Render deployment config
├── .env.example       # Environment variable template
├── .gitignore
├── tests/
│   └── test_grist_client.py
└── README.md

License

MIT

Tools 8

list_documentsBrowse all orgs, workspaces, and docs
list_tablesDiscover tables inside a document
list_columnsInspect column names, types, and labels
get_recordsRead rows with filters, sorting, and limits
add_recordsInsert new rows
update_recordsModify existing rows
delete_recordsRemove rows by ID
query_sqlRun SQL SELECT queries directly

Environment Variables

GRIST_API_KEYrequiredAPI key from your Grist profile
GRIST_BASE_URLrequiredBase URL of your Grist instance
GRIST_DOC_IDDefault document ID

Try it

What documents do I have in Grist?
Show me the tables in the Client Tracker document.
What columns does the Clients table have?
Show me the first 10 active clients.
How many invoices were created this month?

Frequently Asked Questions

What are the key features of Grist?

Dynamic discovery of Grist documents, tables, and columns. Read and write data using natural language. Support for filtering, sorting, and limiting record retrieval. Direct SQL query execution for complex data analysis. Support for both local stdio and remote HTTP transport.

What can I use Grist for?

Quickly querying spreadsheet data without leaving the Claude interface. Automating data entry by adding new records via natural language commands. Performing complex data analysis on Grist tables using SQL queries. Managing client or project trackers directly through AI-assisted updates.

How do I install Grist?

Install Grist by running: git clone https://github.com/steven-altitude/mcp && cd grist-mcp-server && python -m venv .venv && source .venv/bin/activate && pip install -r requirements.txt

What MCP clients work with Grist?

Grist works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Grist docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Open Conare