Skip to main content
Glama
mohesham100

Nexlink Telecom MCP Server

by mohesham100

🌐 Nexlink Telecom NOC β€” Autonomous Agent Operations Platform

System Status Memory & RAG Planning Engine State Graphs Platform

A complete, enterprise-grade Network Operations Center (NOC) autonomous agent operations platform built for Nexlink Telecom. The platform integrates an MCP protocol server, long-term memory & hybrid RAG, task decomposition & multi-path planning algorithms, durable state graphs with persistent checkpointing, Human-in-the-Loop (HITL) approval gates, an unplanned failure ticket recovery system, and a full-stack web operations platform.


πŸ›οΈ Comprehensive System Architecture

flowchart TD
    subgraph UI ["πŸ–₯️ Platform Product Surface (Web Dashboard)"]
        UserChat["πŸ’¬ Multi-Agent Chat Console\n(Switch Agents & Stream Responses)"]
        AdminTools["πŸ› οΈ Agent & Tool Registry\n(Dynamic Runtime Toggles)"]
        AdminRAG["πŸ“š RAG Document Manager\n(Live Corpus Upload & Re-indexing)"]
        AdminHITL["🚦 HITL Approvals Queue\n(Policy Gates & State Resumption)"]
        AdminTickets["🎫 Failure Ticket Dashboard\n(Error Inspection & Checkpoint Recovery)"]
    end

    subgraph Agents ["πŸ€– Autonomous Agent Fleet"]
        SG_Agent["State Graph Agent\n(3 Stateful Workflows)"]
        MR_Agent["Memory & RAG Agent\n(STM, Semantic Store, Self-RAG)"]
        Plan_Agent["Decomposition & Planning Agent\n(TaskDAG, ToT, LATS, Self-Refine)"]
    end

    subgraph StateGraphEngine ["πŸ”„ State Graph & Checkpointing Engine (state_graph/)"]
        Checkpointer[("πŸ’Ύ SQLite Checkpointer\n(db/state_checkpoints.db)")]
        HITL_Node["⏸️ HITL Gate Node\n(Policy-driven Pause)"]
        Ticket_Handler["🚨 Unplanned Failure Boundary\n(Persisted Ticket Creation)"]
        WF1["Disaster Recovery & Traffic Migration\n(Task Decomp + LATS)"]
        WF2["Chronic Fiber Maintenance\n(RAG + Constrained ReAct)"]
        WF3["Enterprise SLA Dispute Settlement\n(Tree of Thoughts + ReAct)"]
    end

    subgraph MCP ["πŸ”Œ Model Context Protocol Server (mcp_server/)"]
        Tools["MCP Tools (11 Scoped Endpoints)"]
        Resources["MCP Resources (SLA Policy & Runbook)"]
        Prompts["MCP Parameterized Prompts"]
        Notifications["tools/list_changed Push"]
        Sampling["LLM Protocol Sampling"]
        Elicitation["ctx.elicit() Mid-Call Confirmation"]
    end

    subgraph DB ["πŸ—„οΈ Database & Storage Layer"]
        NexlinkDB[("db/nexlink.db\n(Customers, Nodes, Services, Logs)")]
        MemoryDB[("db/memory.db\n(Episodic & Semantic Stores)")]
        PlatformDB[("db/platform.db\n(HITL Tasks, Tickets, Tool Registry)")]
        VectorStore[("ChromaDB Vector Store\n(HNSW Dense Embeddings + BM25)")]
    end

    UI --> Agents
    SG_Agent --> StateGraphEngine
    StateGraphEngine --> Checkpointer
    StateGraphEngine --> HITL_Node
    StateGraphEngine --> Ticket_Handler
    HITL_Node --> AdminHITL
    Ticket_Handler --> AdminTickets
    AdminTools --> Tools
    AdminRAG --> VectorStore

    Agents --> MCP
    MCP --> NexlinkDB
    MR_Agent --> MemoryDB
    MR_Agent --> VectorStore

Related MCP server: agentic-ops-builder

πŸ“‘ Complete Table of Contents

  1. Lab 1: MCP Server Protocol & Database Layer

  2. Lab 2: Memory Subsystem & Grounded Knowledge (RAG)

  3. Lab 3: Decomposition & Planning Engine

  4. Lab 4 / Final Project: State Graphs, HITL, Ticket Recovery & Web Platform

  5. Cross-Lab Comparison & Benchmark Tables

  6. Quickstart & Verification Guide


πŸ”Œ Lab 1: MCP Server Protocol & Database Layer

Database Schema & ERD

The system operates over db/nexlink.db with strict foreign keys and WAL mode:

erDiagram
    users {
        int id PK
        string username UK
        string role "NOC_Admin | NOC_Engineer | Guest"
        string api_token UK
    }

    customers {
        int id PK
        string name
        string industry
        string sla_tier "VIP | Enterprise | Standard"
        string contact_email
    }

    network_nodes {
        int id PK
        string name
        string type "Fiber | 5G Core | Edge Router | Satellite"
        float max_capacity_gbps
        float current_load_gbps
        string status "Healthy | Congested | Down | Maintenance"
        string location
    }

    services {
        int id PK
        int customer_id FK
        int node_id FK
        float allocated_bandwidth_gbps
        string status "Active | Suspended | Pending"
    }

    audit_logs {
        int id PK
        datetime timestamp
        int user_id
        string action
        string details
    }

    customers ||--o{ services : "subscribes to"
    network_nodes ||--o{ services : "hosts"
    users ||--o{ audit_logs : "triggers"

8 MCP Protocol Concerns Implementation

Protocol Concern

Specification

Implementation in mcp_server/server.py

1. Capability Negotiation

Explicit client/server handshake

Declares elicitation and sampling capabilities during initialize.

2. Dynamic Notifications

Runtime tool set mutation

authenticate_user pushes tools/list_changed to unlock admin write tools.

3. Elicitation

Mid-call human confirmation

upgrade_bandwidth calls ctx.elicit() if bandwidth > 3.0 Gbps or VIP SLA.

4. Protocol Sampling

Model calling host LLM

analyze_incident_root_cause requests reasoning via ctx.session.create_message().

5. Resources & Prompts

Exposed static documents & templates

file://policies/sla_policy.txt, file://policies/network_runbook.txt, and parameterized incident templates.

6. Progress Tracking

Long-running task updates

run_network_diagnostic reports intermediate progress via ctx.report_progress().

7. Defensive Tool Design

Strict validation & role auth

JSON Schema bounds (ge=1, le=100), additionalProperties=False, and handler-level role enforcement.

8. Dual Transports

Local + Remote operation

Supports both local stdio (isolated CLI) and remote Streamable HTTP / SSE (--transport sse).


🧠 Lab 2: Memory Subsystem & Grounded Knowledge (RAG)

Architecture

  • Short-Term Memory & Scratchpad (memory/short_term.py): Rolling FIFO buffer preserving transient dialog distinct from the persistent working scratchpad.

  • Promote-or-Drop Router (memory/router.py): Filters aging messages on overflow using an importance threshold ($\ge 0.40$), logging reasoning to memory/routing_log.jsonl.

  • Semantic Memory Consolidation (memory/consolidation.py): Periodic offline pass over episodic memory that resolves contradictions, handles versioning (version = old + 1), and flags stale facts.

  • Hybrid Vector + Keyword RAG (rag/hybrid_rag.py): Dense vector search via ChromaDB (HNSW index) + BM25 keyword matching fused via Reciprocal Rank Fusion (RRF): [ \text{RRF_Score}(d) = \sum_{m \in {\text{vector}, \text{bm25}}} \frac{1}{60 + \text{rank}_m(d)} ]

  • Self-RAG Verification (rag/self_rag.py): Reflection checks verifying retrieved chunk relevance and answer grounding before dispatch.


πŸ“ Lab 3: Decomposition & Planning Engine

TaskDAG & Algorithms (planning/)

  • TaskDAG (planning/dag.py): Strict acyclicity enforcement during construction via DFS back-edge detection and topological scheduling via Kahn's algorithm.

  • Decomposition-First vs. Dynamic Decomposition:

    • Decompose-First (planning/decompose_first.py): Upfront full DAG generation in one shot.

    • Dynamic Interleaved (planning/decompose_dynamic.py): Step-by-step re-planning after observing live execution results.

  • Three Planning Algorithms:

    • Plan-and-Solve (planning/plan_and_solve.py): Single-pass sequential plan generation and execution.

    • Tree of Thoughts (planning/tree_of_thoughts.py): BFS lookahead search ($b=3, d=2$) with scoring and branch pruning ($\ge 6/10$).

    • Language Agent Tree Search - LATS (planning/lats.py): MCTS search guided by real database tool feedback with verbal failure reflection accumulation.

  • Self-Correction & Grounded Critique (planning/critique.py): Grounded critique querying real database status (catches maintenance nodes and SLA limits that ungrounded LLM self-evaluation misses).


πŸš€ Lab 4 / Final Project: State Graphs, HITL, Ticket Recovery & Web Platform

Three Genuinely Stateful Telecom Problems

stateDiagram-v2
    direction LR

    subgraph Problem 1: Disaster Recovery & Traffic Migration
        [*] --> Triage
        Triage --> LATS_Selection : Node Outage
        LATS_Selection --> Failover_Plan : Task Decomp
        Failover_Plan --> Awaiting_Clearance : Wait Field Crew
        Awaiting_Clearance --> HITL_Reroute_Gate : Bandwidth > 3Gbps / VIP
        HITL_Reroute_Gate --> Execute_Migration : Admin Approved
        Execute_Migration --> Verify_Health
        Verify_Health --> [*] : Healthy
    end

1. Disaster Recovery & VIP Traffic Failover (state_graph/disaster_recovery_graph.py)

  • Real World Stakes: Core fiber break (e.g. Cairo Metro Line 3 sever) requires rerouting multi-Gbps live enterprise traffic. Rerouting blindly without human oversight risks violating banking/hospital SLAs or overloading adjacent nodes.

  • Why it's a State Graph: Spans multiple stages, includes an external wait for field crew clearance, requires policy-gated human sign-off, and must recover cleanly from mid-migration failures.

  • Two LLM Additions: Task Decomposition (cutover sequence planning) + LATS (MCTS target node search with live DB capacity validation).

2. Chronic Fiber Degradation & Maintenance Scheduling (state_graph/fiber_maintenance_graph.py)

  • Real World Stakes: Intermittent optical attenuation and packet loss on high-load nodes require scheduling physical maintenance windows without disrupting peak enterprise operations.

  • Why it's a State Graph: Involves external parts availability checks, maintenance window drafting, and mandatory admin approval for core backbone nodes.

  • Two LLM Additions: RAG (queries historical splicing notes & vendor bulletins) + Constrained ReAct (safe execution of maintenance dispatch tools).

3. Enterprise SLA Breach Dispute & Financial Credit Settlement (state_graph/sla_dispute_graph.py)

  • Real World Stakes: VIP customers claim SLA financial penalties following downtime. Negotiating compensation balances financial liability against customer churn.

  • Why it's a State Graph: Reconciles telemetry across database records, explores settlement packages, waits for finance ledger sync, and requires Finance Director authorization for credits > $5,000.

  • Two LLM Additions: Tree of Thoughts (explores multi-branch goodwill vs. cash credit packages) + Constrained ReAct (applies authorized credit notes and service adjustments).


Human-in-the-Loop (HITL) Policy Rules

Policy Trigger

Condition Bar

Graph Behavior

Platform Admin Action

VIP Traffic Migration

Reroute $> 3.0\text{ Gbps}$ or VIP customer impact

Pauses at hitl_traffic_reroute, saves SQLite checkpoint

Operations Director reviews target node, approves/rejects/modifies in UI

Backbone Maintenance

Maintenance on Node 10/11 or peak hours

Pauses at hitl_maintenance_approval, saves SQLite checkpoint

Operations Lead reviews safety protocols and signs off

Financial SLA Credit

Claim $> $5,000\text{ USD}$ or VIP SLA tier

Pauses at hitl_credit_authorization, saves SQLite checkpoint

Finance Director authorizes credit note disbursement


Unplanned Failure Ticket Recovery System

When an unexpected exception occurs mid-node (database lock, tool network timeout, schema validation error):

  1. Error Boundary: Caught immediately by StateGraph exception handler.

  2. Durable Snapshot: State snapshot and error traceback are saved to db/state_checkpoints.db.

  3. Failure Ticket: Persisted in db/platform.db with status open, inspectable on the web platform.

  4. Resumption from Checkpoint: Admin inspects error, edits state variables if necessary, and clicks "Resume from Checkpoint" to continue execution without restarting from scratch.


Crash-and-Resume Proof (Surviving Process Death)

The system utilizes SQLiteCheckpointer (db/state_checkpoints.db) to record every node transition. If the backend process is killed mid-run (kill -9 / power failure):

  1. The thread state remains fully intact in SQLite.

  2. Upon restart, calling resume_hitl(thread_id, ...) or resume_ticket(thread_id, ...) reloads the exact node checkpoint.

  3. Execution resumes with 0 duplicate steps and 0 lost state.


The Platform Web UI (web_platform/ & platform/)

Run the full-stack web platform with:

python platform/run_platform.py

Open http://localhost:8000 in your browser to access:

  • πŸ’¬ Multi-Agent Chat Console: Switch seamlessly between State Graph Agent, Memory & RAG Agent, and Planning Agent with real-time response rendering and execution telemetry.

  • πŸ› οΈ Agent & Tool Registry (Admin): Dynamically enable or disable MCP tools per agent in real time with immediate server-side enforcement.

  • πŸ“š RAG Knowledge Base (Admin): Upload new .txt domain documents, delete documents, and trigger live ChromaDB vector re-indexing.

  • 🚦 HITL Approvals Queue (Admin): Live task queue with parameter inspector, Approve / Reject / Modify controls, and instant graph resumption.

  • 🎫 Failure Tickets & Recovery (Admin): Inspect open failure tickets, view error tracebacks, edit state snapshots, and resume execution.

  • πŸ“ˆ Checkpoint Timeline: Visual timeline of all execution threads and durable state snapshots.


πŸ“Š Cross-Lab Comparison & Benchmark Tables

1. Planning Subsystem Benchmark (12 Real-World Scenarios)

Method

Task Success

Avg. LLM Calls

Avg. Tokens

Avg. Latency

Est. Cost / Run

Plan-and-Solve

83.3% (10/12)

1.0

1,420

0.9s

$0.01

Tree of Thoughts (BFS b=3, d=2)

91.7% (11/12)

7.2

4,850

3.4s

$0.04

LATS (Ungrounded Self-Eval)

66.7% (8/12)

9.5

6,900

5.8s

$0.05

LATS (Grounded with Live MCP DB)

100.0% (12/12)

11.4

7,650

6.2s

$0.06

Decomposition-First (Upfront DAG)

75.0% (9/12)

2.0

3,100

2.1s

$0.02

Dynamic / Interleaved Decomposition

91.7% (11/12)

5.8

6,400

4.6s

$0.05

Key Takeaway: Grounded LATS achieves 100% accuracy by validating candidate migrations against real database capacity, completely eliminating false positives from ungrounded self-evaluation.

2. Context Window Management Benchmark (40-Turn Diagnostic Transcript)

Strategy

Critical Detail Recalled

Avg. Input Tokens

Avg. Output Tokens

Avg. Latency

Sliding Window (Last 10 Turns)

10.0% (1/10)

4,200

180

0.6s

Observation Masking (Keep Last 3 Outputs)

90.0% (9/10)

6,800

210

0.9s

Recursive Summarization (Compact Every 15)

80.0% (8/10)

5,100

640

2.4s

Zone-Based Pruning (4 Zones)

90.0% (9/10)

7,400

260

1.3s

Selected Strategy: Observation Masking ships as default for highest recall (90%) and lowest overhead (0.9s latency).

3. Retrieval Architecture Benchmark (12 Domain Questions)

Architecture

Accuracy (12 Questions)

Avg. Tokens / Query

Avg. Latency / Query

Naive RAG (Dense Vector Only)

58.3% (7/12)

1,900

1.1s

Hybrid Search (ChromaDB + BM25 RRF)

83.3% (10/12)

2,100

1.3s

Agentic RAG (Multi-Hop Retrieval)

91.7% (11/12)

5,600

4.8s


πŸ› οΈ Quickstart & Verification Guide

1. Environment Setup

# Clone and enter directory
cd Nexlink-Telecom-B-

# Activate virtual environment
.venv\Scripts\activate

# Install all dependencies
pip install -r requirements.txt

2. Run the Full 4-Lab Audit Suite

python run_all_tests.py

Executes all 4 audit stages covering Database, Memory & RAG, Planning DAG, and State Graphs + Web Platform APIs.

3. Run Automated State Graph Demonstrations

python demo_state_graphs.py

Verifies HITL pause/resumption, failure ticket recovery, and crash-and-resume.

4. Launch Interactive CLI Clients

# State Graph Agent CLI
python agent/state_graph_client.py

# Decomposition & Planning Agent CLI
python agent/planning_client.py

# Memory & RAG Agent CLI
python agent/memory_rag_client.py

5. Launch the Web Platform

python platform/run_platform.py

Navigate to http://localhost:8000 in your browser.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables natural language interaction with VMware SDDC Manager and vCenter APIs through MCP tools, allowing users to query workload domains, VMs, clusters, and more.
    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
  • A
    license
    Not graded
    quality
    A
    maintenance
    Enables natural language querying of SQL databases and REST APIs through the MCP protocol, grounded in a semantic layer.
    1,395 npm
    1
    AGPL 3.0