Skip to main content
Glama

Screenshot MCP Server

by yushinna
  • Apple
test_server.py3.19 kB
#!/usr/bin/env python3 """ Screenshot MCP Server Test Script Verifies that the server is working correctly """ import asyncio import json from pathlib import Path async def test_mcp_server(): """Test basic MCP server functionality""" print("Screenshot MCP Server Test Starting...") print("-" * 50) # 1. Import test print("1. Testing module import...") try: from server import mcp, screenshot, screenshot_window, screenshot_area, list_screenshots print("✓ Successfully imported server.py") except ImportError as e: print(f"✗ Import error: {e}") return # 2. Test functions directly print("\n2. Testing screenshot function...") try: result = screenshot() print("✓ Screenshot function works") except Exception as e: print(f"✗ Function test error: {e}") return # 3. Screenshot directory check print("\n3. Checking screenshot save directory...") screenshot_dir = Path.home() / "Desktop" / "mcp-screenshots" if screenshot_dir.exists(): print(f"✓ Directory exists: {screenshot_dir}") else: print(f"! Directory does not exist. Creating: {screenshot_dir}") screenshot_dir.mkdir(exist_ok=True) print("✓ Directory created") # 4. screencapture command check print("\n4. Checking screencapture command...") import subprocess result = subprocess.run(["which", "screencapture"], capture_output=True, text=True) if result.returncode == 0: print(f"✓ screencapture command found: {result.stdout.strip()}") else: print("✗ screencapture command not found") return # 5. Basic functionality test print("\n5. Testing basic functionality...") try: # Simulate tool listing print(" - Checking available tools...") tools_count = 4 # screenshot, screenshot_window, screenshot_area, list_screenshots print(f"✓ {tools_count} tools defined") print("\nAvailable tools:") print(" • screenshot - Capture entire desktop") print(" • screenshot_window - Capture specific window") print(" • screenshot_area - Capture selected area") print(" • list_screenshots - List saved screenshots") except Exception as e: print(f"✗ Functionality test error: {e}") return print("\n" + "-" * 50) print("✓ All tests completed successfully!") print("\nNext steps:") print("1. Update Claude Desktop configuration file") print("2. Restart Claude Desktop") print("3. Verify MCP icon appears in new conversations") # Display configuration example print("\nClaude Desktop configuration example:") config_example = { "mcpServers": { "screenshot": { "command": str(Path.home() / "screenshot-mcp" / "venv" / "bin" / "python"), "args": [str(Path.home() / "screenshot-mcp" / "server.py")], "env": {} } } } print(json.dumps(config_example, indent=2)) if __name__ == "__main__": asyncio.run(test_mcp_server())

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/yushinna/screenshot-mcp'

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