trep.docs
trep.docs

AI agents

For developers

Building your own agent or MCP client? This is how the Trep connector works on the wire.

Transport

Endpointhttps://mcp.app.test.trep.io/mcp
TransportStreamable HTTP, stateless: POST one JSON-RPC 2.0 message, get one JSON response
Protocol versions2025-06-18, 2025-03-26, 2024-11-05
Sessions, SSENone: no Mcp-Session-Id, GET /mcp is 405, notifications get 202
BatchesNot supported (JSON arrays are refused)
Body limit1 MB
Rate limit120 calls per minute per connection (429 with Retry-After)
BrowsersRequests with an Origin header are refused (no CORS on /mcp)

Authentication

Send Authorization: Bearer <token> on every request. Without a valid token the server answers 401 with a WWW-Authenticate header that points at its protected-resource metadata (RFC 9728). Spec-following MCP clients do the rest by themselves:

  • https://mcp.app.test.trep.io/.well-known/oauth-protected-resource names the authorization server, https://accounts.test.trep.io.
  • https://accounts.test.trep.io/.well-known/oauth-authorization-server (RFC 8414) lists the endpoints.
  • Register at https://accounts.test.trep.io/oauth/register (RFC 7591). Clients are public: no secret, token_endpoint_auth_method: none. Redirect URIs must be https, http on localhost, or a reverse-domain app scheme, and are matched exactly.
  • Authorization code flow with PKCE (S256 only) at https://accounts.test.trep.io/authorize; the owner picks the agency and the scope on a consent screen.
  • Exchange and refresh at https://accounts.test.trep.io/oauth/token (form or JSON). Access tokens last 10 minutes; refresh tokens rotate on every use.

Scopes: agency:read, agency:write (includes read). Access tokens are EdDSA JWTs for the audience mcp; treat them as opaque. Owner-created tokens (trep_pat_…) are sent the same way.

Example

initialize
curl https://mcp.app.test.trep.io/mcp \
  -H "Authorization: Bearer trep_pat_…" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"my-agent","version":"1.0"}}}'
tools/call
curl https://mcp.app.test.trep.io/mcp \
  -H "Authorization: Bearer trep_pat_…" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"list_orders","arguments":{"status":"new","limit":10}}}'

A tool result has the data as JSON text in content and as an object in structuredContent (lists come as { "items": [...] }). When Trep refuses a call, the result has isError: true and a sentence saying why, so the model can explain or retry.

Tools

tools/list returns only the tools the token’s scope allows, with JSON Schemas and annotations (readOnlyHint, destructiveHint, idempotentHint). Arguments are checked against the schema before anything runs: unknown fields are refused. See the tools reference.