Skip to main content

MCP server that proxies AI agent requests to Lens Studio's built-in MCP server

Project description

lens-studio-mcp

An MCP (Model Context Protocol) server that connects any AI coding agent to Lens Studio in real-time. Tell your AI to build an AR lens and watch it happen live.

No plugins required — works with Lens Studio 5.15+'s built-in MCP endpoint.

Compatible with: Claude Desktop, Claude Code, Cursor, Windsurf, VS Code Copilot, OpenAI agents, and any MCP-compatible client.

How It Works

AI Agent  ←─ MCP (stdio/SSE/HTTP) ─→  lens-studio-mcp  ←─ HTTP JSON-RPC ─→  Lens Studio (port 50050)

Lens Studio 5.15+ ships with a built-in HTTP MCP server at localhost:50050/mcp. This package is a thin proxy that:

  1. Discovers all tools from Lens Studio's API
  2. Registers them as MCP tools with friendly wrappers
  3. Forwards tool calls via HTTP and handles authentication
  4. Adds convenience tools for face filters, materials, colors, and macOS UI automation

Installation

From PyPI (recommended)

pip install lens-studio-mcp

From source

git clone https://github.com/superdwayne/lens-studio-mcp.git
cd lens-studio-mcp
pip install -e .

Quick Start

1. Open Lens Studio

Launch Lens Studio 5.15+ and open or create a project. The built-in MCP server starts automatically on port 50050.

2. Configure your AI agent

Add lens-studio-mcp to your editor's MCP configuration:

Windsurf (.windsurf/mcp.json or project .mcp.json):

{
  "mcpServers": {
    "lens-studio": {
      "command": "lens-studio-mcp",
      "args": ["--transport", "stdio"]
    }
  }
}

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "lens-studio": {
      "command": "lens-studio-mcp",
      "args": ["--transport", "stdio"]
    }
  }
}

Cursor (.cursor/mcp.json):

{
  "mcpServers": {
    "lens-studio": {
      "command": "lens-studio-mcp",
      "args": ["--transport", "stdio"]
    }
  }
}

SSE transport (for remote/web clients):

lens-studio-mcp --transport sse --port 8000

Streamable HTTP transport:

lens-studio-mcp --transport streamable-http --port 8000

3. Start building

The first time you connect, Lens Studio shows a permission popup — click Allow. After that, the auth token is cached and reused automatically.

Now just tell your AI agent what to build:

"Create a face filter with a red clown nose and colorful wig"

Tools

Connection & Status

Tool Description
connect() Authenticate with Lens Studio (triggers permission popup on first use)
status() Connection state, port, cached tool count
list_tools() List all available Lens Studio tools
lens_tool(name, arguments) Call any Lens Studio tool directly by name

Scene

Tool Description
get_scene() Full scene hierarchy with names, types, components
create_object(name, preset?) Create a scene object (optional preset template)
delete_object(name) Remove a scene object by name
add_primitive(shape, name?) Quick-add: sphere, cube, cylinder, camera, light, image, text
set_property(uuid, path, value, type) Set any property on an object/component/asset
create_asset(name, type) Create a new asset (Material, RenderTarget, etc.)

Materials & Colors

Tool Description
create_material(name, color?, r?, g?, b?) Create a PBR or unlit material with a solid color
set_color(object_name, color?) Set an object's color by name (auto-creates material)
assign_material(object_name, material_name) Assign an existing material to an object

Face Filters

Tool Description
create_face_anchor(name?) Create a head-tracked anchor with Face Occluder
add_face_element(parent, landmark, shape?) Add 3D element at a face landmark position
get_face_landmarks(landmark?) Reference positions for nose, eyes, ears, cheeks, etc.

Knowledge Base

Tool Description
query_knowledge_base(query) Search Lens Studio docs and knowledge base

macOS UI Automation

Fallback tools for operations not covered by the API:

ui_activate, ui_menu_click, ui_new_project, ui_save_project, ui_open_project, ui_preview, ui_keystroke, ui_type_text, ui_import_asset, ui_export_lens, ui_add_object, ui_dump_menus, ui_list_buttons, ui_click_button, ui_request_permissions

Environment Variables

Variable Default Description
LENS_MCP_PORT 50050 Lens Studio's MCP server port
LENS_MCP_TOKEN_FILE ~/.lens_mcp_token.json Path to cached auth token

Requirements

  • Python 3.10+
  • Lens Studio 5.15+ (running on the same machine)
  • macOS recommended (UI automation tools are macOS-only, but all API tools work cross-platform)

Security

  • Lens Studio's MCP server binds to localhost only — not accessible from the network.
  • Auth tokens are stored locally at ~/.lens_mcp_token.json.
  • The SSE/HTTP transport also binds to 127.0.0.1 by default.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lens_studio_mcp-0.1.0.tar.gz (32.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lens_studio_mcp-0.1.0-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

Details for the file lens_studio_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: lens_studio_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 32.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for lens_studio_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 690143f019cb85e3f0cc8b139470caf07ff26f895651094c70e1f56c672c763f
MD5 5b62b922fda66010f374f1d96ee3b62a
BLAKE2b-256 de22e90d37db96960d1cd0245aafd3050d7d17bae20ddf33808c4aff4ea50301

See more details on using hashes here.

File details

Details for the file lens_studio_mcp-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for lens_studio_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ff5f55d45a1da88c97f289aeb906c2efb730500eea28ecb6bb1d210d83ad989b
MD5 85fbf738f3698cdc6b802c2155e0300f
BLAKE2b-256 5e7148dc6ed008f611a30828b43c53c239034e459ae88b2aaff022a87dda27fb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page