# 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 Desktop

### Step 1 — Install mcp-remote

`mcp-remote` is a small CLI that bridges Claude Desktop (which speaks stdio) to remote HTTP MCP servers.


```bash
npm install -g mcp-remote
```

### Step 2 — Edit the config file

Open your Claude Desktop configuration file:

- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`


Add the Lili MCP entry under `mcpServers`:


```json
{
  "mcpServers": {
    "lili": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://mcp.lili.co/mcp"
      ]
    }
  }
}
```

### Step 3 — Restart Claude Desktop

Quit and reopen Claude Desktop. On the next launch, Claude will start the MCP bridge.

### Step 4 — Authorize

The first time you ask Claude a question that uses a Lili tool, 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.

## 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 MCP Settings

In Cursor, open **Settings** (⌘ + ,) and navigate to **MCP**.

### Step 2 — Add the server

Click **Add MCP Server** and enter:

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


Or, if your Cursor version uses a JSON config file (`~/.cursor/mcp.json`):


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

### 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.