4 Commits

Author SHA1 Message Date
Nicolas Hennion
137dc03a11 Lint the code 2026-03-24 08:18:04 +00:00
Steve Kowalik
5badf71000 Use sys.executable in the testsuite
Rather than looking for a venv python executable, use the existing
sys.executable property to execute the modules required.
2026-03-24 11:19:11 +11:00
nicolargo
dedc28cae6 Lint code 2026-02-21 21:27:39 +01:00
nicolargo
7b200f00fc Add MCP (Model Context Protocol) server support to the web server
Expose Glances system monitoring data to AI assistants via the Model
Context Protocol, mounted alongside the existing REST API.

New features:
- GlancesMcpServer (glances/outputs/glances_mcp.py): FastMCP-based server
  exposing 6 resources (glances://plugins, glances://stats,
  glances://stats/{plugin}, glances://stats/{plugin}/history,
  glances://limits, glances://limits/{plugin}) and 4 prompt templates
  (system_health_summary, alert_analysis, top_processes_report,
  storage_health).
- GlancesMcpAuthMiddleware: pure-ASGI middleware (SSE-safe, no body
  buffering) reusing the existing Basic Auth / JWT Bearer credentials.
- CLI flags --enable-mcp and --mcp-path; config-file keys enable_mcp
  and mcp_path under [outputs].
- 25 tests in tests/test_mcp.py covering SSE connectivity, all resources
  and prompts via the MCP client SDK, and the auth middleware unit tests.

The mcp package (>=1.0.0) is added as the new optional dependency group
[mcp] and included in [all].

Activation: glances -w --enable-mcp
             or [outputs] enable_mcp = true in glances.conf

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-21 20:20:34 +01:00