# Getting started with Lenses MCP

{% hint style="success" %}
Add Context7 MCP, while optional, it works alot better as you give the LLM MCP access to Lenses documentation
{% endhint %}

{% stepper %}
{% step %}

### Get Lenses Community Edition

{% hint style="success" %}
Its Free!
{% endhint %}

To install follow the instructions [here](https://docs.lenses.io/latest/getting-started/quickstart).
{% endstep %}

{% step %}

### Clone the Repository

```bash
git clone git@github.com:lensesio/lenses-mcp.git
```

{% endstep %}

{% step %}

### Install uv and Python

You can skip this is you already have it.

If you don't have `uv` installed, follow the [official installation guide](https://docs.astral.sh/uv/getting-started/installation/).

Make sure you have the correct version of Python

```purebasic
uv run python --version
```

{% hint style="info" %}
Requires Python 3.12
{% endhint %}
{% endstep %}

{% step %}

### Configure access to Lenses

The MCP server uses a Lenses Service Account in the form of an environment variables. Login into Lenses and create a service account. Follow the instructions [here](https://docs.lenses.io/latest/user-guide/iam/service-accounts). Make sure you assign the service account to a group that has access.&#x20;

The repo contains a sample `.env` , copy it and add an entry for LENSES\_API\_KEY with the value of your service account token.

```bash
cp .env.example .env
```

{% endstep %}

{% step %}

### Install Dependencies & Run

Use `uv` to create a virtual environment, install the project dependencies in it and then run the MCP server with the FastMCP CLI using the default stdio transport.

```
uv sync
uv run src/lenses_mcp/server.py
```

{% endstep %}

{% step %}

### Configure in your IDE

To run in Claude Desktop, Gemini CLI, Cursor, etc. use the following JSON configuration.

```
{
  "mcpServers": {
    "Lenses.io": {
      "command": "uv",
      "args": [
        "run",
        "--project", "<ABSOLUTE_PATH_TO_THIS_REPO>",
        "--with", "fastmcp",
        "fastmcp",
        "run",
        "<ABSOLUTE_PATH_TO_THIS_REPO>/src/lenses_mcp/server.py"
      ],
      "env": {
        "LENSES_API_KEY": "<YOUR_LENSES_API_KEY>"
      },
      "transport": "stdio"
    }
  }
}
```

{% hint style="warning" %}
Some clients may require the absolute path to `uv` in the command.
{% endhint %}

{% endstep %}

{% step %}

### Context7

Lenses documentation is available on [Context7](https://context7.com/websites/lenses_io). Use the [Context7 MCP Server](https://github.com/upstash/context7) and adjust your prompts with `use context7` to ensure the documentation available to the LLM is up to date.
{% endstep %}
{% endstepper %}
