# MCP - Connecting Your AI Assistant

## Overview

This guide walks you through connecting an AI assistant to the Lili MCP server so it can access Lili business banking data on behalf of your users.

The Lili MCP server uses the **Streamable HTTP transport** with **OAuth 2.0** authentication. Any MCP-compatible client can connect.

## Prerequisites

- A Lili business account (or accountant account)
- An MCP-compatible AI assistant (Claude, Cursor, Windsurf, OpenClaw, NanoClaw, etc.)


## Claude Code

Claude Code connects to remote MCP servers natively over **Streamable HTTP** — no bridge or config file required.

### Step 1 — Add the Lili server

```bash
claude mcp add --transport http lili https://mcp.lili.co/mcp
```

By default the server is added at **local** scope, so it's only available in the project you ran the command from. To make Lili available in every project, add `--scope user`:

```bash
claude mcp add --scope user --transport http lili https://mcp.lili.co/mcp
```

### Step 2 — Authorize

Start (or restart) a Claude Code session, run `/mcp`, select **lili**, and choose **Authenticate**. A browser window opens to the Lili OAuth authorization page — log in with your Lili credentials and grant access. The token is stored locally and reused on subsequent sessions.

### Step 3 — Verify

Run `claude mcp list` or `/mcp` to confirm the server shows as connected, then ask Claude Code to use a Lili tool.

## Claude Desktop

Claude Desktop supports remote MCP servers natively as **custom connectors**, so you no longer need the `mcp-remote` bridge or to edit `claude_desktop_config.json`.

### Step 1 — Open Connectors

In Claude Desktop, open **Settings → Connectors** (newer builds: **Customize → Connectors**).

### Step 2 — Add a custom connector

Click **Add custom connector** and enter:

| Field | Value |
|  --- | --- |
| Name | `Lili` |
| Remote MCP server URL | `https://mcp.lili.co/mcp` |


Leave the OAuth client settings at their defaults — Claude registers itself with the Lili MCP automatically.

### Step 3 — Connect and authorize

Click **Add**, then click **Connect** next to Lili. A browser window opens to the Lili OAuth authorization page. Log in with your Lili credentials and grant access.

> **Older builds:** if your version of Claude Desktop doesn't offer **Add custom connector**, install the `mcp-remote` bridge (`npm install -g mcp-remote`) and add the Lili entry to `claude_desktop_config.json` as shown in the [MCP reference](https://dev.lili.co/mcp).


## Cursor

Install in Cursor

To open Cursor and automatically add the Lili MCP, click the button above. Alternatively, follow the manual steps below:

### Step 1 — Open Customize

In Cursor, open the **Customize** page from the sidebar and select **MCP**. (Cursor replaced the old **Settings → MCP** page with Customize.)

### Step 2 — Add the server

Click **Add MCP server** and enter:

| Field | Value |
|  --- | --- |
| Name | `lili` |
| Type | `HTTP` (Streamable HTTP) |
| URL | `https://mcp.lili.co/mcp` |


Or add the entry directly to `~/.cursor/mcp.json` (global) or `.cursor/mcp.json` (per project):

```json
{
  "mcpServers": {
    "lili": {
      "url": "https://mcp.lili.co/mcp"
    }
  }
}
```

Remote entries only need `url` — Cursor infers the HTTP/SSE transport from it.

### Step 3 — Authorize

On first use, Cursor opens a browser tab for Lili OAuth login. Complete the flow to grant access.

## VS Code

Install in VS Code

To open VS Code and automatically add the Lili MCP, click the button above. Alternatively, add the following to your `.vscode/mcp.json` file in your workspace:

```json
{
  "servers": {
    "lili": {
      "type": "http",
      "url": "https://mcp.lili.co/mcp"
    }
  }
}
```

To learn more, see the VS Code [documentation](https://code.visualstudio.com/docs/copilot/chat/mcp-servers).

## Windsurf

Open **Settings → Cascade → MCP Servers** and add:

```json
{
  "mcpServers": {
    "lili": {
      "serverUrl": "https://mcp.lili.co/mcp"
    }
  }
}
```

Restart Windsurf and authorize via the browser prompt on first use.

## OpenClaw

OpenClaw is a container-isolated, self-hosted AI agent platform. To connect OpenClaw to the Lili MCP server, add the server details under the `mcpServers` section of your configuration file (typically `~/.openclaw/mcp.json` or `openclaw.json`):

```json
{
  "mcpServers": {
    "lili": {
      "url": "https://mcp.lili.co/mcp",
      "transport": "streamable-http"
    }
  }
}
```

Restart the OpenClaw gateway to apply the configuration:

```bash
openclaw gateway restart
```

## NanoClaw

NanoClaw is a secure, lightweight AI agent framework optimized for containerized workflows. To connect NanoClaw to the Lili MCP, configure the server in your NanoClaw configuration file (typically `nanoclaw.json` or `~/.config/nanoclaw.json`):

```json
{
  "mcpServers": {
    "lili": {
      "url": "https://mcp.lili.co/mcp",
      "transport": "http"
    }
  }
}
```

NanoClaw will launch and mount the Lili MCP integration automatically into the agent's container environment upon startup.

## Other MCP Clients

Any client that supports the **Streamable HTTP** transport (MCP spec 2025-03-26) can connect. Point it at:

```
https://mcp.lili.co/mcp
```

The server implements standard OAuth 2.0 discovery at `/.well-known/oauth-authorization-server`, so compliant clients can discover all auth endpoints automatically.

## OAuth Details

The Lili MCP uses the **Authorization Code** flow with PKCE. Key endpoints:

| Endpoint | URL |
|  --- | --- |
| Authorization | `https://mcp.lili.co/oauth/authorize` |
| Token | `https://mcp.lili.co/oauth/token` |
| Registration | `https://mcp.lili.co/oauth/register` |


Tokens are scoped to the authenticated user. Refresh tokens are issued automatically, so users typically only need to log in once per device.

## Verifying the Connection

Once connected, ask your AI assistant:

> *"Use the Lili MCP to tell me my current account balance."*


If the connection is working, the assistant will call `lili_get_account_summary` and return your balance. If authorization is needed first, a browser window will open.

## Troubleshooting

**Browser doesn't open for authorization**
Some clients require you to manually trigger the OAuth flow. Check your client's MCP settings for a "Connect" or "Authorize" button.

**"No active client accounts found"** (accountants)
This message from `list_customers` means no clients have invited you yet. Ask clients to connect their Lili account to your accountant profile from within the Lili app.

**Token expired**
Re-authorize by removing the saved token in your MCP client settings and reconnecting.

**Connection refused**
Make sure you are using `https://mcp.lili.co/mcp` (not `/sse` or other paths). The server only accepts Streamable HTTP transport.