Leanly MCP Server (Model Context Protocol)
Introduction
The Model Context Protocol (MCP) is an open standard for connecting Large Language Models (LLMs) with external tools, data, and services — like Leanly.
This guide walks you through the one-time setup of the Leanly MCP server in your local development environment.
Quickstart
1. Install the MCP Server
You can connect the Leanly MCP server to any MCP-compatible client such as VS Code, Claude, Cursor, Windsurf, and more. Each client has its own configuration format — see examples below.
VS Code
Create <your-repo>/.vscode/mcp.json with:
{
"servers": {
"leanly": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@leanlyhq/leanly-mcp@latest"]
}
}
}
👉 For more details, check the official VS Code MCP docs.
Cursor
Use the one-click install link:
Or configure manually by creating <your-repo>/.cursor/mcp.json:
{
"mcpServers": {
"leanly": {
"command": "npx",
"args": ["-y", "@leanlyhq/leanly-mcp@latest"]
}
}
}
👉 For more details, check the official Cursor MCP docs.
2. Authenticate MCP Server
Prior to using the MCP server, run the interactive SSO helper which performs a short, one-time login and stores the resulting session locally so the MCP server can authenticate to Leanly.
npx leanly@latest sso login
What is npx? npx runs a package from the npm registry temporarily without installing it globally - it downloads and executes the package for you.
By default, your session expires 24 hours after you've logged in. Simply run the command again to re-authenticate.
npx not available? Or prefer oauth client authentication?
-
Already have an OAuth client? Skip ahead to step 2. Need to create one? Go to Tenant Settings > OAuth Clients > Add in Leanly.
- No additional scopes are required — defaults are fine.
- Copy the client ID and secret and store them securely.
-
Next, create a
.envfile in your repository root:LEANLY_MCP_OAUTH_CLIENT_ID=<your OAuth client id>
LEANLY_MCP_OAUTH_CLIENT_SECRET=<your OAuth client secret>warningYour
.envfile contains secrets. Never commit it to version control (e.g., GitHub). ::: --> -
Tell MCP server to use OAuth creds by adding the path to your
envFile. For example, your Cursor config becomes:{
"mcpServers": {
"leanly": {
"command": "npx",
"args": ["-y", "@leanlyhq/leanly-mcp@latest"],
"envFile": "${workspaceFolder}/.env"
}
}
}