Metro Logs MCP
Captures and provides access to React Native console logs from Metro bundler, enabling AI assistants to retrieve, filter, and search app logs in real-time without manual copy/paste.
README
Metro Logs MCP
An MCP (Model Context Protocol) server that captures React Native console logs from Metro bundler, enabling AI assistants like Claude to access app logs without manual copy/paste.
Features
- Captures
console.log,console.warn,console.errorfrom React Native apps - Supports both Expo SDK 54+ (React Native Bridgeless) and RN 0.70+ (Hermes)
- Auto-discovers running Metro servers on common ports
- Filters logs by level (log, warn, error, info, debug)
- Circular buffer stores last 1000 log entries
Requirements
- Node.js 18+
- React Native app running with Metro bundler
Installation
Note: This package is not published to npm. Only local build installation is available.
Option 1: Clone and Build
git clone git@github.com:igorzheludkov/metro-logs-mcp.git ~/metro-logs-mcp
cd ~/metro-logs-mcp
npm install
npm run build
Option 2: Manual Setup
mkdir ~/metro-logs-mcp
cd ~/metro-logs-mcp
npm init -y
npm install @modelcontextprotocol/sdk zod@3 ws
npm install -D @types/node @types/ws typescript
Copy the source files and build:
npm run build
Claude Code Setup
Global (all projects)
claude mcp add metro-logs node ~/metro-logs-mcp/build/index.js --scope user
Project-specific
claude mcp add metro-logs node ~/metro-logs-mcp/build/index.js --scope project
Manual Configuration
Add to ~/.claude.json (user scope) or .mcp.json (project scope):
{
"mcpServers": {
"metro-logs": {
"type": "stdio",
"command": "node",
"args": ["/path/to/metro-logs-mcp/build/index.js"]
}
}
}
Restart Claude Code after adding the configuration.
Available Tools
| Tool | Description |
|---|---|
scan_metro |
Scan for running Metro servers and auto-connect |
connect_metro |
Connect to a specific Metro port |
get_apps |
List connected React Native apps |
get_logs |
Retrieve console logs (with optional filtering and start position) |
search_logs |
Search logs for specific text (case-insensitive) |
clear_logs |
Clear the log buffer |
Usage
-
Start your React Native app:
npm start # or expo start -
In Claude Code, scan for Metro:
Use scan_metro to find and connect to Metro -
Get logs:
Use get_logs to see recent console output
Filtering Logs
get_logs with maxLogs=20 and level="error"
Available levels: all, log, warn, error, info, debug
Start from Specific Line
get_logs with startFromText="iOS Bundled" and maxLogs=100
This finds the last (most recent) line containing the text and returns logs from that point forward. Useful for getting logs since the last app reload.
Search Logs
search_logs with text="error" and maxResults=20
Case-insensitive search across all log messages.
Supported React Native Versions
| Version | Runtime | Status |
|---|---|---|
| Expo SDK 54+ | React Native Bridgeless | ✓ |
| RN 0.70 - 0.76 | Hermes React Native | ✓ |
| RN < 0.70 | JSC | Not tested |
How It Works
- Fetches device list from Metro's
/jsonendpoint - Connects to the main JS runtime via CDP (Chrome DevTools Protocol) WebSocket
- Enables
Runtime.enableto receiveRuntime.consoleAPICalledevents - Stores logs in a circular buffer for retrieval
Troubleshooting
No devices found
- Make sure the app is running on a simulator/device
- Check that Metro bundler is running (
npm start)
Wrong device connected
The server prioritizes devices in this order:
- React Native Bridgeless (SDK 54+)
- Hermes React Native
- Any React Native (excluding Reanimated/Experimental)
Logs not appearing
- Ensure the app is actively running (not just Metro)
- Try
clear_logsthen trigger some actions in the app - Check
get_appsto verify connection status
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。