---
title: "OpenCode + Pixeltable"
description: "Open-source, provider-agnostic coding agent for the terminal."
vendor: "SST"
agent_url: "https://opencode.ai"
url: "https://pixeltable.com/agents/opencode"
---

# OpenCode + Pixeltable

Open-source, provider-agnostic coding agent for the terminal.

OpenCode is an open-source, provider-agnostic coding agent for the terminal. It reads and writes files, runs commands, and supports remote and local MCP servers through opencode.json, so both Pixeltable MCP surfaces are one config block away.

## Quick start

1. **Install OpenCode**: Or use the install script from opencode.ai.

```bash
npm install -g opencode-ai
opencode
```

2. **Install Pixeltable**: Python 3.11+ required. `pxt init` marks the project root; schema and service commands refuse an app without one.

```bash
pip install -U 'pixeltable[serve]'
pxt init
```

3. **Add the Pixeltable Skill**: The Skill teaches the agent table/schema patterns, provider integrations, and anti-patterns. Source: https://github.com/pixeltable/pixeltable-skill

```bash
npx skills add pixeltable/pixeltable-skill
npx skills list
```

4. **Ship a first app**: Declare the schema, serve the HTTP routes, then experiment in the dashboard. Cloud deploy uses the same app.py: set PIXELTABLE_API_KEY, add `[[pixeltable.database]]` with `name = 'pxt://org:db'`, then `pxt db update`, `pxt schema update`, `pxt service update` in that order.

```bash
pxt service example --out app.py
pxt schema update app.py my_app
pxt service update app.py my_app
pxt dashboard
```

## MCP configuration

| Server | Transport | What it can do |
| --- | --- | --- |
| pixeltable-web | HTTP | Read-only docs search and integration listing at https://pixeltable.com/mcp. No table mutations. |
| pixeltable-developer | stdio | Inspect schemas, query tables, run a REPL against a local or Cloud catalog. |

### Connect the WebMCP (docs search, no auth)

Merge this into `~/.config/opencode/opencode.json` (or a project-level `opencode.json`):

```json
{
  "mcp": {
    "pixeltable-web": {
      "type": "remote",
      "url": "https://pixeltable.com/mcp",
      "enabled": true
    }
  }
}
```

### Connect the developer MCP (tables + REPL)

Install the server once per machine (step below), then add a local entry to the same `mcp` block:

```json
{
  "mcp": {
    "pixeltable-developer": {
      "type": "local",
      "command": [
        "mcp-server-pixeltable-developer"
      ],
      "enabled": true
    }
  }
}
```

### Install the developer MCP server

Stdio server that inspects schemas, queries tables, and runs a REPL against a local or Cloud catalog. Repository: https://github.com/pixeltable/mcp-server-pixeltable-developer

```bash
uv tool install --from git+https://github.com/pixeltable/mcp-server-pixeltable-developer.git mcp-server-pixeltable-developer
# if uv is missing:
# curl -LsSf https://astral.sh/uv/install.sh | sh
```

## Example prompts

- "Install Pixeltable and set up a table that embeds every image I insert."
- "Build a RAG pipeline over the PDFs in ./docs and expose a FastAPI route that answers questions."
- "Transcribe every video in ./media with Whisper, index the transcript, and serve semantic search over HTTP."
- "Add a computed column that captions each uploaded image with a vision model."
- "Scaffold app.py with pxt service example, declare the schema, and start the service."
- "Take app.py and deploy it to my Pixeltable Cloud database pxt://org:db."
- "Build a background-remover API: image in, background removed, POST endpoint."

## Common workflows

### Set up a Pixeltable app

1. Hand the agent https://pixeltable.com/get-started.md and let it run the playbook
2. It installs the pxt CLI and the Pixeltable Skill
3. It scaffolds app.py, declares the schema, starts the service
4. It verifies the endpoint with a curl request

### Build a multimodal pipeline

1. Describe the pipeline: ingest media, run models, index results
2. The agent declares the table and computed columns in app.py
3. It adds an embedding index and an HTTP route that serves results
4. Insert a row; computed columns run and indexes stay current

### Deploy to Pixeltable Cloud

1. Ask the agent to deploy app.py to Cloud
2. It pauses for your org slug and an sk_... API key (human step)
3. It runs pxt db update, pxt schema update, pxt service update in order
4. It calls the hosted endpoint at https://<org>-<db>.svc.pxt.run to verify

### Inspect a catalog over MCP

1. Connect the pixeltable-developer MCP server
2. The agent lists tables and views in the catalog
3. It runs read queries and reports schema and row counts
4. Keep human confirmation on: the developer server can change local catalog state

## Tips for success

- Hand the agent https://pixeltable.com/get-started.md; it is the canonical setup playbook.
- Point the agent at https://pixeltable.com/llms.txt after setup for the one-file app.py Quick Start.
- Keep human confirmation enabled for MCP mutations; the developer server can change catalog state.
- Let the agent run `pxt schema diff` before `pxt service update` to preview schema drift.
- For Cloud deploys the agent pauses for sign-in and the API key; everything else it can do itself.
- An AGENTS.md in the repo with a get-started.md link gives OpenCode the playbook every session.
- Project-level opencode.json travels with the repo; global config applies everywhere.

## Frequently asked questions

### Can OpenCode set up Pixeltable on its own?

Yes. Give OpenCode https://pixeltable.com/get-started.md: it installs the pxt CLI, adds the Pixeltable Skill, and connects MCP. It pauses only for Cloud sign-in and the org API key, which are human steps.

### Which Pixeltable MCP server should I connect?

pixeltable-web (https://pixeltable.com/mcp) is a remote server for read-only docs search. pixeltable-developer is a stdio server that inspects schemas, queries tables, and runs a REPL against a local or Cloud catalog. Connect the one the job needs.

### Can OpenCode deploy to Pixeltable Cloud?

Yes, through the pxt CLI. OpenCode runs `pxt db update`, `pxt schema update`, and `pxt service update` against `pxt://org:db`. Creating the organization and the API key stays with you.

### Does the Pixeltable Skill work with OpenCode?

Yes. `npx skills add pixeltable/pixeltable-skill` installs it for the current agent and teaches table/schema patterns, provider integrations, and anti-patterns.

## Troubleshooting

**Issue:** The Pixeltable Skill is not visible after install

**Solution:** Reload or restart the agent. Confirm the install path with `npx skills list` and that the skill targets the current agent.

**Issue:** The agent does not list the MCP server

**Solution:** Validate the config file JSON. pixeltable-web is a remote HTTP server at https://pixeltable.com/mcp; pixeltable-developer is a stdio command, `mcp-server-pixeltable-developer`. Verify the server is installed with `mcp-server-pixeltable-developer --help`.

**Issue:** `pxt service check` fails: modifies catalog while imported

**Solution:** app.py must declare TableModel tables and FastAPIRouter routes, not run pxt.create_table() at import. Scaffold with `pxt service example`.

**Issue:** Cloud deploy fails with 404: UDF not found

**Solution:** Order is required: `pxt db update pxt://org:db`, then `pxt schema update app.py pxt://org:db`, then `pxt service update app.py pxt://org:db`.

## Related agents

- [Devin + Pixeltable](https://pixeltable.com/agents/devin) - Autonomous AI software engineer. Plans, codes, debugs, and deploys independently.
- [Claude Code + Pixeltable](https://pixeltable.com/agents/claude-code) - Agentic coding in your terminal. Understands your codebase, runs commands, and edits files.
- [Cursor + Pixeltable](https://pixeltable.com/agents/cursor) - The AI-first IDE. Agent mode edits across files, runs commands, and iterates on errors.

## Resources

- [Agent setup playbook](https://pixeltable.com/get-started.md)
- [Site overview for agents (llms.txt)](https://pixeltable.com/llms.txt)
- [Pixeltable Skill](https://github.com/pixeltable/pixeltable-skill)
- [Developer MCP server](https://github.com/pixeltable/mcp-server-pixeltable-developer)
- [Pixeltable docs](https://docs.pixeltable.com)
- [OpenCode](https://opencode.ai)
