r365-odata-mcp
by phyrex-net
README.md
# r365-odata-mcp
Read-only [Restaurant365](https://www.restaurant365.com/) (R365) OData tools for AI agents: sales checks, GL transactions, the chart of accounts, locations, and labor punches.
This package is an [Agent Plugin](https://agent-plugins.org) (spec 1.0.0) plus a stdio [MCP](https://modelcontextprotocol.io) server. Every request to R365 is an HTTP `GET`. Zero runtime dependencies; Node 18+.
**This project is unofficial and is not affiliated with, endorsed by, or supported by Restaurant365.** "Restaurant365" and "R365" are trademarks of their respective owners.
## Requirements
- Node.js 18 or newer.
- An R365 user with the **Accounting Clerk** or **Full Access** role. A personal login only sees that user's Location Access; a dedicated connector user sees all locations. Your instance may need the OData connector enabled (see [R365's OData connector docs](https://docs.restaurant365.com/)).
- Username format is `domain\user` (for example `mycompany\apiuser`). The password is that user's R365 password.
## Install
```bash
npm install -g r365-odata-mcp
# or run without a global install:
npx -y r365-odata-mcp
```
Then add a client config from [Client configuration](#client-configuration) and set `R365_USERNAME` and `R365_PASSWORD` in the environment that launches the client (or use a credentials file; see [Credentials](#credentials)).
## Tools
| Tool | Purpose |
| --- | --- |
| `r365_describe_schema` | Offline list of the 19 entity sets and their fields (from `$metadata`). |
| `r365_list_locations` | Locations with `locationId`, number, name, legal entity. |
| `r365_sales_checks` | Check headers (`SalesEmployee`) for an inclusive date range. Pages through all matching rows (20,000-row ceiling); `limit` caps the sample. Totals and `byLocation` cover every fetched check. Optional `business_date_only`. Splits ranges into 30-day requests (R365 caps at 31); max 92 days per call. |
| `r365_sales_check_detail` | One check: header, item lines, payments, by `salesId`. |
| `r365_gl_transactions` | GL transaction headers by date range and/or `rowVersion`. Pages through all matching rows; `limit` caps the sample. |
| `r365_gl_transaction_detail` | Debit/credit lines for one transaction. |
| `r365_gl_accounts` | Chart of accounts. |
| `r365_labor_punches` | Labor punches (`LaborDetail`) by worked date. Pages through all matching punches; totals, `byLocation`, and `byJob` cover every fetched row. |
| `r365_odata_query` | Generic `$filter/$orderby/$select/$top/$skip` GET on an allowlisted entity set. Set `fetch_all` to page through every match (ceiling 20,000); `top` then caps the sample. |
A skill at `skills/r365/SKILL.md` tells an agent when to use each tool.
## Credentials
The server reads, in order:
1. `R365_USERNAME` and `R365_PASSWORD` from the process environment (works for any MCP client that can pass `env`).
2. A JSON file at `R365_CREDENTIALS_FILE`, if set. The Agent Plugin `mcp.json` sets this to `${PLUGIN_DATA}/credentials.json` so Cursor-style plugin hosts can keep a per-plugin file:
```json
{ "username": "mycompany\\apiuser", "password": "..." }
```
Create that file yourself (`chmod 600`). It is git-ignored. Never commit it or put the password in a shared config file. See [SECURITY.md](SECURITY.md).
Agent Plugins 1.0.0 does not define a portable secrets field in `plugin.json` or `mcp.json` (`env` is visible package data, and only `${PLUGIN_ROOT}` and `${PLUGIN_DATA}` are expanded). That is why credentials are read at runtime, not baked into the manifests.
## Known R365 quirks
- **DSS lag.** Transactions are near real-time. Sales and labor appear only after R365 polls the Daily Sales Summary. `createdOn` on sales rows is often the poll time (next morning), not the check time.
- **31-day cap.** Sales entity sets reject a date range longer than 31 days. `r365_sales_checks` splits ranges up to 92 days into 30-day requests and refuses anything longer.
- **`$orderby` is ignored on sales.** `SalesEmployee`, `SalesDetail`, and `SalesPayment` accept `$orderby` but do not sort by it. `$orderby` does work on `Transaction`. `$select` and `$count` are rejected on sales endpoints and are never sent there.
- **Neighbor-day tickets.** A one-day sales query can include tickets whose `date` (and the `mm/dd/yyyy` at the end of `receiptNumber`) falls on a neighboring day. The result reports `neighborDateTickets`. Set `business_date_only: true` to drop those from totals.
- **`grossSales` can be 0** on some delivery-platform tickets while `netSales` is filled in. Prefer `netSales` for "sales for the day."
- **Paging.** R365 does not send `@odata.nextLink`. The server pages with `$top=1000` and `$skip`, dedupes by id, and stops at 20,000 rows (`complete: false` if the ceiling is hit). Rate limit: 750 requests per 15 seconds per instance, shared; a 429 is retried once after `Retry-After`.
- **Auth errors** name the `domain\user` format and the required roles. Passwords are never logged or echoed. Credentials are sent only to `odata.restaurant365.net`.
## Client configuration
Replace `yourdomain\apiuser` only if you must put the username in the file. Prefer interpolating environment variables so the password never sits in config. After publishing to npm, `npx -y r365-odata-mcp` works from anywhere Node is installed. Until then, point `command` at `node` and `args` at this repo's `server/index.js`.
### Cursor (Agent Plugin)
Copy or symlink this repository to `~/.cursor/plugins/local/r365-odata` (or install it once it is listed in a marketplace). Official Cursor docs: [Plugins](https://cursor.com/docs/plugins) and [MCP](https://cursor.com/docs/mcp).
The `mcp.json` in this repo follows the [Agent Plugins](https://agent-plugins.org) specification (`${PLUGIN_ROOT}`, `${PLUGIN_DATA}`). **Cursor currently does not expand those placeholders**; it documents `${CURSOR_PLUGIN_ROOT}` instead ([Plugins](https://cursor.com/docs/plugins)). If a Cursor-installed copy of this plugin fails to start, use the plain `mcp.json` snippet below, or adapt the plugin server entry to:
```json
{
"mcpServers": {
"r365-odata": {
"type": "stdio",
"command": "node",
"args": ["${CURSOR_PLUGIN_ROOT}/server/index.js"],
"cwd": "${CURSOR_PLUGIN_ROOT}",
"env": {
"R365_USERNAME": "${env:R365_USERNAME}",
"R365_PASSWORD": "${env:R365_PASSWORD}"
}
}
}
}
```
Community plugins and MCP servers are also listed on [cursor.directory](https://cursor.directory). Official Cursor Marketplace listing is a separate, reviewed process at [cursor.com/marketplace](https://cursor.com/marketplace).
### Cursor (plain `mcp.json`)
Project file: `.cursor/mcp.json`. Global file: `~/.cursor/mcp.json`. Cursor interpolates `${env:NAME}` in `command`, `args`, and `env` ([MCP docs](https://cursor.com/docs/mcp)).
```json
{
"mcpServers": {
"r365-odata": {
"type": "stdio",
"command": "npx",
"args": ["-y", "r365-odata-mcp"],
"env": {
"R365_USERNAME": "${env:R365_USERNAME}",
"R365_PASSWORD": "${env:R365_PASSWORD}"
}
}
}
}
```
### VS Code / GitHub Copilot
**Current official shape (Copilot harness):** a top-level `mcpServers` object, not `servers`. Put it in `~/.copilot/mcp-config.json` (or `$COPILOT_HOME/mcp-config.json`) for all workspaces, or in `.mcp.json` at the workspace root to share with a team. See [Add and use MCP servers in VS Code](https://code.visualstudio.com/docs/agent-customization/mcp-servers/) and the [MCP configuration reference](https://code.visualstudio.com/docs/agents/reference/mcp-configuration).
```json
{
"mcpServers": {
"r365-odata": {
"type": "stdio",
"command": "npx",
"args": ["-y", "r365-odata-mcp"],
"env": {
"R365_USERNAME": "${env:R365_USERNAME}",
"R365_PASSWORD": "${env:R365_PASSWORD}"
}
}
}
}
```
`.vscode/mcp.json` with a top-level `servers` key is the **deprecated Local harness** format. Microsoft documents that new Copilot configurations should not use it (Local harness removal is slated for February 2027). If you still need that older file:
```json
{
"servers": {
"r365-odata": {
"type": "stdio",
"command": "npx",
"args": ["-y", "r365-odata-mcp"],
"env": {
"R365_USERNAME": "${env:R365_USERNAME}",
"R365_PASSWORD": "${env:R365_PASSWORD}"
}
}
}
}
```
### Gemini CLI
User file: `~/.gemini/settings.json`. Project file: `.gemini/settings.json`. Official docs: [MCP servers with Gemini CLI](https://geminicli.com/docs/tools/mcp-server/) and [configuration reference](https://geminicli.com/docs/reference/configuration/). `env` values expand `$VAR` / `${VAR}`.
```json
{
"mcpServers": {
"r365-odata": {
"command": "npx",
"args": ["-y", "r365-odata-mcp"],
"env": {
"R365_USERNAME": "${R365_USERNAME}",
"R365_PASSWORD": "${R365_PASSWORD}"
}
}
}
}
```
You can also run `gemini mcp add --scope user r365-odata npx -y r365-odata-mcp` and then set `env` in that file. `gemini mcp list` shows configured servers.
### Claude Desktop
Official guide: [Getting started with local MCP servers on Claude Desktop](https://support.claude.com/en/articles/10949351-getting-started-with-local-mcp-servers-on-claude-desktop) and the MCP local-server tutorial at [modelcontextprotocol.io](https://modelcontextprotocol.io/docs/develop/connect-local-servers). Config file:
- macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
```json
{
"mcpServers": {
"r365-odata": {
"command": "npx",
"args": ["-y", "r365-odata-mcp"],
"env": {
"R365_USERNAME": "yourdomain\\apiuser",
"R365_PASSWORD": "your-password"
}
}
}
}
```
Prefer setting those variables in the Desktop app's environment instead of writing the password into the file. Restart Claude Desktop after saving.
### Claude Code
Official docs: [Connect Claude Code to tools via MCP](https://code.claude.com/docs/en/mcp). Project file: `.mcp.json` (commit to share; teammates must approve it). User/local servers also live in `~/.claude.json`. CLI:
```bash
claude mcp add --transport stdio r365-odata \
--env R365_USERNAME="${R365_USERNAME}" \
--env R365_PASSWORD="${R365_PASSWORD}" \
-- npx -y r365-odata-mcp
```
Equivalent `.mcp.json` entry (the object inside `mcpServers` is also what `claude mcp add-json` expects):
```json
{
"mcpServers": {
"r365-odata": {
"command": "npx",
"args": ["-y", "r365-odata-mcp"],
"env": {
"R365_USERNAME": "${R365_USERNAME}",
"R365_PASSWORD": "${R365_PASSWORD}"
}
}
}
}
```
### OpenClaw
OpenClaw **does** support outbound MCP servers. Official docs: [Connect MCP servers](https://docs.openclaw.ai/tools/mcp) and [Configuration — MCP, skills, and plugins](https://docs.openclaw.ai/gateway/config-extensions). Definitions live under `mcp.servers` in OpenClaw config (typically `~/.openclaw/openclaw.json`). Stdio servers use `command` / `args`. Verify with `openclaw mcp doctor r365-odata --probe` (OpenClaw itself was not exercised in this repo's smoke tests).
```json
{
"mcp": {
"servers": {
"r365-odata": {
"command": "npx",
"args": ["-y", "r365-odata-mcp"],
"env": {
"R365_USERNAME": "yourdomain\\apiuser",
"R365_PASSWORD": "your-password"
}
}
}
}
}
```
OpenClaw's docs say to keep credentials out of config literals and use their supported secret mechanisms for sensitive values. Prefer those over pasting a password here.
## Develop
```bash
npm install # devDependencies only (schema validator)
npm test # offline tests; the live 401 test skips unless R365_LIVE_TEST=1
npm run validate # plugin.json and mcp.json against vendored Agent Plugins 1.0.0 schemas
npm run gen:metadata # regenerate server/metadata.json from reference/*.xml
```
Refresh `$metadata`: `curl -o reference/odata-v2-views-metadata.xml 'https://odata.restaurant365.net/api/v2/views/$metadata'`, then `npm run gen:metadata`.
## Not covered
R365's API Connector (`/APIv1`, writes), Public API, and Snowflake share are separate surfaces and are not wrapped. Live data calls need real R365 credentials, which this repository does not contain.
## License
[MIT](LICENSE) © 2026 Preston Pruitt
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessOutdated data