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

PropertyValue
ProtocolMCP over Streamable HTTP
MethodPOST to /mcp with a JSON-RPC body
Session stateStateless — no session ID to keep, any request stands alone
Response formatPlain application/json (not SSE frames)
GET /mcpReturns a short landing page to a browser, otherwise 405 with Allow: POST, DELETE. There is no server-to-client listening stream.
Unauthenticated POST401 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

PurposeURL
Dynamic client registrationhttps://mcp.lendapi.com/oauth/register
Authorizationhttps://mcp.lendapi.com/oauth/authorize
Tokenhttps://mcp.lendapi.com/oauth/token

Requirements your client must meet

RequirementValue
Response typecode
Grant typesauthorization_code, refresh_token
PKCERequired, S256 only
Token endpoint auth methodnone (public client)
Scopelendapi
Redirect URIsMust 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 / messageMeaning
401 with WWW-AuthenticateNo 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 /mcpExpected — use POST
406 Not AcceptableYour 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 429 and honor Retry-After.

See also


Did this page help you?