Skip to main content

MCP Standard Protocol

OpenRegister implements the Model Context Protocol (MCP) standard, enabling AI agents (Claude Code, Cursor, etc.) to interact with registers, schemas, and objects natively.

Quick Start​

Endpoint​

POST /index.php/apps/openregister/api/mcp
Content-Type: application/json

Requires Nextcloud Basic Auth. All requests use JSON-RPC 2.0 over HTTP.

1. Initialize a Session​

curl -s -u admin:admin -X POST \
http://localhost:8080/index.php/apps/openregister/api/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2025-03-26",
"capabilities": {},
"clientInfo": {"name": "test", "version": "1.0"}
}
}'

Response includes a Mcp-Session-Id header. Use it for all subsequent requests.

2. List Tools​

curl -s -u admin:admin -X POST \
http://localhost:8080/index.php/apps/openregister/api/mcp \
-H "Content-Type: application/json" \
-H "Mcp-Session-Id: <session-id>" \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'

3. Call a Tool​

curl -s -u admin:admin -X POST \
http://localhost:8080/index.php/apps/openregister/api/mcp \
-H "Content-Type: application/json" \
-H "Mcp-Session-Id: <session-id>" \
-d '{
"jsonrpc": "2.0",
"id": 3,
"method": "tools/call",
"params": {
"name": "registers",
"arguments": {"action": "list"}
}
}'

MCP Standard vs Discovery API​

OpenRegister has two MCP-related endpoints that serve different purposes:

FeatureMCP Standard (/api/mcp)Discovery API (/api/mcp/v1/discover)
ProtocolJSON-RPC 2.0 (MCP spec)REST (custom)
PurposeNative MCP client integrationLLM-friendly API discovery
AuthNextcloud Basic + MCP sessionTier 1 public, Tier 2 authenticated
TransportStreamable HTTP (POST)HTTP GET
Toolsregisters, schemas, objects—
Resourcesopenregister:// URIs—
Use caseClaude Code, Cursor, MCP clientsAny LLM needing API docs

When to use which:

  • Use the MCP Standard endpoint when your client supports MCP (Claude Code, Cursor, etc.)
  • Use the Discovery API when you need a lightweight, token-efficient way to explain the API to an LLM

Available Tools​

registers​

Manage registers (data containers that group schemas and objects).

ActionRequired ParamsDescription
list—List all registers (supports limit, offset)
getidGet a single register
createdataCreate a new register
updateid, dataUpdate a register
deleteidDelete a register

schemas​

Manage schemas (data definitions that describe object structure).

ActionRequired ParamsDescription
list—List all schemas (supports limit, offset)
getidGet a single schema
createdataCreate a new schema
updateid, dataUpdate a schema
deleteidDelete a schema

objects​

Manage objects (data records stored in a register under a schema).

All actions require register (int) and schema (int) parameters.

ActionRequired ParamsDescription
listregister, schemaList objects (supports limit, offset)
getregister, schema, id (UUID)Get a single object
createregister, schema, dataCreate a new object
updateregister, schema, id, dataUpdate an object
deleteregister, schema, idDelete an object

Available Resources​

Static Resources​

  • openregister://registers — All registers
  • openregister://schemas — All schemas
  • openregister://objects/{registerId}/{schemaId} — Objects for a register+schema pair

URI Templates​

  • openregister://registers/{id} — Single register
  • openregister://schemas/{id} — Single schema
  • openregister://objects/{register}/{schema}/{id} — Single object

Session Management​

  • Sessions are created via initialize and returned in the Mcp-Session-Id response header
  • Sessions expire after 1 hour of inactivity
  • All methods except initialize require a valid Mcp-Session-Id header
  • Notifications (requests without id) return HTTP 202

JSON-RPC Error Codes​

CodeMeaning
-32700Parse error (invalid JSON)
-32600Invalid JSON-RPC request
-32601Method not found
-32602Invalid parameters
-32603Internal error
-32000Session required or invalid

Architecture​

POST /api/mcp
│
▼
McpServerController::handle()
├── Parse JSON-RPC 2.0 envelope
├── Route by method:
│ ├── "initialize" → McpProtocolService
│ ├── "notifications/*" → HTTP 202
│ ├── "ping" → McpProtocolService
│ ├── "tools/list" → McpToolsService
│ ├── "tools/call" → McpToolsService
│ ├── "resources/list" → McpResourcesService
│ ├── "resources/read" → McpResourcesService
│ └── "resources/templates/list"→ McpResourcesService
└── Wrap in JSON-RPC response