Commit Graph
8152 Commits
Author SHA1 Message Date
YueGuobin 78199d14a4 fix(mcp): collect the console stream in websocat binary mode (-b)
websocat's text mode (-t, and also the default) appends a newline after
every received WebSocket message and turns CR/LF inside a message into
spaces. The compute ships console output as one BINARY frame per
arbitrary read(1024) burst, so text mode diced the stream at every frame
boundary — prompts split into pieces, short "narrow-column" lines, lost
carriage-return redraws (field report: Password: broken in three).

Measured against a local WS server sending known frames:
  -t:  A\nB\nC\na b\na  b\n  ("a\rb" -> "a b")
  -b:  ABCa\rba\r\nb        (byte-exact, both directions)

Binary command frames stay console data on the compute side (only a line
that is itself a JSON {cols,rows} object would be taken as a resize
frame). The regression test fails on -t and passes on -b.
2026-11-03 00:02:58 +08:00
YueGuobin 7bf18ac2e8 feat(mcp): node_console_exec — one-shot console session via the host's websocat
Replaces node_console (which handed a URL + ticket to the client for a
bash websocat chain) with a tool that runs the whole session server-side:
spawn `timeout N websocat -t --no-close <console-ws-url>`, feed the
command lines through stdin (paced, CRLF), read stdout until the timeout
kills websocat, return the collected output as plain text.

- plain text replies: "output: ..." or bare error text — no JSON
  envelope, no status field (the server cannot judge command success)
- raw output: UTF-8 decode with replacement only, no telnet/ANSI
  stripping; control keys are real characters (description teaches
  \u0003, no \x03 translation)
- output funnel: grep=<python regex> filter; <=50 lines return as-is;
  beyond that a 10-line sample plus hints — regrep=true re-filters the
  node's cached capture (no re-run), full=true returns the last 400
  lines / 64 KiB, and the full capture is written to the node's files
  (console-capture.txt) with a ticketed curl download URL
- get_node_console_info_handler removed with its hashlib/TTL imports;
  the node-bound console ticket redemption path stays (comment updated,
  no current producer)
2026-11-02 22:52:46 +08:00
Jeremy Grossmann 0afd646856 Merge pull request #3039 from yueguobin/mcp-console-exec
MCP: Streamable HTTP transport (SDK 2.3) + skills knowledge tools + VPCS/auth fixes
2026-11-02 03:55:27 +01:00
yueguobin 92feea2a51 test(vpcs): assert the pcname-derived prompt pattern
The window-size tests still asserted the old hardcoded PC\d+> default;
the driver now derives the prompt from the node name.
2026-11-01 23:09:38 +08:00
yueguobin efc097f0ad feat(mcp): injection_skill_get — expose fault-injection skills to MCP
The skills repository carries per-protocol fault-injection knowledge
(symptoms, injection commands, verification steps) that only the
copilot could read through InjectionSkillsTool. Add the MCP counterpart
with the same multi-call protocol:

  list (context REQUIRED) -> category index -> single fault

The list step is topology-filtered: context matches a skill's category,
key and declared protocols (case-insensitive), so aliases such as ebgp,
ospfv3 and stp select the right category instead of relying only on key
substrings. Fault bodies stay gated behind detail/issue requests.

Fault category keys are derived from repository filenames
(injection_<file>_issues). Correct the stale injection_ospf examples in
the registry docstrings, the loader comment and the copilot docs, which
pointed at keys that never existed.

Docs: 84 tools; new Fault Injection Skills section.
2026-11-01 23:09:38 +08:00
yueguobin 21fb84e91c fix(skills): load categories independently and support non-git checkouts
SkillsManager refused to start when the local skills directory was not a
git repository (cloning into a non-empty path fails), and reload_skills()
returned early when injection/ was missing, so device and feature skills
never loaded. reload_packet_analysis_protocols() had the opposite bug:
an empty result wiped the registry while still reporting success.

- initialize(): accept a non-empty directory without .git as a local-only
  source (skip automatic updates, keep loading files); degrade to local
  files when GitPython is unavailable.
- _update_if_needed(): re-create/clone when the local directory vanished
  or moved, instead of reusing a stale handle forever.
- reload_skills(): injection, device and feature load independently; a
  missing category keeps its previously loaded entries.
- reload_packet_analysis_protocols(): an empty/missing directory keeps
  the existing registry and reports failure.
- reload_skills_repository(): drop the console guard cache so
  config/console_guard.txt applies on reload.

MCP device_skill_get now exposes the category filter, documents the
single-file (topic-less) layout, and returns a sections list for
index/summary of skills that have no topics/issues. An uninitialized
skills repository fails with a clear error instead of an empty list.
2026-11-01 23:09:38 +08:00
yueguobin 5ed252455d feat(mcp): device_skill_get — expose the GNS3-Skills repository to MCP clients
The skills repository carries per-device operational knowledge the
generic tools cannot know (FRR's console lands in vtysh, its ping has
no -c, scripted config needs 'do' prefixes; VPCS syntax; IOS paging
pitfalls), but only the embedded copilot could read it — MCP's sole
consumer was console_guard.txt.

device_skill_get reuses the copilot's framework-free core
(get_skill/list_available_skills) rather than the LangChain tool shell,
so both surfaces share the same access protocol by construction:
list -> device topic index -> one targeted topic body, bodies only on
an explicit topic request. The caller passes the skill key exactly as
the list returned it; there is no name mapping or node-based resolution
in this layer.

The tool description also tells clients that support subagents to
delegate the discovery steps on long tasks, keeping the full skill
bodies out of the main conversation's context.
2026-11-01 23:09:38 +08:00
yueguobin abb59b3d06 test(vpcs): mock read_channel in the strip-ansi test
The send_command read loop polls read_channel (netmiko decorates it
with a session-lock wrapper that only __init__ can satisfy), so the
old read_until_pattern mock died with AttributeError on instances
built via __new__.
2026-11-01 23:09:38 +08:00
yueguobin b184ea4c70 fix(mcp): renew an API-key session's JWT when it ages out
Tool handlers run in the session task created at initialize and inherit
its context; contextvars set by later requests never reach them. In a
long-lived API-key session (the documented setup — keys never expire)
the minted 24h JWT eventually expired while the transport kept
authenticating, so every tool call failed with 401.

Remember the raw API key at initialize; when the session's JWT has aged
out, take the current one from the per-request API-key cache (every
tools/call POST refreshes it) or re-mint synchronously. JWT logins are
unchanged: the client's own credential expiring is the client's
business.
2026-11-01 23:09:38 +08:00
yueguobin 68c8c0f1a0 fix(vpcs): wire pcname into the nornir inventory; keep partial output on read timeout
The pcname kwarg was added to VPCSTelnet but never passed by the only
production instantiation path, so a node renamed away from PC<n> never
matched the prompt pattern and every command stalled the full read
timeout. Pass pcname via the netmiko connection extras (the host key is
the node name).

send_command now owns its read loop instead of delegating to netmiko's
read_until_pattern: that helper raises ReadTimeout discarding accumulated
output, so a command slower than the timeout returned an empty string
that looked like success. The partial output is returned instead.
2026-11-01 23:09:38 +08:00
yueguobin eea1b807d1 docs(mcp): add Claude Code verification and scope examples 2026-11-01 23:09:38 +08:00
yueguobin 571646c296 docs: record the SIGHUP session-disconnect mass-node-death known issue
SSH disconnect SIGHUPs the session; the server absorbs it (reload) while
every emulator child default-terminates without cleanup, leaving stale
anchor TAPs that 409 the first start afterwards. Root-caused with a
second-level journalctl/gns3.log correlation; addressed by deployment
guidance (systemd / setsid nohup / tmux), product-side hardening noted
as deferred. Indexed under Known Issues.
2026-11-01 23:09:38 +08:00
yueguobin fe1b2a5cb0 Upgrade MCP SDK to 2.3 and switch transport from SSE to Streamable HTTP
- Drop the unused fastmcp wrapper pin (mcp-requirements.txt) and depend on
  the official SDK directly: mcp>=2.3,<3. The code only ever imported
  mcp.server.* modules; fastmcp was pulled in solely as a dependency
  vehicle and its <4 pin kept mcp locked at 1.x.
- Migrate to the SDK 2.x API: FastMCP -> MCPServer
  (mcp.server.mcpserver); transport_security moves from the constructor
  into streamable_http_app().
- Replace the deprecated SSE transport (spec-deprecated 2025-06-18) with
  Streamable HTTP at POST/GET/DELETE /v3/mcp/transport, mounted at /v3/mcp.
- Run the StreamableHTTP session manager in the FastAPI lifespan
  (Starlette does not execute mounted sub-app lifespans), entered before
  startup finishes so no request passes the MCP ready gate first.
- Authenticate every request (the SSE wrapper only checked the opening
  GET and trusted POSTs by session). Add a 5-minute TTL cache for API-key
  resolutions so the stricter per-request check does not cost a bcrypt
  round on every call.
- Update docs to the new endpoint, auth flow, and client configuration.

Wire-format verified unchanged against SDK 1.30 (structured output
auto-detection and content conversion are byte-identical for the
list[dict] returns used by all tool handlers).
2026-11-01 23:09:38 +08:00
Jeremy Grossmann a5e98e2109 Merge pull request #3046 from GNS3/feat/aarch64-qemu-vms
Add support for running aarch64 Qemu VMs
2026-11-01 12:55:51 +01:00
grossmj 5af41c7e8d Sync appliances 2026-11-01 18:50:55 +07:00
grossmj 524fff814b feat: add support for running aarch64 Qemu VMs 2026-11-01 18:48:41 +07:00
grossmj 47944067f7 fix: suppress deprecation warnings in pyproject.toml 2026-11-01 16:11:22 +07:00
Jeremy Grossmann 09ad329db3 Merge pull request #3045 from GNS3/update-dependencies
Update dependencies
2026-11-01 07:04:47 +01:00
grossmj 5afd9bf384 chore(deps): update dependencies 2026-11-01 12:46:50 +07:00
Jeremy Grossmann 368d1af3d5 Merge pull request #3043 from GNS3/bugfix/3019
Hardware acceleration support for ARM architectures in QEMU
2026-10-31 17:45:44 +01:00
grossmj af7b70001a fix: hardware acceleration support for ARM architectures in QEMU 2026-10-31 23:38:29 +07:00
Jeremy Grossmann f06166da71 Merge pull request #3042 from GNS3/fix-pytest-warnings
Fix pytest warnings
2026-10-31 16:07:44 +01:00
grossmj ac65698eea refactor: update authentication handling to use aiohttp.encode_basic_auth and adjust request options + fix other pytest warnings 2026-10-31 22:00:21 +07:00
Jeremy Grossmann 1608a65a01 Merge pull request #3041 from GNS3/update-dependencies
Update dependencies
2026-10-31 13:52:58 +01:00
grossmj 110638d81a refactor: replace os.path.commonprefix with os.path.commonpath for path comparisons 2026-10-31 19:43:52 +07:00
grossmj be368dd222 chore: update dependencies to latest versions in dev-requirements.txt 2026-10-31 19:38:58 +07:00
grossmj bef6e9d019 chore: update dependencies to latest versions in requirements.txt 2026-10-31 19:29:18 +07:00
Jeremy Grossmann 2821cbdf80 Merge pull request #3040 from GNS3/cleanup-windows-darwin-code
Remove platform-specific code for Darwin and Windows
2026-10-31 13:23:42 +01:00
grossmj 1f2b79cff2 refactor: remove macOS and Windows crash report info 2026-10-31 19:14:43 +07:00
grossmj c7e085e23c refactor: remove local gns3vm support and remove more platform-specific code 2026-10-31 17:51:37 +07:00
grossmj bad48286a5 refactor: remove platform-specific code for Darwin and Windows. Clean up Qemu options handling 2026-10-31 16:49:23 +07:00
grossmj 4d1b9e4700 fix: update web-ui bundling commit message to include release link 2026-10-31 12:20:42 +07:00
Jeremy Grossmann 4cbc339ab1 Merge pull request #3038 from GNS3/dependabot/pip/3.1/langchain-deepseek-gte-1.1.1
Update langchain-deepseek requirement from >=1.0.1 to >=1.1.1
2026-10-29 13:44:13 +01:00
Jeremy Grossmann 6b5863a5df Merge pull request #3037 from GNS3/dependabot/pip/3.1/langchain-openai-gte-1.7.2
Update langchain-openai requirement from >=1.1.10 to >=1.7.2
2026-10-29 13:43:53 +01:00
Jeremy Grossmann 331531de1b Merge pull request #3036 from GNS3/dependabot/pip/3.1/langgraph-checkpoint-sqlite-gte-3.1.2
Update langgraph-checkpoint-sqlite requirement from >=3.0.3 to >=3.1.2
2026-10-29 13:35:03 +01:00
dependabot[bot] 1d30cb49e9 Update langchain-deepseek requirement from >=1.0.1 to >=1.1.1
Updates the requirements on [langchain-deepseek](https://github.com/langchain-ai/langchain) to permit the latest version.
- [Release notes](https://github.com/langchain-ai/langchain/releases)
- [Commits](https://github.com/langchain-ai/langchain/compare/langchain-deepseek==1.0.1...langchain-deepseek==1.1.1)

---
updated-dependencies:
- dependency-name: langchain-deepseek
  dependency-version: 1.1.1
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-10-29 12:32:18 +00:00
dependabot[bot] d7d5231853 Update langchain-openai requirement from >=1.1.10 to >=1.7.2
Updates the requirements on [langchain-openai](https://github.com/langchain-ai/langchain) to permit the latest version.
- [Release notes](https://github.com/langchain-ai/langchain/releases)
- [Commits](https://github.com/langchain-ai/langchain/compare/langchain-openai==1.1.10...langchain-openai==1.7.2)

---
updated-dependencies:
- dependency-name: langchain-openai
  dependency-version: 1.7.2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-10-29 12:32:18 +00:00
Jeremy Grossmann e9b9bea1df Merge pull request #3034 from GNS3/dependabot/pip/3.1/langchain-google-genai-gte-4.4.2
Update langchain-google-genai requirement from >=4.2.1 to >=4.4.2
2026-10-29 13:29:48 +01:00
dependabot[bot] 62cb8af70b Update langgraph-checkpoint-sqlite requirement from >=3.0.3 to >=3.1.2
Updates the requirements on [langgraph-checkpoint-sqlite](https://github.com/langchain-ai/langgraph) to permit the latest version.
- [Release notes](https://github.com/langchain-ai/langgraph/releases)
- [Commits](https://github.com/langchain-ai/langgraph/compare/checkpointsqlite==3.0.3...checkpointsqlite==3.1.2)

---
updated-dependencies:
- dependency-name: langgraph-checkpoint-sqlite
  dependency-version: 3.1.2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-10-29 11:22:59 +00:00
dependabot[bot] cbd7065584 Update langchain-google-genai requirement from >=4.2.1 to >=4.4.2
Updates the requirements on [langchain-google-genai](https://github.com/langchain-ai/langchain-google) to permit the latest version.
- [Release notes](https://github.com/langchain-ai/langchain-google/releases)
- [Commits](https://github.com/langchain-ai/langchain-google/compare/libs/genai/v4.2.1...libs/genai/v4.4.2)

---
updated-dependencies:
- dependency-name: langchain-google-genai
  dependency-version: 4.4.2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-10-29 11:22:37 +00:00
Jeremy Grossmann 0c34520017 Merge pull request #3032 from tikD1337/fix/ai-stub-shadows-access-routes
fix(api): keep the LLM stub from shadowing /access routes without AI extras
2026-10-28 16:09:02 +01:00
Jeremy Grossmann 16c5d028dc Merge pull request #3033 from tikD1337/fix/web-ui-lib-assets
fix(web-ui): ship the bundled consoles' lib/ files (VNC and xpra)
2026-10-26 15:34:29 +01:00
tikD1337andClaude Opus 5.5 406086c177 fix(web-ui): ship the bundled consoles' lib/ files (VNC and xpra)
The ".gitignore" rules "lib" and "lib64" (from the Python template, meant
for a virtualenv at the repository root) match a directory with that name
at any depth. They kept two folders of the bundled web UI out of git:

- assets/vnc-console/novnc/vendor/pako/lib/ (12 files, zlib for noVNC)
- assets/xpra-html5/js/lib/ (20 files)

Anything built from a git checkout (GitHub archives, Docker images) ships
without them. The server answers a missing asset with the web UI page, so
noVNC's module graph fails to load (a module served as text/html) and the
VNC console stays on "Initializing VNC Console..."; the xpra console loses
its scripts the same way.

Anchor both rules to the repository root and add the 32 files, taken from
gns3-web-ui v3.1.0a7 (the bundled version); every blob is identical to the
one in that tag. A test walks the VNC console's module imports and the xpra
pages' scripts and fails on any file that is not in the package.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 12:09:50 +01:00
tikD1337andClaude Opus 5.5 09b8420354 fix(api): keep the LLM stub from shadowing /access routes without AI extras
Without the AI dependencies the LLM model configuration router is replaced
by a stub that answers 501. It was a catch-all ("/{path:path}") included
under the /access prefix, so it also answered every /access route included
after it: creating an API key (POST /v3/access/api-keys) failed with "AI
Copilot is not available", which left API keys unusable on servers without
the AI extras.

The LLM stub now covers only the LLM model configuration paths, under
/access/users/{user_id}/ and /access/groups/{group_id}/. The stub routers
are built by build_ai_stub_routers() so tests can check them with or
without the extras, and add_stub_routes() takes the paths to stub.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 10:35:12 +01:00
Jeremy Grossmann ac01ee6190 Merge pull request #3031 from yueguobin/docs/netem-seed-kernel-requirement
docs: state the Linux 6.6 requirement of the netem seed filter
2026-10-26 08:02:53 +01:00
yueguobin c988ede19c docs: state the Linux 6.6 requirement of the netem seed filter
Aligns with uBridge's tc.md correction: TCA_NETEM_PRNG_SEED (uapi slot 14,
added in Linux 6.6 — not the nonexistent TCA_NETEM_SEED at "5.1") is what
the seed filter rides on; pre-6.6 kernels parse qdisc options
non-strictly and silently drop the attribute, so seed determinism is
unavailable there while every other netem knob applies. Stated in both
filter tables and the seed section of packet-filters.md, the seed rows of
the MCP and copilot tool descriptions, and the kernel-impairment spec.
2026-10-26 13:23:05 +08:00
Jeremy Grossmann fa4b763640 Merge pull request #3027 from tikD1337/fix/ubridge-kernel-datapath-version
Require uBridge >= 1.3.1
2026-10-25 02:49:15 +02:00
tikD1337andClaude Opus 5.5 07b0c21fe5 Require uBridge >= 1.3.1 instead of gating the kernel datapath
Review feedback: 3.1 is still in alpha and the GNS3 VM ships a matching
uBridge, so a hard minimum is simpler than a version-based degrade path,
and it also covers Docker endpoints and the builtin Ethernet switch,
which never went through the anchor probes. Raise minimum_required_version
to 1.3.1 and drop supports_kernel_datapath and its uses; the relay
fallback for capability problems (no CAP_NET_ADMIN) is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 01:39:52 +02:00
Jeremy Grossmann dc6a9b3c7e Merge pull request #3028 from tikD1337/fix/switch-stale-bridge
fix(ethernet-switch): release a leftover bridge's ports before the crash-recovery delete
2026-10-24 17:31:11 +02:00
Jeremy Grossmann dd19d96fbf Merge pull request #3029 from tikD1337/fix/qemu-tap-partial-csum
fix(qemu): open the adapter TAP with vnet_hdr=off so relay links carry finished checksums
2026-10-24 09:20:16 +02:00