Mentra Glass MCP Server

Mentra Glass MCP Server

Enables control of MentraOS smart glasses through tools for managing text displays, audio output, and input transcriptions. It integrates with Mentra Cloud to facilitate seamless interaction with smart glass hardware using natural language commands.

Category
访问服务器

README

Mentra Glass MCP Server

A Model Context Protocol (MCP) server for controlling MentraOS smart glasses. Built with Bun, Mentra SDK, and MCP SDK.

Features

  • MCP Support: Exposes tools to control glasses (Display, Audio, Input) via JSON-RPC.
  • Multi-User: Supports multiple users via Bearer token authentication (email).
  • Mentra Integration: Connects to Mentra Cloud as an AppServer.
  • Docker Ready: Includes Dockerfile and Compose setup.

Architecture

MCP Client (Claude/Cursor) 
       ⬇️ JSON-RPC (HTTP)
   [MCP Server]
       ⬇️ Mentra SDK
   Mentra Cloud
       ⬇️
   Smart Glasses

Prerequisites

  • Bun (v1.0+)
  • Mentra Developer Account & API Key

Authentication

This server uses a secure token-based authentication system.

  1. Start the Server (Locally or Deployed).
  2. Open the Webview:
    • Local: http://localhost:3000/webview
    • Deployed: https://your-app.onrender.com/webview
  3. Login: Sign in with your Mentra account.
  4. Get Token: Copy the Access Token displayed on the screen.

Connecting to Clients

1. GitHub Copilot (VS Code)

Add the server to your MCP configuration file (usually ~/.config/github-copilot/mcp.json or via the VS Code command "MCP: Manage MCP Servers").

{
  "mcpServers": {
    "mentra-glasses": {
  "type": "sse",
  "url": "mcp url here",
  "headers": {
    "Authorization": "Bearer YOUR_ACCESS_TOKEN"
  }
  }
}

Note: Replace the URL and Token with your actual values.

2. Claude Desktop

Edit your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "mentra-glass": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-sse-client"],
      "env": {
        "MCP_SSE_URL": "http://localhost:3000/mcp",
        "MCP_SSE_HEADERS": "{\"Authorization\": \"Bearer YOUR_ACCESS_TOKEN\"}"
      }
    }
  }
}

3. Cursor

  1. Go to Settings > Features > MCP.
  2. Click + Add New MCP Server.
  3. Name: mentra-glass
  4. Type: SSE
  5. URL: https://your-app.onrender.com/mcp?token=YOUR_ACCESS_TOKEN (Note: Cursor may not support custom headers yet, so we support passing the token via query parameter as a fallback)

Running Locally

# Start the server
bun run src/index.ts

# Watch mode
bun run dev

The server will start on http://localhost:3000.

  • /mcp: MCP JSON-RPC endpoint
  • /health: Health check
  • /webview: Auth & Settings

Running with Docker

# Build & Run
docker compose up --build -d

Available Tools

  • Display: glasses_display_text, glasses_clear_display
  • Audio: glasses_speak
  • Input: glasses_get_transcriptions, glasses_get_events
  • System: glasses_status

Project Structure

  • src/config: Environment configuration
  • src/services: Core logic (Mentra SDK, Session Management)
  • src/tools: MCP Tool definitions
  • src/index.ts: Entry point

Deployment

Option 1: Render + Supabase (Recommended for Free Tier)

Best for indie devs. Uses Supabase for the database (since Render's free tier wipes local files) and Render for hosting.

  1. Database: Follow SUPABASE_SETUP.md to create your Supabase project and get credentials.
  2. Hosting:
    • Sign up at render.com.
    • Create a new Web Service.
    • Connect your GitHub repository.
    • Runtime: Docker.
    • Environment Variables:
      • SUPABASE_URL: Your Supabase URL.
      • SUPABASE_SERVICE_KEY: Your Supabase Service Role Key.
      • MENTRAOS_API_KEY: Your Mentra API Key.
      • PACKAGE_NAME: com.yourname.glassmcp.
      • PORT: 3000.

Option 2: Fly.io (Best for SQLite)

Allows you to keep using the local SQLite database by attaching a persistent volume.

  1. Install flyctl.
  2. Run fly launch.
  3. Create a volume: fly volumes create mcp_data.
  4. Update fly.toml to mount the volume to /app/mcp.sqlite.

Option 3: Self-Hosted (VPS)

Run standard Docker Compose on any server (DigitalOcean, Hetzner, Oracle Cloud).

docker compose up -d

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选