截图服务

一个为AI工具提供截图功能的MCP服务器,能够捕获和处理屏幕内容。

  • by codingthefuturewithai
  • Python
  • 本地部署
  • 26 星标
  • 更新于
在 GitHub 查看 codingthefuturewithai/screenshot_mcp_server

使用说明

MCP服务器截图

一个MCP服务器,为AI工具提供屏幕截图功能,允许它们捕获和处理屏幕内容。

概述

此MCP服务器使AI工具能够截取用户屏幕的屏幕截图,使AI助手能够查看和分析用户正在查看的内容。该服务器以适合AI处理的格式处理图像捕获、压缩和交付。

特性

  • 拍摄全屏截图
  • 自动JPEG压缩,实现高效传输
  • Base64编码图像数据,传输可靠
  • 支持stdio和SSE传输模式
  • 可配置的图像质量和优化
  • 用于测试的简单命令行界面

安装

来源

# Clone the repository
git clone https://github.com/codingthefuturewithai/screenshot_mcp_server.git
cd screenshot_mcp_server

# Install using UV (recommended)
uv pip install -e .

# Or using pip
pip install -e .

可用工具

take_screenshot

描述:截取用户屏幕的屏幕截图,并将其作为JPEG图像返回。

参数:无

退货:

  • JPEG格式的图像内容,base64编码

用法

服务器可以通过两种方式使用:

命令行客户端

# Take a screenshot and save it to a file
screenshot_mcp_server-client output.jpg

程序化使用

from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client

async with stdio_client(StdioServerParameters(command="screenshot_mcp_server-server")) as (read, write):
    async with ClientSession(read, write) as session:
        result = await session.call_tool("take_screenshot")
        # Process the screenshot data...

需求

  • Python 3.10或更高版本(<3.13)
  • 依赖关系:
    • mcp>=1.0.0
    • 从 >= 0.9.54
    • 枕头>=10.0.0
  • 操作系统:Linux、macOS、Windows

配置

服务器支持两种传输模式:

  • stdio(默认):用于命令行
  • SSE:对于基于web的应用程序,默认情况下在端口3001上运行

要在SSE模式下运行:

screenshot_mcp_server-server-sse --port 3001

许可证

该项目根据MIT许可证获得许可。

作者

蒂姆·基钦斯(timkitch@codingthefuture.ai)