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.
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)
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.
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.
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.
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__.
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.
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.
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.
- 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).
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>
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>
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.
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>