13 Commits

Author SHA1 Message Date
17618b8c92 Add package-lock.json for reproducible Docker builds 2026-03-06 17:38:22 -07:00
e57536bbb3 Add .env.example for production deploy 2026-03-06 17:37:13 -07:00
5cc14f3dcf Add Starlight documentation site
Scaffolds docs-site/ with the warehack.ing cookie-cutter
pattern (Caddy + Node multi-stage Dockerfile, caddy-docker-proxy
labels, HMR via WSS).

21 content pages following Diataxis structure:
- Start Here: overview, installation, first-steps tutorial
- How-To Guides: media players, systemd, notifications,
  battery/network, bluetooth, service exploration, permissions
- Reference: discovery tools, interaction tools, shortcut tools,
  resources, prompts, environment variables
- Explanation: architecture, session vs system bus,
  confirmation flow, security layers

Terminal-green + slate theme. Builds to 22 static HTML pages.
2026-03-06 17:34:33 -07:00
f09da7259f Bump fastmcp>=2.14.5 → fastmcp>=3.0 2026-03-06 16:53:40 -07:00
11a004d719 Bump fastmcp>=2.14.5 → fastmcp>=3.0
Tests pass on 3.1.0 — no code changes needed.
2026-03-06 16:00:00 -07:00
65913f57bc Bump to 2026.03.06.1 — fix project URL in metadata 2026-03-06 14:48:00 -07:00
c8a1ce0fdb Add desktop notification confirmation fallback, update README for PyPI
When MCP elicitation is unavailable (most clients), fall back to
org.freedesktop.Notifications with Approve/Deny action buttons.
Opt-in via MCDBUS_NOTIFY_CONFIRM=1. Silence (timeout) is denial.

Fixes signal race where NotificationClosed stomped ActionInvoked
result in the same event loop iteration.
2026-03-06 14:47:39 -07:00
89419a36c2 Fix elicitation graceful degradation when client lacks protocol support
ctx.elicit() throws an exception (not CancelledElicitation) when the
MCP client doesn't implement the elicitation/create JSON-RPC method.
Wrap the call in try/except to treat protocol-level rejection the
same as CancelledElicitation. Found during live testing with Claude
Code CLI which doesn't support MCP elicitation yet.
2026-03-06 12:04:49 -07:00
5fa1eb36ef Hamilton remediation: validation, ToolError, elicitation, permission docs
Three-pillar fix from Hamilton review:

Code quality — validate_signature() for D-Bus spec compliance,
MCDBUS_TIMEOUT env var, replace 13 error-as-success returns with
ToolError, monotonic clock deadline on tree walks, sanitize D-Bus
error messages, fix resource connection leak via module-level
BusManager, hasattr guards in conftest.

Elicitation — ctx.elicit() confirmation for system bus call_method
and all set_property calls, graceful degradation when client lacks
elicitation support, MCDBUS_REQUIRE_ELICITATION for hard-fail mode.

Permission docs — four-layer guide (systemd sandboxing, dbus-broker
policy, polkit rules, xdg-dbus-proxy) with ready-to-deploy example
configs validated against xmllint, bash -n, and systemd-analyze.
2026-03-06 11:54:31 -07:00
326be8d52d Add tool-level tests via Client(mcp) and 4 new shortcut tools
Fix get_mgr() to use ctx.lifespan_context (works in both request
and standalone Client mode). Add autouse fixture to reset
event-loop-bound singleton state per test, preventing cross-test
asyncio.Event contamination.

21 new tests exercise all 14 tools through FastMCP's in-memory
transport. New shortcuts: network_status (NetworkManager),
battery_status (UPower), bluetooth_devices (bluez),
kwin_windows (KRunner WindowsRunner). 53 tests pass.
2026-03-05 23:12:28 -07:00
fa41ffbf80 Harden all tool/resource paths per Hamilton review
- Add asyncio.wait_for timeout (30s) to all D-Bus calls
- Add asyncio.Lock to BusManager.get_bus to prevent race conditions
- Convert recursive tree walk to bounded BFS with visited set, max depth (20), max nodes (500)
- Add input validation for D-Bus names and object paths at tool boundary
- Standardize error handling (RuntimeError, TimeoutError) across all tools
- Catch JSONDecodeError in deserialize_args and set_property
- Check arg count matches signature in deserialize_args
- Add explicit variant wrapping via {"signature": "ai", "value": [1,2,3]}
- Narrow resource exception handling from Exception to (RuntimeError, OSError)
- Guard disconnect_all per-bus to avoid partial cleanup on error
- Audit log system bus calls and all set_property calls to stderr
- Consolidate _get_mgr into get_mgr in _bus.py
- Sort MPRIS players for deterministic auto-discovery
- Fix progress reporting (pass None as total when unknown)
- Add 7 new tests for validation, arg count, and JSON error paths (32 total)
2026-03-05 20:31:06 -07:00
4d7b73f6ee Implement D-Bus MCP server with introspection-first discovery
Bridge Linux D-Bus IPC into MCP with tools for service discovery
(list_services, introspect, list_objects), method calls and property
access, plus convenience shortcuts for notifications, systemd units,
and MPRIS media player control. All 25 tests passing.
2026-03-05 20:20:55 -07:00
b383f36872 Initial project scaffold for mcdbus D-Bus MCP server 2026-03-05 20:09:32 -07:00