Skip to main content
Glama

Network Incident MCP Demo

LLM 에이전트(Google Gemini)가 **Model Context Protocol (MCP)**를 사용하여 시뮬레이션된 네트워크 인시던트를 트라이지하는 방법을 보여주는 작은 데모/프로토타입입니다: 장치 텔레메트리를 가져오고, syslog를 검사하고, 조치가 필요한지 판단하고, 수정 단계를 실행합니다 — 모두 로컬 MCP 서버가 노출하는 도구를 통해 이루어집니다.

이것은 학습/데모 목적의 프로토타입입니다. 모든 네트워크 데이터는 가짜이며 mcp_server/mock_network_db.py에 하드코딩되어 있습니다. 실제 네트워크 백엔드는 없습니다.

작동 방식

  • mcp_server/ — 다음을 노출하는 MCP 서버:

    • get_device_telemetry(device_id) — 장치 상태, 광 파워, BGP 플랩

    • get_latest_syslog() — 최근 syslog 라인

    • apply_traffic_reroute(source_pop, target_pop, circuit_id) — 목업 수정 조치 (알려진 정상 PoP가 아닌 대상은 모두 거부)

    • incident_triage_prompt(device_id) — 트라이지 단계와 -20.0 dBm 리라우트 임계값을 설명하는 프롬프트 템플릿

  • agent/gemini_mcp_client.py — MCP 서버를 생성하고, 그 도구를 함수 호출(function-calling) 도구로 Gemini에 전달한 뒤 루프를 실행하는 클라이언트입니다. Gemini가 다음에 호출할 도구를 결정하면 클라이언트가 MCP를 통해 이를 실행하고 결과를 다시 전달합니다. 이 과정은 Gemini가 최종 답변을 제시할 때까지 반복됩니다.

Related MCP server: Pulse

설정

git clone <your-repo-url>
cd network-incident-mcp
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

테스트 실행

python3 -m pytest tests/

MCP 서버 단독 실행

python3 mcp_server/server.py

라이브 에이전트 실행

Google AI Studio에서 Gemini API 키가 필요합니다:

export GEMINI_API_KEY=your-key-here
python3 agent/gemini_mcp_client.py

예제 출력

에이전트는 목업 장치 router-van-01을 대상으로 하며, 이 장치는 광 파워 -28.5 dBm의 DEGRADED 상태로 시뮬레이션됩니다 — -20.0 dBm 리라우트 임계값보다 낮은 상태입니다. 실제 실행 결과는 다음과 같습니다:

(venv) ac@ubuntuserver2026:~/network-incident-mcp$ python3 agent/gemini_mcp_client.py
Processing request of type ListToolsRequest
[+] Connected to MCP. Registered 3 tools with Gemini 3.6 Flash.
Processing request of type GetPromptRequest
[--> Model Tool Call Request]: get_device_telemetry({'device_id': 'router-van-01'})
Processing request of type CallToolRequest
[<-- MCP Execution Output]: {
  "device_id": "router-van-01",
  "data": {
    "status": "DEGRADED",
    "location": "Vancouver PoP",
    "bgp_flaps": 14,
    "optical_power_dbm": -28.5,
    "circuits": [
      "fiber-van-richmond-10G"
    ]
  }
}
[--> Model Tool Call Request]: get_latest_syslog({})
Processing request of type CallToolRequest
[<-- MCP Execution Output]:
[2026-08-24T10:12:01Z] WARN router-van-01 BGP neighbor 192.168.10.1 DOWN (Retries: 3)
[2026-08-24T10:12:15Z] CRIT router-van-01 Optical signal loss detected on fiber-van-richmond-10G (-28.5 dBm)
[2026-08-24T10:14:02Z] WARN router-van-01 Packet loss spike: 18.4% on interface ge-0/0/1

[--> Model Tool Call Request]: apply_traffic_reroute({'target_pop': 'Richmond PoP', 'circuit_id': 'fiber-van-richmond-10G', 'source_pop': 'Vancouver PoP'})
Processing request of type CallToolRequest
[<-- MCP Execution Output]: {
  "status": "ERROR",
  "error": "Target PoP 'Richmond PoP' is not a known healthy PoP. Healthy PoPs: ['Toronto PoP']"
}
[--> Model Tool Call Request]: apply_traffic_reroute({'circuit_id': 'fiber-van-richmond-10G', 'target_pop': 'Toronto PoP', 'source_pop': 'Vancouver PoP'})
Processing request of type CallToolRequest
[<-- MCP Execution Output]: {
  "status": "SUCCESS",
  "action": "Traffic shifted from Vancouver PoP to Toronto PoP",
  "isolated_circuit": "fiber-van-richmond-10G",
  "new_route_metric": 10
}
[Model Final Response]: ### Incident Analysis Summary for `router-van-01`

1. **Device Telemetry Analysis**
   - **Device ID:** `router-van-01`
   - **Location:** Vancouver PoP
   - **Device Status:** DEGRADED
   - **Optical Power Level:** **-28.5 dBm**
   - **BGP Flaps:** 14
   - **Active Circuit:** `fiber-van-richmond-10G`

2. **Syslog Inspection**
   - Critical optical signal loss log detected:
     `[2026-08-24T10:12:15Z] CRIT router-van-01 Optical signal loss detected on fiber-van-richmond-10G (-28.5 dBm)`
   - Additional warnings observed regarding BGP neighbor timeouts and interface packet loss spikes (`ge-0/0/1`).

3. **Remediation Action**
   - **Condition Met:** Optical power level (-28.5 dBm) is below the threshold of -20.0 dBm.
   - **Action Taken:** Executed `apply_traffic_reroute`.
     - **Circuit:** `fiber-van-richmond-10G`
     - **Source PoP:** Vancouver PoP
     - **Target PoP:** Toronto PoP
   - **Status:** **SUCCESS** — Traffic successfully rerouted from Vancouver PoP to Toronto PoP, isolating circuit `fiber-van-richmond-10G`.

모델의 첫 번째 리라우트 시도는 Richmond PoP를 대상으로 하는데, 이는 목업 데이터에서 실제로 존재하는 정상 위치가 아닙니다. 서버는 조용히 성공하는 대신 ERROR로 이를 거부하며, 모델은 올바른 정상 대상(Toronto PoP)으로 재시도한 후에야 성공합니다.

공개 HTTP 데모 (API 키 불필요)

web/app.py는 동일한 목업 텔레메트리/리라우트 로직을 감싸는 작은 FastAPI 래퍼로, 일반 REST 엔드포인트로 노출됩니다 — MCP 클라이언트도 Gemini API 키도 필요하지 않습니다. /triage/{device_id}는 fetch → check → reroute 흐름을 Python에서 결정론적으로(LLM을 통하지 않고) 재구현하므로, 공개적으로 노출해도 무료이고 안전합니다.

로컬에서 실행합니다:

uvicorn web.app:app --host 127.0.0.1 --port 8001

그런 다음 다른 터미널에서:

curl http://127.0.0.1:8001/devices
curl http://127.0.0.1:8001/telemetry/router-van-01
curl http://127.0.0.1:8001/syslog
curl http://127.0.0.1:8001/triage/router-van-01   # degraded device -> auto-reroutes
curl http://127.0.0.1:8001/triage/router-yyz-02   # healthy device -> no reroute

참고 사항

  • mcp<2가 필요합니다 (requirements.txt에 이미 고정되어 있음) — 서버는 v1 FastMCP API를 사용합니다.

  • Gemini 모델 가용성은 시간이 지남에 따라 변경됩니다. 404 모델을 찾을 수 없음 오류가 발생하면 API 키에서 사용 가능한 모델을 나열하고 agent/gemini_mcp_client.py의 모델 이름을 업데이트하세요.

  • 도구 호출 라운드는 API 사용량 폭주를 방지하기 위해 실행당 상한이 있습니다 (GeminiMCPOrchestrator.MAX_TURNS, 기본값 5).

A
license - permissive license
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

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

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides AI assistants with direct access to multi-vendor network devices for tasks like configuration management, health checks, and topology discovery through 35 specialized tools. It enables natural language control over platforms including Cisco, Juniper, and Nokia using SSH, NETCONF, and SNMP protocols.
    11
    MIT
  • A
    license
    A
    quality
    D
    maintenance
    An MCP server that exposes live network monitoring data as Resources and diagnostic capabilities as Tools, letting AI assistants query network health conversationally.
    6
    MIT

View all related MCP servers

Related MCP Connectors

  • MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.

  • Phone, SMS & email for AI agents — one remote MCP endpoint, OAuth login, zero install.

  • OCR, transcription, file extraction, and image generation for AI agents via MCP.

View all MCP Connectors

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/asif-c/network-incident-mcp'

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