availability_mcp
by shayben
README.md
# availability_mcp
A dependency-free MCP server that runs locally and reports the current user's
activity/idle state. Agents can use it when deciding whether to wait for user
feedback or continue autonomously. Activity data stays on-device and is only
returned to the connected MCP client.
## Install and configure
Python 3.10 or newer is required.
```bash
python -m pip install .
```
Add the server to your MCP client:
```json
{
"mcpServers": {
"availability": {
"command": "availability-mcp"
}
}
}
```
For development, run it directly with:
```bash
PYTHONPATH=src python -m availability_mcp.server
```
## Tool
### `get_user_activity`
Returns:
- `idle_seconds`: time since the last detected user input
- `is_idle`: whether idle time meets `idle_threshold_seconds` (default: 300)
- `last_activity_at` and `observed_at`: UTC ISO 8601 timestamps
- `source`: the operating-system API used for the reading
The optional `idle_threshold_seconds` argument must be non-negative.
## Platform support
- **Windows:** `GetLastInputInfo`
- **macOS:** the built-in `ioreg` utility and `IOHIDSystem`
- **Linux:** `xprintidle` when installed, otherwise systemd-logind's user idle
hint. Desktop environments that publish neither source return a tool error
rather than guessing.
On macOS, terminal input-monitoring permissions may be required. Linux
systemd-logind reports coarse active/idle state when `xprintidle` is not
available; install `xprintidle` under X11 for exact idle duration.
## Test
```bash
PYTHONPATH=src python -m unittest discover -s tests
```TDQS
A3.9/5.0
Scored across 1 tool
Disambiguation5/5
There is only one tool, so there is no possibility of confusion or misselection between tools. Its purpose (retrieving the local user's idle duration and activity state) is unambiguous.
Naming Consistency5/5
The single tool follows a clear verb_noun convention (get_user_activity). With only one tool there is no inconsistency to introduce.
Tool Count3/5
A single tool is thin for a server, even one with a narrow scope like availability detection. It works but leaves little room for related queries, making the surface feel minimal.
Completeness4/5
For the narrow stated purpose of determining user availability, the tool covers the key signal (idle duration and activity state). Coverage is reasonable, though richer availability context (e.g. session or lock state) is absent.
Maintenance
ActivityMaintained
ResponsivenessNo issues