PacketScope Tracer API Skill & MCP Server
This skill enables LLM to interact with the PacketScope Tracer module API for route tracing, risk analysis, and history queries.
Overview
Tracer is a network path analysis module that provides:
- Real-time traceroute with ICMP and TCP protocols
- Geographic and ASN enrichment for each hop
- Route anomaly detection and risk scoring
- Historical route tracking and comparison
- Malicious IP detection against threat intelligence feeds
MCP Server Tools
The Tracer MCP Server provides the following tools for LLM interaction:
Route Tracing Tools
trace_target - Trace a network target and return hop-by-hop results
- Parameters:
target (string), use_cache (bool, default: True), protocol ("icmp" or "tcp", default: "icmp"), port (int, optional, required for TCP)
- Returns: Target, resolved IP, source (cache/live), hop list with geo/ASN info
get_trace_detail - Get detailed information about a specific hop
- Parameters:
target (string), hop_index (int, 0-based)
- Returns: Detailed hop info including IP, latency, jitter, packet loss, location, ASN, ISP, geo coordinates
compare_routes - Compare current route against historical routes
- Parameters:
target (string)
- Returns: New IPs, removed IPs, latency changes between current and historical path
Risk Analysis Tools
analyze_target - Run anomaly analysis and calculate risk score
- Parameters:
target (string), cache (bool, default: True)
- Returns: Anomalies list, alerts list, riskScore (0-100), riskLevel (low/medium/high)
History Tools
get_history - Get traceroute history records
- Parameters:
target (string, optional), limit (int, default: 20)
- Returns: Dictionary of history records keyed by target IP
Status Check Tools
API Endpoints
Base URL
http://localhost:8000
Route Tracing
Trace Target
- Endpoint:
GET /api/trace
- Description: Run a traceroute to the target
- Query Parameters:
target: IP address or domain (required)
use_cache: Use cached results if available (default: "true")
protocol: "icmp" or "tcp" (default: "icmp")
port: Port number, required when protocol=tcp (1-65535)
Response (streaming NDJSON, one hop per line):
{"hop": 1, "ip": "192.168.1.1", "latency": 1.23, "jitter": 0.5, "packet_loss": "0.0%", "bandwidth_mbps": 47.17, "location": "Beijing, China", "asn": "4134", "isp": "China Telecom", "geo": {"lat": 39.9, "lon": 116.4, "radius_km": 50, "timezone": "Asia/Shanghai"}}
Risk Analysis
Analyze Target
- Endpoint:
GET /api/analyze
- Description: Run anomaly analysis and risk scoring
- Query Parameters:
target: IP address or domain (required)
cache: Use cached trace results (default: "true")
Response:
{
"anomalies": [
{"type": "PathDeviation", "detail": "跳点 5 出现新IP 10.0.0.1"},
{"type": "HighLatency", "detail": "跳点 5 (10.0.0.1) 延迟过高 250ms"}
],
"alerts": [
"跳点 10.0.0.1 被列为恶意IP: Spamhaus DROP list"
],
"riskScore": 50
}
History
Get History
- Endpoint:
GET /api/history
- Description: Get traceroute history records
- Query Parameters:
target: IP or domain filter (optional)
Response:
{
"8.8.8.8": [
{
"timestamp": "20240101-120000",
"protocol": "icmp",
"result": [...]
}
]
}
Status Check
Readiness Check
- Endpoint:
GET /api/ready
- Description: Check if the Tracer service is ready
Response:
{
"ready": true,
"timestamp": "2024-01-01T12:00:00.000000"
}
Usage Examples
Python Client Example
from tracer_client import TracerClient
# Create client
client = TracerClient("http://localhost:8000")
# ICMP trace
result = client.trace("8.8.8.8")
print(f"Hops: {len(result.hops)}, Source: {result.source}")
# TCP trace
result = client.trace("1.1.1.1", protocol="tcp", port=443)
print(f"Hops: {len(result.hops)}")
# Risk analysis
analysis = client.analyze("8.8.8.8")
print(f"Risk Score: {analysis.risk_score}, Anomalies: {len(analysis.anomalies)}")
# History
history = client.get_history(target="8.8.8.8")
print(f"Records: {len(history.get('8.8.8.8', []))}")
Risk Score Levels
| Score |
Level |
Description |
| 0-39 |
low |
Route appears normal, no significant threats |
| 40-69 |
medium |
Some anomalies detected, moderate risk |
| 70-100 |
high |
Significant threats or multiple anomalies |
Anomaly Types
| Type |
Description |
PathDeviation |
A hop IP not seen in historical traces |
HighLatency |
A hop with latency exceeding 200ms |
MaliciousIP |
A hop IP found in threat intelligence feeds |
1---2name: packetscope-tracer3description: Trace network routes to a target IP or domain, get hop-by-hop path with geographic and ASN info, run anomaly analysis and risk scoring, and query traceroute history. Use when investigating network paths, latency, packet loss, or whether a route looks suspicious or hits a malicious IP.4---56# PacketScope Tracer API Skill & MCP Server78This skill enables LLM to interact with the PacketScope Tracer module API for route tracing, risk analysis, and history queries.910## Overview1112Tracer is a network path analysis module that provides:13- Real-time traceroute with ICMP and TCP protocols14- Geographic and ASN enrichment for each hop15- Route anomaly detection and risk scoring16- Historical route tracking and comparison17- Malicious IP detection against threat intelligence feeds1819## MCP Server Tools2021The Tracer MCP Server provides the following tools for LLM interaction:2223### Route Tracing Tools2425- `trace_target` - Trace a network target and return hop-by-hop results26 - Parameters: `target` (string), `use_cache` (bool, default: True), `protocol` ("icmp" or "tcp", default: "icmp"), `port` (int, optional, required for TCP)27 - Returns: Target, resolved IP, source (cache/live), hop list with geo/ASN info2829- `get_trace_detail` - Get detailed information about a specific hop30 - Parameters: `target` (string), `hop_index` (int, 0-based)31 - Returns: Detailed hop info including IP, latency, jitter, packet loss, location, ASN, ISP, geo coordinates3233- `compare_routes` - Compare current route against historical routes34 - Parameters: `target` (string)35 - Returns: New IPs, removed IPs, latency changes between current and historical path3637### Risk Analysis Tools3839- `analyze_target` - Run anomaly analysis and calculate risk score40 - Parameters: `target` (string), `cache` (bool, default: True)41 - Returns: Anomalies list, alerts list, riskScore (0-100), riskLevel (low/medium/high)4243### History Tools4445- `get_history` - Get traceroute history records46 - Parameters: `target` (string, optional), `limit` (int, default: 20)47 - Returns: Dictionary of history records keyed by target IP4849### Status Check Tools5051- `health_check` - Check server health and readiness52 - Parameters: None53 - Returns: Health status, readiness, timestamp5455- `server_capabilities` - Get server capabilities and tool usage examples56 - Parameters: None57 - Returns: Server capabilities, tool list, natural language examples5859## API Endpoints6061### Base URL6263```64http://localhost:800065```6667### Route Tracing6869#### Trace Target7071- **Endpoint**: `GET /api/trace`72- **Description**: Run a traceroute to the target73- **Query Parameters**:74 - `target`: IP address or domain (required)75 - `use_cache`: Use cached results if available (default: "true")76 - `protocol`: "icmp" or "tcp" (default: "icmp")77 - `port`: Port number, required when protocol=tcp (1-65535)7879**Response** (streaming NDJSON, one hop per line):8081```json82{"hop": 1, "ip": "192.168.1.1", "latency": 1.23, "jitter": 0.5, "packet_loss": "0.0%", "bandwidth_mbps": 47.17, "location": "Beijing, China", "asn": "4134", "isp": "China Telecom", "geo": {"lat": 39.9, "lon": 116.4, "radius_km": 50, "timezone": "Asia/Shanghai"}}83```8485### Risk Analysis8687#### Analyze Target8889- **Endpoint**: `GET /api/analyze`90- **Description**: Run anomaly analysis and risk scoring91- **Query Parameters**:92 - `target`: IP address or domain (required)93 - `cache`: Use cached trace results (default: "true")9495**Response**:9697```json98{99 "anomalies": [100 {"type": "PathDeviation", "detail": "跳点 5 出现新IP 10.0.0.1"},101 {"type": "HighLatency", "detail": "跳点 5 (10.0.0.1) 延迟过高 250ms"}102 ],103 "alerts": [104 "跳点 10.0.0.1 被列为恶意IP: Spamhaus DROP list"105 ],106 "riskScore": 50107}108```109110### History111112#### Get History113114- **Endpoint**: `GET /api/history`115- **Description**: Get traceroute history records116- **Query Parameters**:117 - `target`: IP or domain filter (optional)118119**Response**:120121```json122{123 "8.8.8.8": [124 {125 "timestamp": "20240101-120000",126 "protocol": "icmp",127 "result": [...]128 }129 ]130}131```132133### Status Check134135#### Readiness Check136137- **Endpoint**: `GET /api/ready`138- **Description**: Check if the Tracer service is ready139140**Response**:141142```json143{144 "ready": true,145 "timestamp": "2024-01-01T12:00:00.000000"146}147```148149## Usage Examples150151### Python Client Example152153```python154from tracer_client import TracerClient155156# Create client157client = TracerClient("http://localhost:8000")158159# ICMP trace160result = client.trace("8.8.8.8")161print(f"Hops: {len(result.hops)}, Source: {result.source}")162163# TCP trace164result = client.trace("1.1.1.1", protocol="tcp", port=443)165print(f"Hops: {len(result.hops)}")166167# Risk analysis168analysis = client.analyze("8.8.8.8")169print(f"Risk Score: {analysis.risk_score}, Anomalies: {len(analysis.anomalies)}")170171# History172history = client.get_history(target="8.8.8.8")173print(f"Records: {len(history.get('8.8.8.8', []))}")174```175176## Risk Score Levels177178| Score | Level | Description |179|-------|-------|-------------|180| 0-39 | low | Route appears normal, no significant threats |181| 40-69 | medium | Some anomalies detected, moderate risk |182| 70-100 | high | Significant threats or multiple anomalies |183184## Anomaly Types185186| Type | Description |187|------|-------------|188| `PathDeviation` | A hop IP not seen in historical traces |189| `HighLatency` | A hop with latency exceeding 200ms |190| `MaliciousIP` | A hop IP found in threat intelligence feeds |