MCP server
Peris.ai Router runs a Model Context Protocol (MCP) server, so an MCP client such as an agent framework, an IDE assistant or a desktop chat app can use Peris.ai Router as a set of tools with nothing but your API key.
| URL | https://<your-host>/mcp (also https://<your-host>/v1/mcp) |
| Transport | Streamable HTTP, POST only, JSON answers |
| Protocol versions | 2025-06-18, 2025-03-26 |
| Authentication | Authorization: Bearer perisai_router_sk_..., the same key you use for the API |
Every request is checked like an API request: a disabled, expired or rotated key,
a suspended organization or an empty balance is refused with the same error as on
/v1/chat/completions.
Tools
| Tool | What it does | Billed |
|---|---|---|
list_models |
The models and aliases your key may use. Follows the key's guardrails. | No |
chat |
Sends a conversation to a model and returns the reply. Arguments: model, messages (each role system, user or assistant, and text content), optional max_tokens and temperature. |
Yes, exactly like an API request |
usage |
What this key has spent in its current period, in IDR, and its credit limit if it has one. | No |
compression_settings |
Shows which context compression engines run on this key, or sets them with engines. An empty list turns it off. |
No |
optimize_context |
Compresses a conversation without sending it and reports the tokens before and after, per engine, and the rupiah when you name a model. |
No |
compression_report |
What compression saved on this key over the last days (default 30): tokens, rupiah, and which engines fired. |
No |
The three compression tools are explained in Context compression.
A chat call goes through the same path as the API: guardrails, routing,
fallback, pricing, Usage and Logs. It shows up in Usage and Logs like any other
request, with its request id. If the model refuses or the key may not use it, the
tool answers with isError: true and the same error text the API would give, so
the calling model can read why.
The chat tool takes plain text conversations only. For images, tool definitions
or streaming, call /v1/chat/completions directly.
Every tool call counts against your key's and your account's requests-per-minute
limits. The handshake, ping and tools/list do not, so a client reconnecting
does not use up the budget its real calls need.
Connecting a client
Most clients take a URL and a header. For example, in a client's JSON config:
{
"mcpServers": {
"perisai_router": {
"type": "http",
"url": "https://<your-host>/mcp",
"headers": { "Authorization": "Bearer perisai_router_sk_..." }
}
}
}
Trying it with cURL
curl -s https://<your-host>/mcp \
-H "Authorization: Bearer $PERISAI_ROUTER_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call",
"params":{"name":"chat","arguments":{"model":"perisairouter/smart",
"messages":[{"role":"user","content":"Halo, apa kabar?"}]}}}'
The reply's first text item is the model's answer. The second is a small JSON object with the model that answered, its usage and the request id.
What it does not do
- No session: every request stands alone and carries the key.
GETandDELETEon the endpoint answer405. - No batches: send one JSON-RPC message per request.
- A request from a web page on another site (a foreign
Originheader) is refused with403 forbidden_origin. MCP clients are programs and send noOrigin. - An
MCP-Protocol-Versionheader other than the two versions above is refused with400 unsupported_protocol_version.