Skip to content

Get started with Lens MCP Server#

In this guide, you will enable the Lens MCP Server and connect it to an MCP client. This takes about 5 minutes.

Prerequisites#

  • A Plus, Pro, or Enterprise subscription plan. For details, see Lens Pricing .
  • Lens Desktop installed and running.
  • At least one Kubernetes cluster added to Lens Desktop.
  • An MCP client installed and configured.

Step 1: Enable the MCP Server#

  1. Open Lens Desktop.
  2. Navigate to Preferences > Integrations.
  3. Scroll to the AI & Intelligence Integrations section.
  4. Locate Enable Lens MCP Server and turn the toggle on.

Note

The Lens CLI is bundled with Lens Desktop. You do not need to install or enable a separate Lens CLI setting for the MCP Server to work.

Step 2: Configure your MCP client#

  1. In Preferences > Integrations > AI & Intelligence Integrations > Enable Lens MCP Server, click Configure your MCP client to expand the configuration snippet. This control is only visible when the MCP Server toggle is on.
  2. Click the copy icon in the top-right corner of the snippet (tooltip Copy to clipboard). Lens Desktop generates a JSON snippet that includes the absolute path to the bundled Lens CLI, so your MCP client can launch the server without relying on your shell PATH.

    An example of the copied snippet looks like this:

    {
      "mcpServers": {
        "lens": {
          "command": "<absolute path to the bundled Lens CLI>",
          "args": ["mcp-server"]
        }
      }
    }
    
  3. Paste the snippet into your MCP client configuration. For example, add it to your project's .mcp.json.

Info

The exact path in the command field differs per platform and installation location. Always copy the snippet from Lens Desktop rather than typing the path manually.

Info

The configuration file path and format vary by client. For example, in Claude Code, add the configuration to ~/.claude/settings.json. Some MCP clients also let you add server configurations directly through their interface. Refer to your MCP client's documentation for the supported setup methods.

Note

After adding or modifying the MCP configuration, your MCP client may require a session restart to detect the new server.

Step 3: Verify the connection#

Ping the server#

  1. Open your MCP client.
  2. Ask the MCP client to ping the server. For example: "Ping the Lens MCP server."
  3. Verify that the response is pong.

Tip

If you do not receive a pong response, restart your MCP client session and confirm that the Lens CLI is in your PATH.

List your clusters#

  1. Ask the MCP client to list your clusters. For example: "List all Kubernetes clusters in Lens."
  2. Verify that your clusters appear in the response with their connection status.

Expected output:

[
  {
    "name": "my-eks-cluster",
    "connectionStatus": "disconnected"
  },
  {
    "name": "minikube",
    "connectionStatus": "connected"
  }
]

Step 4: Run your first command#

Ask your MCP client to retrieve information from one of the clusters listed in Step 3.

Example prompt:

Show me all pods in the default namespace on minikube

The MCP client calls the Lens MCP Server, runs a read-only kubectl get pods command against the specified cluster, and returns the results.

Tip

Replace minikube with the name of any cluster from your Step 3 output.

Completed

You have connected your MCP client to Lens Desktop through the MCP Server. You can now inspect resources, troubleshoot clusters, and query Prometheus metrics using natural language.

Next steps#