Metadata-Version: 2.4
Name: netcfg-agent-mcp
Version: 0.4.0
Summary: Serveur MCP standalone pour netcfg-agent : expose inventaire Visio, preview, topologie, terminal SSH live en tools MCP consommables par Claude Desktop / Gemini CLI / Roo Code
Author: naarob
License: AGPL-3.0-or-later
Project-URL: Repository, https://github.com/naarob/netcfg-agent-mcp
Project-URL: Master, https://github.com/naarob/netcfg-agent
Project-URL: Roadmap, https://github.com/naarob/netcfg-agent/blob/main/docs/ROADMAP_MCP_FORK.md
Keywords: mcp,network,multi-vendor,visio,ssh,agent,netcfg
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: System Administrators
Classifier: Topic :: System :: Networking
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: mcp>=1.5.0
Requires-Dist: fastapi>=0.115.0
Requires-Dist: uvicorn>=0.29.0
Requires-Dist: pydantic>=2.10.0
Requires-Dist: netcfg-agent[terminal]>=0.2.0
Requires-Dist: aiohttp>=3.9.0
Requires-Dist: asyncssh>=2.14.0
Provides-Extra: dev
Requires-Dist: pytest>=8.0.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
Requires-Dist: ruff>=0.4.0; extra == "dev"
Requires-Dist: black>=24.0.0; extra == "dev"
Provides-Extra: build
Requires-Dist: pyinstaller>=6.0.0; extra == "build"
Dynamic: license-file

# netcfg-agent-mcp

Serveur MCP standalone pour [netcfg-agent](https://github.com/naarob/netcfg-agent).
Expose le code metier netcfg (inventaire Visio, preview deploy, topologie, terminal
SSH live multi-vendor) comme tools MCP consommables par n importe quel client
compatible (Claude Desktop, Gemini CLI 0.38+, Roo Code, Cline, Cursor, etc.).

## Positionnement

Ce repo est le **4eme** de la famille netcfg-agent :

- [naarob/netcfg-agent](https://github.com/naarob/netcfg-agent) : master, code metier complet (web + TUI + binaire PyInstaller)
- [naarob/netcfg-agent-web](https://github.com/naarob/netcfg-agent-web) : fork web-only
- [naarob/netcfg-agent-tui](https://github.com/naarob/netcfg-agent-tui) : fork TUI-only
- **naarob/netcfg-agent-mcp** (ce repo) : fork serveur MCP standalone

Il n est **pas** un sous-ensemble fonctionnel du master mais **une couche d
exposition protocolaire** par-dessus. Il depend du master pour le code metier.

## Architecture (Phase 1 - Scenario 2)

```
+----------------------+         +--------------------+
| MCP client           |         | LaForge hub        |
| (Claude/Gemini/Roo)  |         | 127.0.0.1:8766     |
+----------+-----------+         | (optionnel)        |
           |                     +----+---------------+
           | Streamable HTTP          | lib imports
           |                          |
           v                          v
+---------------------------------------------+
|   netcfg-agent-mcp                          |
|   127.0.0.1:8767                            |
|   - Tools metier : list_equipments,         |
|     get_dashboard, preview_deploy,          |
|     topology, audit, open_terminal,         |
|     verify_chain, vendors                   |
|   - Heritage optionnel : authority,         |
|     transport HTTP de LaForge si dispo      |
+----------+----------------------------------+
           | imports
           v
+--------------------------+
|   netcfg-agent (master)  |
|   Session, Visio parser, |
|   PTY SSH, WAL hash-chain|
+--------------------------+
```

Port 8767 par defaut pour cohabiter avec LaForge sur 8766.



## Installation via binaire (sans Python)

Les releases GitHub fournissent le binaire autonome `netcfg-agent-mcp.exe`
(Windows x64, ~130 MB) qui embarque :
- Python 3.12 runtime
- Le code netcfg-agent master (tous les tools metier)
- mcp SDK + FastAPI + uvicorn + asyncssh + pyte
- Les templates vendor et la demo `enterprise_network.vsdx`

Telechargez depuis les [releases](https://github.com/naarob/netcfg-agent-mcp/releases/latest)
et lancez directement :

```cmd
netcfg-agent-mcp.exe --version
netcfg-agent-mcp.exe serve --transport http
```

## Installation (Python)

```cmd
pip install netcfg-agent-mcp
REM tire netcfg-agent[terminal] (code metier + terminal PTY SSH)

netcfg-agent-mcp --version
netcfg-agent-mcp --help
```

Developpement : depuis un clone, `pip install -e ".[dev]"`.

Licence : AGPL-3.0-or-later (voir `LICENSE`).

## Usage

### Lancer le serveur

```cmd
REM Mode HTTP (port 8767)
netcfg-agent-mcp serve

REM Mode stdio (pour spawn par Claude Desktop)
netcfg-agent-mcp serve --transport stdio

REM Mode standalone (aucun hook LaForge)
netcfg-agent-mcp serve --standalone

REM Custom port
netcfg-agent-mcp serve --port 8777
```

### Configurer un client MCP

**Claude Desktop** (`claude_desktop_config.json`) :

```json
{
  "mcpServers": {
    "netcfg-agent-mcp": {
      "command": "netcfg-agent-mcp",
      "args": ["serve", "--transport", "stdio"]
    }
  }
}
```

**Gemini CLI** (`settings.json`) :

```json
{
  "mcpServers": {
    "netcfg-agent-mcp": {
      "httpUrl": "http://127.0.0.1:8767/mcp",
      "headers": {
        "Authorization": "Bearer <token-genere-au-premier-run>",
        "X-Agent-Name": "GEMINI"
      }
    }
  }
}
```

**Roo Code** (`.roo/mcp.json`) :

Copier `.roo/mcp.json.example` en `.roo/mcp.json` et remplacer le placeholder.

## Tools exposes (v0.1)

| Tool | Description |
|------|-------------|
| `netcfg_ping` | Health check (smoke test) |
| `netcfg_vendors` | Liste les vendors supportes (VRP, Comware, AOS-CX, ProCurve, Prosafe) |
| `netcfg_list_equipments` | Inventaire Visio |
| `netcfg_get_dashboard` | Severity counts + topology stats |
| `netcfg_preview_deploy` | Dry-run du plan de deploiement |
| `netcfg_topology` | Nodes + edges + SPOFs |
| `netcfg_audit` | Rapport drift multi-equipement |
| `netcfg_open_terminal` | Snapshot pyte d une session PTYSession |
| `netcfg_verify_chain` | Audit de la hash-chain WAL |

## Authentification

- **Bearer token local** genere au premier run, stocke dans
  `%USERPROFILE%\.netcfg-agent-mcp\token` (ACL user-only)
- Permissions heritees de LaForge si hub dispo (authority_status)
- Fallback : lock SQLite local hash-chainee (via db_waldb du master)

## Historique decisions

Voir [ROADMAP_MCP_FORK.md](https://github.com/naarob/netcfg-agent/blob/main/docs/ROADMAP_MCP_FORK.md)
dans le repo master pour l historique complet des decisions d architecture.

Points cles :
- Phase 1 (actuelle) : dep directe LaForge via pyproject (Scenario 2)
- Phase 2 (differee) : extraction `laforge-mcp-core` (Scenario 3)
- Budget binaire PyInstaller : < 180 MB
- Flag `--standalone` : desactive tous hooks LaForge
