Connect other MCP clients
LendMCP is a standard MCP server over Streamable HTTP, so any compliant client can connect.
This page gives you everything needed to configure a client that is not covered by its own
guide — editors, agent frameworks, scripts, and CI jobs.
Endpoint
https://mcp.lendapi.com/mcp
Transport facts
| Property | Value |
|---|---|
| Protocol | MCP over Streamable HTTP |
| Method | POST to /mcp with a JSON-RPC body |
| Session state | Stateless — no session ID to keep, any request stands alone |
| Response format | Plain application/json (not SSE frames) |
GET /mcp | Returns a short landing page to a browser, otherwise 405 with Allow: POST, DELETE. There is no server-to-client listening stream. |
Unauthenticated POST | 401 with a WWW-Authenticate challenge that points at the authorization metadata |
Because responses are plain JSON, clients that only accept application/json work fine. A
client that sends an explicit Accept header of something else entirely (for example
text/html) gets 406 Not Acceptable.
Option 1 — Header authentication (simplest)
Send your LendAPI machine token on every request:
Authorization: Bearer live_your_token_here
A typical client configuration file looks like this:
{
"mcpServers": {
"lendapi": {
"type": "http",
"url": "https://mcp.lendapi.com/mcp",
"headers": {
"Authorization": "Bearer live_your_token_here"
}
}
}
}The token decides both the tenant and the environment: live_ for Live, test_ for Sandbox.
Create tokens under Admin Portal → Settings → Developer Settings → API settings → Add New
Key — see Authentication.
Store the token in a secret manager or environment variable, never in a committed file.
Option 2 — OAuth
If your client implements the MCP authorization spec, point it at the endpoint and let it
discover the rest. LendMCP supports dynamic client registration, so there is no client ID or
secret to create by hand.
Metadata URLs
https://mcp.lendapi.com/.well-known/oauth-protected-resource/mcp
https://mcp.lendapi.com/.well-known/oauth-authorization-server
Endpoints advertised by that metadata
| Purpose | URL |
|---|---|
| Dynamic client registration | https://mcp.lendapi.com/oauth/register |
| Authorization | https://mcp.lendapi.com/oauth/authorize |
| Token | https://mcp.lendapi.com/oauth/token |
Requirements your client must meet
| Requirement | Value |
|---|---|
| Response type | code |
| Grant types | authorization_code, refresh_token |
| PKCE | Required, S256 only |
| Token endpoint auth method | none (public client) |
| Scope | lendapi |
| Redirect URIs | Must be https://, or http://localhost / http://127.0.0.1 for local development |
The flow: your client registers, sends the user to the authorization endpoint, the user signs in
to the LendAPI portal and approves, and your client exchanges the returned code for tokens.
Access tokens last 8 hours; refresh tokens last 90 days and slide forward on every use. The
tokens cover both environments: pass "environment": "sandbox" in a tool call's arguments to
run it in Sandbox (every tool advertises the argument in tools/list; the default is Live).
Verifying connectivity from the command line
A raw initialize call against the endpoint:
curl -s https://mcp.lendapi.com/mcp \
-H "Authorization: Bearer $LENDAPI_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2025-06-18",
"capabilities": {},
"clientInfo": {"name": "curl", "version": "1.0"}
}
}'Listing the tools:
curl -s https://mcp.lendapi.com/mcp \
-H "Authorization: Bearer $LENDAPI_TOKEN" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}'Calling a tool:
curl -s https://mcp.lendapi.com/mcp \
-H "Authorization: Bearer $LENDAPI_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 3,
"method": "tools/call",
"params": {"name": "decision_trees_list", "arguments": {"start": 0, "size": 5}}
}'Drop the Authorization header and you get a 401 with the WWW-Authenticate challenge — that
is the expected behavior, and it is what triggers an OAuth-capable client to start its flow.
Errors to expect
| Status / message | Meaning |
|---|---|
401 with WWW-Authenticate | No credential was sent, or the OAuth access token has expired |
{"error": "Invalid or expired API token", "status": 401} | The machine token was rejected by LendAPI |
{"error": "Token does not have access to this resource", "status": 403} | The token's tenant cannot reach that resource |
405 on GET /mcp | Expected — use POST |
406 Not Acceptable | Your client sent an explicit Accept header that excludes JSON |
Notes and limits
- Workflow authoring requires a Live token. Read tools work in both environments.
- Tool results are JSON strings; parse them rather than pattern-matching on text.
- Requests are rate limited. Back off on
429and honorRetry-After.
See also
Updated about 14 hours ago

