Tshark MCP Server

Tshark MCP Server

Analyzes pcap files using tshark to detect network attacks and security threats.

Category
访问服务器

README

Tshark MCP Server

An MCP (Model Context Protocol) server for analyzing pcap files using tshark to detect potential network attacks and security threats.

Features

  • Automated Attack Detection: Analyzes pcap files for common attack patterns:

    • Port scanning attempts
    • DDoS indicators (traffic volume anomalies)
    • DNS tunneling and exfiltration
    • HTTP-based attacks (SQL injection, XSS)
    • Failed connection attempts
    • Suspicious IP addresses
  • Custom Queries: Run custom tshark queries with Wireshark display filters

  • Statistics: Get comprehensive pcap statistics including protocols and conversations

Prerequisites

Option 1: Docker (Recommended - Most Portable)

  • Docker and Docker Compose installed
  • No other dependencies needed!

Option 2: Local Installation

  • Node.js (v16 or higher)
  • Tshark installed and available in PATH
    • Windows: Install Wireshark (includes tshark)
    • Linux: sudo apt-get install tshark
    • macOS: brew install wireshark

Installation

Docker Setup (Recommended)

  1. Build the Docker image:
docker-compose build
  1. Place your pcap files in the pcaps/ directory (or configure a custom volume in docker-compose.yml)

  2. Configure Claude Desktop with the Docker container:

Add to your Claude Desktop config file:

Windows: %APPDATA%\Claude\claude_desktop_config.json macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Linux: ~/.config/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "tshark": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "-v",
        "/path/to/your/pcaps:/pcaps:ro",
        "tshark-mcp-server:latest"
      ]
    }
  }
}

Windows example:

{
  "mcpServers": {
    "tshark": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "-v",
        "C:\\captures:/pcaps:ro",
        "tshark-mcp-server:latest"
      ]
    }
  }
}

Linux/Mac example:

{
  "mcpServers": {
    "tshark": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "-v",
        "${HOME}/captures:/pcaps:ro",
        "tshark-mcp-server:latest"
      ]
    }
  }
}

Local Installation (Alternative)

  1. Install dependencies:
npm install
  1. Configure Claude Desktop:
{
  "mcpServers": {
    "tshark": {
      "command": "node",
      "args": ["/absolute/path/to/tshark-mcp/index.js"]
    }
  }
}

Usage

After configuration, restart Claude Desktop. Your pcap files should be accessible at /pcaps/ (Docker) or their original paths (local).

Available Tools

1. analyze_pcap_attacks

Automatically analyzes a pcap file for security threats.

Parameters:

  • pcap_path (required): Path to the pcap file

Example:

# Docker: pcap files are in /pcaps inside container
Analyze /pcaps/traffic.pcap for attacks

# Local installation
Analyze c:\captures\traffic.pcap for attacks

The AI will automatically identify suspicious IPs and attack patterns.

2. query_pcap

Run custom tshark queries with display filters.

Parameters:

  • pcap_path (required): Path to the pcap file
  • display_filter (optional): Wireshark display filter
  • fields (optional): Array of fields to extract

Examples:

# Docker
Show all HTTP GET requests from /pcaps/traffic.pcap
Query /pcaps/traffic.pcap with filter "ip.src==192.168.1.100 && tcp.port==443"

# Local
Show all HTTP GET requests from traffic.pcap
Extract source IPs and ports from traffic.pcap where tcp.flags.syn==1

3. get_pcap_stats

Get general statistics about a pcap file.

Parameters:

  • pcap_path (required): Path to the pcap file

Example:

Get statistics for traffic.pcap

How It Works

AI-Powered Analysis

When you use analyze_pcap_attacks, the server:

  1. Runs multiple tshark queries to extract security-relevant data
  2. Formats the results for AI analysis
  3. The AI (Claude) analyzes the data to:
    • Identify suspicious IP addresses
    • Detect attack patterns
    • Explain potential threats
    • Provide remediation suggestions

Example Workflow

User: "Analyze /pcaps/suspicious.pcap"

AI Response:

  • Identifies potential attackers by IP
  • Explains attack types detected (port scan, DDoS, etc.)
  • Lists suspicious domains or URLs
  • Recommends next steps

User: "Show me all traffic from IP 192.168.1.50"

AI uses query_pcap:

  • Filters pcap for that specific IP
  • Shows relevant packets
  • Analyzes behavior

Docker Benefits

Portability: Works on Windows, Linux, and macOS ✅ No Dependencies: Tshark is pre-installed in the container ✅ Isolation: Secure execution environment ✅ Easy Updates: Just rebuild the image ✅ Consistent: Same environment everywhere

Detection Capabilities

The server looks for:

  • Port Scanning: SYN packets to multiple ports from the same source
  • DDoS Attacks: Unusual traffic volumes from single sources
  • DNS Anomalies: Suspicious query patterns, potential tunneling
  • HTTP Attacks: SQL injection, XSS, directory traversal in URLs
  • Reconnaissance: Multiple failed connections (RST packets)
  • Protocol Anomalies: Unusual protocol usage patterns

Wireshark Display Filter Examples

Common filters you can use with query_pcap:

ip.addr==192.168.1.1          # Traffic to/from specific IP
tcp.port==80                  # HTTP traffic
http.request.method==POST     # POST requests
dns.qry.name contains "evil"  # DNS queries with "evil"
tcp.flags.syn==1 && tcp.flags.ack==0  # SYN packets (port scan)
icmp.type==8                  # ICMP echo requests (ping)

Troubleshooting

"tshark: command not found"

  • Ensure tshark is installed and in your PATH
  • Restart Claude Desktop after installation

Permission errors on Linux:

sudo dpkg-reconfigure wireshark-common  # Select "Yes"
sudo usermod -a -G wireshark $USER

Log out and back in for changes to take effect.

Security Note

This tool is designed for defensive security analysis only. Use it to:

  • Analyze your own network traffic
  • Investigate security incidents
  • Learn about network security
  • Detect threats in authorized environments

License

MIT

推荐服务器

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

官方
精选