Skip to main content
Glama
sethbang

MCP Screenshot Server

by sethbang

Universal Screenshot MCP

npm version MCP Registry License

AIアシスタントにスクリーンショット機能を提供するMCP (Model Context Protocol)サーバーです。PuppeteerによるWebページキャプチャと、OSネイティブツールを使用したクロスプラットフォームのシステムスクリーンショットの両方に対応しています。

機能

  • Webページスクリーンショット — ヘッドレスChromiumブラウザを使用して、あらゆる公開URLをキャプチャ

  • クロスプラットフォームのシステムスクリーンショット — OSネイティブツール(macOSのscreencapture、Linuxのmaim/scrot/gnome-screenshotなど、WindowsのPowerShell+.NET)を使用したフルスクリーン、ウィンドウ、または領域キャプチャ

  • セキュリティ重視の設計 — SSRF防止、パストラバーサル保護、DNSリバインディング対策、コマンドインジェクション防止、DoS制限

  • MCPネイティブ — Claude Desktop、Cursor、およびMCP互換クライアントと直接統合

Related MCP server: Webpage Screenshot MCP Server

要件

  • Node.js >= 18.0.0

  • Chromium は初回実行時にPuppeteerによって自動的にダウンロードされます

take_system_screenshot のプラットフォーム別要件

プラットフォーム

必要なツール

備考

macOS

screencapture (標準搭載)

追加インストール不要

Linux

maim, scrot, gnome-screenshot, spectacle, grim, または import (ImageMagick) のいずれか

全機能サポートには maim または scrot を推奨。ウィンドウ名によるキャプチャには xdotool もインストールしてください。

Windows

powershell (標準搭載)

.NET System.Drawing を使用 — 追加インストール不要

Linuxのインストール例

# Ubuntu/Debian (recommended)
sudo apt install maim xdotool

# Fedora
sudo dnf install maim xdotool

# Arch Linux
sudo pacman -S maim xdotool

# Wayland (Sway, etc.)
sudo apt install grim

クイックスタート

npmからインストール

npm install -g universal-screenshot-mcp

または npx で直接実行:

npx universal-screenshot-mcp

ソースからインストール

git clone https://github.com/sethbang/mcp-screenshot-server.git
cd mcp-screenshot-server
npm install
npm run build

MCPクライアントの設定

MCPクライアントの設定にサーバーを追加します。Claude Desktopの場合、~/Library/Application Support/Claude/claude_desktop_config.json を編集します:

{
  "mcpServers": {
    "screenshot-server": {
      "command": "npx",
      "args": ["-y", "universal-screenshot-mcp"]
    }
  }
}

ソースからインストールした場合は以下:

{
  "mcpServers": {
    "screenshot-server": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-screenshot-server/build/index.js"]
    }
  }
}

Cursorやその他のMCPクライアントについては、それぞれのドキュメントで同等の設定方法を確認してください。

ツール

このサーバーは2つのMCPツールを公開しています:

take_screenshot

ヘッドレスPuppeteerブラウザを介してWebページ(または特定の要素)をキャプチャします。

パラメータ

必須

説明

url

string

キャプチャするURL (http/httpsのみ)

width

number

ビューポートの幅 (1–3840)

height

number

ビューポートの高さ (1–2160)

fullPage

boolean

スクロール可能なページ全体をキャプチャ

selector

string

特定の要素をキャプチャするためのCSSセレクタ

waitForSelector

string

キャプチャ前にこのセレクタを待機

waitForTimeout

number

ミリ秒単位の遅延 (0–30000)

outputPath

string

出力ファイルパス (デフォルト: ~/Documents/screenshots)

プロンプト例:

https://example.com のスクリーンショットを1920x1080で撮影して

take_system_screenshot

OSネイティブツールを使用して、デスクトップ、特定のアプリケーションウィンドウ、または画面領域をキャプチャします。macOSLinuxWindowsで動作します。

パラメータ

必須

説明

mode

enum

fullscreen, window, または region

windowId

number

ウィンドウモード用のウィンドウID

windowName

string

ウィンドウモード用のアプリ名 (例: "Safari", "Firefox")

region

object

領域モード用の { x, y, width, height }

display

number

マルチモニター設定用のディスプレイ番号

includeCursor

boolean

キャプチャにマウスカーソルを含める

format

enum

png (デフォルト) または jpg

delay

number

秒単位のキャプチャ遅延 (0–10)

outputPath

string

出力ファイルパス (デフォルト: ~/Documents/screenshots)

クロスプラットフォームの機能サポート

機能

macOS

Linux

Windows

フルスクリーン

領域

✅ (maim, scrot, grim, import)

ウィンドウ名指定

⚠️ X11 + xdotool

⚠️ ベストエフォート

ウィンドウID指定

✅ X11のみ

⚠️ HWND

マルチディスプレイ

⚠️ ツール依存

カーソルを含める

⚠️ ツール依存

⚠️

遅延

プロンプト例:

Safariウィンドウのシステムスクリーンショットを撮影して

設定

環境変数

変数

デフォルト

説明

SCREENSHOT_OUTPUT_DIR

Documents/screenshots

~ からの相対パスによるデフォルト出力ディレクトリ

ALLOW_LOCAL

false

localhost/127.x.x.x/[::1] のスクリーンショットを許可するには true に設定 (ローカル開発サーバーで有用)

出力ディレクトリ

スクリーンショットはデフォルトで ~/Documents/screenshots に保存されます(SCREENSHOT_OUTPUT_DIRで設定可能)。カスタム出力パスは、許可されたディレクトリのいずれかに解決される必要があります:

ディレクトリ

説明

~/Documents/screenshots

デフォルトの出力場所 (設定可能)

~/Desktop/Screenshots

元のデフォルトの場所

~/Downloads

ユーザーのダウンロードフォルダ

~/Documents

ユーザーのドキュメントフォルダ

/tmp

システム一時ディレクトリ

セキュリティ

このサーバーは複数のセキュリティ強化レイヤーを実装しています:

ID

脅威

緩和策

SEC-001

SSRF / DNSリバインディング

ブロックされたIP範囲に対してURLを検証。--host-resolver-rules を使用したIP固定によるリクエスト前のDNS解決。ナビゲーションリダイレクトの再検証

SEC-003

コマンドインジェクション

すべてのサブプロセスで execFile を使用 (シェルなし)。アプリ名を SAFE_APP_NAME_PATTERN に対して検証

SEC-004

パストラバーサル

fs.realpath() シンボリックリンク解決による出力パスの検証。許可されたディレクトリに制限

SEC-005

サービス拒否 (DoS)

セマフォによりPuppeteerの同時実行数を3に制限

詳細は docs/security.md を参照してください。

開発

スクリプト

コマンド

説明

npm run build

TypeScriptを build/ にコンパイル

npm run watch

ファイル変更時に再コンパイル

npm test

ユニットテスト (高速、完全にモック化)

npm run test:integration

統合テスト (実際のDNS/ファイルシステム)

npm run test:e2e

E2Eテスト (実際のPuppeteer/ネイティブツール)

npm run test:all

すべてのテスト階層をまとめて実行

npm run test:linux

Docker経由でのLinux E2Eテスト (Dockerが必要)

npm run test:watch

ウォッチモードでテストを実行

npm run test:coverage

カバレッジレポート付きでテストを実行

npm run lint

ESLintでソースをリント

npm run inspector

デバッグ用にMCP Inspectorを起動

プロジェクト構造

src/
├── index.ts                 # Entry point — stdio transport
├── server.ts                # MCP server factory
├── config/
│   ├── index.ts             # Static constants (limits, allowed dirs)
│   └── runtime.ts           # Singleton semaphore, default directory
├── tools/
│   ├── take-screenshot.ts   # Web page capture tool
│   └── take-system-screenshot.ts  # macOS system capture tool
├── types/
│   └── index.ts             # Shared TypeScript interfaces
├── utils/
│   ├── helpers.ts           # Response builders, file utilities
│   ├── screenshot-provider.ts # Cross-platform provider interface + factory
│   ├── macos-provider.ts    # macOS: screencapture wrapper
│   ├── linux-provider.ts    # Linux: maim/scrot/gnome-screenshot/etc.
│   ├── windows-provider.ts  # Windows: PowerShell + .NET System.Drawing
│   ├── macos.ts             # Window ID lookup via CoreGraphics
│   └── semaphore.ts         # Async concurrency limiter
└── validators/
    ├── path.ts              # Output path validation (SEC-004)
    └── url.ts               # URL/SSRF validation (SEC-001)

テスト

テストは Vitest を使用し、3つの階層で行われます:

  • ユニット (npm test) — 完全な依存関係注入、実際のI/Oなし。高速なフィードバックループ。

  • 統合 (npm run test:integration) — 実際のDNS解決、一時ディレクトリを使用した実際のファイルシステム、ローカルHTTPサーバーに対する実際のPuppeteer。

  • E2E (npm run test:e2e) — 実際のネイティブスクリーンショットツール。macOSテストはネイティブで実行。Linuxテストは npm run test:linux を介してDockerで実行。

npm test                 # Unit tests (~300ms)
npm run test:linux       # Linux provider tests in Docker
npm run test:all         # Everything

MCP Inspectorによるデバッグ

npm run inspector

これにより、ビルドされたサーバーに接続された MCP Inspector が起動し、ツールを対話的に呼び出すことができます。

ライセンス

Apache-2.0 — Copyright 2026 Seth Bang

Install Server
A
license - permissive license
B
quality
-
maintenance - not tested

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sethbang/mcp-screenshot-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server