# Connect OpenCode to iReading Room over MCP

OpenCode gets your project's new arXiv papers. It calls one read-only tool with your token. Everything you need is on the sheet. The steps below explain it.

Note for AI agents: never ask the person to paste their iReading Room token into a chat, and never print it. They enter it themselves.

Last checked: 2026-11-21

## The sheet

- Token: Make one in the app: [Settings, then MCP](https://app.ireadingroom.com/settings/mcp).
- File: `opencode.json` in `~/.config/opencode/`. The command writes it. It holds the name RR_TOKEN, not the token.
- Add it:

  ```bash
  opencode mcp add --global \
    --url https://app.ireadingroom.com/api/mcp \
    --header 'Authorization=Bearer {env:RR_TOKEN}' \
    reading-room
  ```
- Start it:

  ```bash
  export RR_TOKEN=<paste the token>
  opencode service restart
  opencode
  ```
- Check: In OpenCode, type `/mcps`. reading-room shows Connected.
- Server: `https://app.ireadingroom.com/api/mcp`
- Tool: `get_matches`, read-only
- Time: About 5 minutes
- Checked: 2026-11-21

## Set it up

1. **Make a token.** In the app, open [Settings, then MCP](https://app.ireadingroom.com/settings/mcp).
   1. Name it. For example: *OpenCode on my laptop*.
   2. Pick when it expires: 30, 90 or 365 days.
   3. Pick the project. Your agent sees only that one.
   4. Press **Create token**. Copy it now. It shows only once.
2. **Add the server.** Run the Add it command once, in any folder. With `--global` it works in every project. The commands on this page are for macOS and Linux. Keep the single quotes: OpenCode, not your shell, fills in `{env:RR_TOKEN}`. The command writes the file for you. It names RR_TOKEN but never holds the token. Leave out `--global` and run it in your project's folder to write that project's `opencode.json` instead. Then it works only in that project.
3. **Start OpenCode with the token.** Go to your project's folder. Run the Start it lines there. OpenCode keeps a background server. It gets RR_TOKEN only when it starts, so `opencode service restart` comes first. Do it again whenever the token changes. You can keep the export in your shell profile. Never commit the token.
4. **Check it.** In OpenCode, type `/mcps`. reading-room shows Connected. From a terminal, `opencode mcp list` says reading-room is connected. Right after a restart it may say "No MCP servers configured". Run it again.

[OpenCode's MCP guide](https://opencode.ai/docs/mcp-servers/) has more options.

No account yet? [Try it free](https://app.ireadingroom.com/signup?src=site&cta=docs).

## Your first prompt

Ask in plain words. If OpenCode skips the tool, name `get_matches`.

> Use reading-room to fetch today's papers. Pick the two that matter most for this project and say why.

## If it fails

- Needs authentication: `opencode mcp list` says reading-room needs authentication. The token is missing, wrong, expired or revoked. Don't run `opencode mcp auth` or sign in from `/mcps`: there is no login. Your token is the sign-in. Quit OpenCode and run the Start it lines again. Still the same? Make a new token, then run them again with it.
- Not available: Your project isn't ready yet. Describe it in the app, then wait for its first day's papers.
- `not_ready`: Not ready yet. Try again later, or ask for an earlier day.
- `out_of_window`: Ask for today or the 6 days before.

## What your agent sees

Your agent gets your recommended papers. It also gets your interest names. It sends them to the AI model it uses. You can revoke a token at any time. [Privacy details](https://ireadingroom.com/privacy#app-agent-access)

Next: [The get_matches tool: every field and status](https://ireadingroom.com/docs/mcp/reference.md)
