mache-usagelisted
Install: claude install-skill jamestexas/agents
# mache-usage — MCP Server Lifecycle
Ensure a mache MCP server is running for a given source and return the session info.
## Arguments
`$ARGUMENTS` — `<source-path-or-db> [port]`
- `source`: path to a directory of source files or a pre-built `.db` file
- `port`: optional, default `7532`
## What To Do
### Step 1: Parse arguments
```bash
SOURCE="<first argument>"
PORT="${2:-7532}"
```
### Step 2: Check for existing server
```bash
curl -s --max-time 5 -X POST http://localhost:$PORT/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"check","version":"1"}}}' \
| python3 -c "import sys,json; d=json.load(sys.stdin); print('RUNNING' if 'result' in d and 'error' not in d else 'NOT_RUNNING')" 2>/dev/null || echo "NOT_RUNNING"
```
If `RUNNING`: skip to Step 4.
### Step 3: Start the server
```bash
MACHE_BIN=$(which mache 2>/dev/null || echo "$HOME/go/bin/mache")
if [ ! -x "$MACHE_BIN" ]; then
echo "status: unavailable — mache binary not found in PATH or ~/go/bin/"
exit 0
fi
```
mache auto-detects schema from the source (Go files → go-schema.json, .db → serve directly). Do NOT pass `--schema` unless the user explicitly requests a specific schema.
```bash
$MACHE_BIN serve "$SOURCE" --http "localhost:$PORT" &
MACHE_PID=$!
for i in $(seq 1 10); do
sleep 1
curl -s --max-time 2 -X POST http:/