mac-vision-mcp

mac-vision-mcp

An MCP server that enables AI coding agents to capture screenshots of macOS windows and displays on demand, providing tools for window discovery and screen capture.

Category
访问服务器

README

mac-vision-mcp

npm version License: MIT macOS

A Model Context Protocol (MCP) server that enables AI coding agents to capture screenshots of macOS windows and displays on demand.

Why

LLMs are amazing at using images for context. You can feed image files to an LLM and it can do things like analyze a design or read text. I find myself constantly wanting to "show" LLMs what I'm looking at, but I found it cumbersome to take a screenshot, find the file, and give the path to the LLM. Additionally I ended up with thousands of screenshots over time that I needed to manage. So I thought, why can't the LLM just do this itself? And that's what led to this project.

Features

  • Window Discovery - List all open windows with metadata (title, app, bounds, display)
  • Window Capture - Capture screenshots of specific windows by ID
  • Display Capture - Capture entire displays (single or all)
  • Smart Filtering - Automatically filters out system overlays and utility windows
  • Natural Integration - Works seamlessly with any MCP-compatible AI agent
  • Privacy First - Runs entirely locally on your Mac
  • Professional Logging - Structured logging with timestamps for debugging

System Requirements

  • macOS: 12.0+ (Monterey or later)
  • Architecture: Intel (x64) or Apple Silicon (arm64)
  • Node.js: 16.0.0 or higher
  • Permissions: Screen Recording permission required

Installation

Global Installation (Recommended)

npm install -g mac-vision-mcp

Using with npx (No Installation)

npx -y mac-vision-mcp

Quick Start

1. Grant Screen Recording Permission

On first run, macOS will prompt you to grant Screen Recording permission:

  1. Open System Preferences
  2. Go to Privacy & Security > Screen Recording
  3. Enable permission for the application running the MCP server
  4. Restart the MCP server

2. Configure Your MCP Client

For Claude Code

Add to .mcp.json in your project:

{
  "mcpServers": {
    "mac-vision": {
      "command": "npx",
      "args": ["-y", "mac-vision-mcp"]
    }
  }
}

For Cursor

Add to ~/.cursor/mcp.json:

{
  "mcpServers": {
    "mac-vision": {
      "command": "npx",
      "args": ["-y", "mac-vision-mcp"]
    }
  }
}

For Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "mac-vision": {
      "command": "npx",
      "args": ["-y", "mac-vision-mcp"]
    }
  }
}

3. Use with Your AI Agent

Once configured, your AI agent can use natural language to capture screenshots:

User: "Show me my Chrome window with the error"

Agent: [calls list_windows]
Agent: [calls capture_window with the Chrome window ID]
Agent: "I can see the 404 error in your browser..."

MCP Tools

list_windows

Get all open windows with metadata.

Parameters: None

Returns:

{
  "windows": [
    {
      "id": "12345",
      "title": "Chrome - Documentation",
      "app": "Google Chrome",
      "bounds": {
        "x": 0,
        "y": 23,
        "width": 1920,
        "height": 1057
      },
      "display": 0
    }
  ]
}

capture_window

Capture a screenshot of a specific window.

Parameters:

  • window_id (required, string) - Window ID from list_windows
  • mode (optional, string) - Capture mode: "full" or "content" (default: "full")
  • output_path (optional, string) - Custom output path (must end with .png)

Returns:

{
  "success": true,
  "file_path": "/tmp/screenshot_12345.png",
  "window": {
    "id": "12345",
    "title": "Chrome - Documentation",
    "app": "Google Chrome"
  }
}

capture_windows

Capture screenshots of multiple windows at once. Useful when you need to see several windows simultaneously.

Parameters:

  • window_ids (required, string[]) - Array of Window IDs from list_windows
  • mode (optional, string) - Capture mode: "full" or "content" (default: "full")
  • output_dir (optional, string) - Custom output directory (default: temp directory)

Returns:

{
  "success": true,
  "captures": [
    {
      "window_id": "12345",
      "success": true,
      "file_path": "/tmp/screenshot_12345.png",
      "window": {
        "id": "12345",
        "title": "Chrome - Documentation",
        "app": "Google Chrome"
      }
    },
    {
      "window_id": "67890",
      "success": true,
      "file_path": "/tmp/screenshot_67890.png",
      "window": {
        "id": "67890",
        "title": "VS Code",
        "app": "Code"
      }
    }
  ]
}

capture_display

Capture entire display(s).

Parameters:

  • display_id (optional, number) - Specific display number (0-indexed), or omit to capture all

Single Display Returns:

{
  "success": true,
  "file_path": "/tmp/display_0.png",
  "display": 0
}

All Displays Returns:

{
  "success": true,
  "captures": [
    {
      "display": 0,
      "file_path": "/tmp/display_0.png"
    },
    {
      "display": 1,
      "file_path": "/tmp/display_1.png"
    }
  ]
}

Troubleshooting

Permission Denied Errors

Error: Screen Recording permission required

Solution:

  1. Open System Preferences > Privacy & Security > Screen Recording
  2. Enable permission for your terminal or application
  3. Restart the MCP server

Window Not Found

Error: Window {id} not found. It may have been closed.

Cause: The window was closed between listing and capturing.

Solution: Call list_windows again to get current window IDs.

Invalid Output Path

Error: Output path must end with .png

Solution: Ensure custom output paths have a .png extension.

Native Module Issues

Error: Native module compilation errors

Solution:

  1. Ensure you're on macOS 12.0+
  2. Verify Node.js version is 16.0.0+
  3. Try reinstalling: npm install -g mac-vision-mcp --force

No Windows Listed

Issue: list_windows returns empty array or missing windows

Cause: Screen Recording permission not granted or windows filtered out

Solution:

  1. Verify Screen Recording permission is enabled
  2. Note: System windows and gesture overlays are automatically filtered
  3. Windows smaller than 50x50 pixels are excluded

Architecture

  • Language: TypeScript/Node.js with ESM modules
  • MCP SDK: @modelcontextprotocol/sdk (v1.22.0)
  • Screenshot Library: node-screenshots (v0.2.4) with native N-API bindings
  • Window Metadata: get-windows (v9.2.3)
  • Permissions: mac-screen-capture-permissions (v2.1.0)
  • Validation: Zod (v3.25.0)

Development

Local Setup

# Clone repository
git clone https://github.com/jasich/mac-vision-mcp.git
cd mac-vision-mcp

# Install dependencies
npm install

# Build
npm run build

# Run locally
node dist/index.js

Using Local Build in Another Project

To test your local development build with Claude Code or another MCP client:

  1. Build the project (if not already done):

    cd /path/to/mac-vision-mcp
    npm run build
    
  2. Configure your other project's .claude.json with the absolute path:

    {
      "mcpServers": {
        "mac-vision": {
          "command": "node",
          "args": ["/path/to/mac-vision-mcp/dist/index.js"]
        }
      }
    }
    
  3. Restart Claude Code to load the local build

  4. Make changes and rebuild as needed:

    npm run build  # Rebuild after code changes
    

Note: Replace /path/to/mac-vision-mcp with your actual absolute path to the project.

Testing with MCP Inspector

# Run with MCP Inspector for debugging
npx @modelcontextprotocol/inspector node ./dist/index.js

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.

License

MIT License - see LICENSE file for details.

Acknowledgments

Support

  • Issues: Report bugs or request features via GitHub Issues
  • Documentation: Model Context Protocol Docs
  • MCP Inspector: Use for testing and debugging MCP tools

推荐服务器

Baidu Map

Baidu Map

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

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

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

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

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

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

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

官方
精选
本地
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 模型以安全和受控的方式获取实时的网络信息。

官方
精选