Merge pull request 'chore: bootstrap Claude setup' (#1) from chore/bootstrap into main

This commit is contained in:
Claude committed 2026-10-18 18:32:08 +00:00
commit 2c853178d8
12 files changed
+237

No files matched your search

+1
View File
@@ -0,0 +1 @@
2
+25
View File
@@ -0,0 +1,25 @@
{
"hooks": {
"PostToolUse": [
{
"matcher": "Edit|Write",
"hooks": [
{
"type": "command",
"command": "f=$(cat | python3 -c 'import json,sys; print(json.load(sys.stdin).get(\"tool_input\",{}).get(\"file_path\",\"\"))'); case \"$f\" in *.py) python3 -m py_compile \"$f\" ;; esac"
}
]
}
],
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "python3 -m py_compile server.py"
}
]
}
]
}
}
+8
View File
@@ -0,0 +1,8 @@
# Nextcloud connection (required)
NEXTCLOUD_HOST=
NEXTCLOUD_USERNAME=
NEXTCLOUD_PASSWORD=
# Server bind address (optional, defaults shown)
BIND_HOST=127.0.0.1
BIND_PORT=8082
+25
View File
@@ -0,0 +1,25 @@
name: CI
on:
pull_request:
branches: [development]
push:
branches: [development, main]
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
- name: Install dependencies
run: pip install -r requirements.txt
# No linter or test suite configured yet; this is a compile-time sanity check.
- name: Compile check
run: python -m py_compile server.py
+68
View File
@@ -0,0 +1,68 @@
name: Version
on:
push:
branches: [development, main]
permissions:
contents: write
jobs:
bump:
if: ${{ github.actor != 'github-actions[bot]' && !contains(github.event.head_commit.message, '[skip ci]') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Bump version
id: bump
run: |
set -euo pipefail
current=$(cat VERSION)
IFS='.' read -r major minor patch <<< "$current"
if [ "${{ github.ref_name }}" = "development" ]; then
patch=$((patch + 1))
else
# main: a MINOR bump only when every commit in this push came from
# development (i.e. an approved development -> main PR merge);
# anything else pushed straight to main is treated as a hotfix.
parents=$(git log -1 --pretty=%P HEAD | wc -w)
if [ "${{ github.event_name }}" = "push" ] && [ "$parents" -gt 1 ] && \
git log -1 --pretty=%s HEAD | grep -qiE "merge pull request|from .*/development"; then
minor=$((minor + 1))
patch=0
else
patch=$((patch + 1))
fi
fi
new_version="$major.$minor.$patch"
echo "$new_version" > VERSION
echo "version=$new_version" >> "$GITHUB_OUTPUT"
- name: Commit and tag
run: |
git add VERSION
git commit -m "chore(release): v${{ steps.bump.outputs.version }} [skip ci]"
git push origin HEAD:${{ github.ref_name }}
- name: Merge main back into development
if: ${{ github.ref_name == 'main' }}
run: |
if git ls-remote --exit-code --heads origin development > /dev/null; then
git fetch origin development
git checkout development
git merge --no-edit origin/main
git push origin development
else
echo "No development branch yet; skipping merge-back."
fi
+5
View File
@@ -0,0 +1,5 @@
__pycache__/
*.pyc
.env
.venv/
venv/
+41
View File
@@ -0,0 +1,41 @@
# CLAUDE.md
## Overview
MCP server exposing a Nextcloud instance (files, calendars, address books,
Talk) as tools for an MCP-compatible AI agent. Single file: `server.py`.
## Commands
- Install: `pip install -r requirements.txt`
- Run: `python server.py` (reads `NEXTCLOUD_HOST`, `NEXTCLOUD_USERNAME`,
`NEXTCLOUD_PASSWORD` from the environment; see `.env.example`)
- Test: none yet.
- Lint: none yet.
- Build: none (no packaging step; Nixpacks runs `python server.py` directly,
see `nixpacks.toml`).
- Sanity check: `python -m py_compile server.py`
## Architecture
See [`docs/architecture.md`](docs/architecture.md).
## Conventions
- One `@mcp.tool()` function per Nextcloud operation; docstring = tool
description shown to the agent.
- Parsing/formatting helpers are private (`_`-prefixed) and live near the
tools that use them.
## Workflow quirks
- No `development` branch yet; branch from `main`, PR into `main` directly
until `development` is created.
- No automated tests or linter are configured yet (no pytest/ruff/flake8 in
`requirements.txt`). CI only runs `python -m py_compile server.py` as a
sanity check.
## Deployment
See [`docs/deployment.md`](docs/deployment.md). Currently deployed via
Nixpacks, not the org's standard LXC/VPS + systemd setup.
## Gotchas
- `NEXTCLOUD_HOST`, `NEXTCLOUD_USERNAME`, `NEXTCLOUD_PASSWORD` are required
env vars; the process raises `KeyError` on import if any is missing.
- Recurring calendar events are expanded server-side (`c:expand`) in
`list_events`, so each occurrence is a separate item, unlike `get_event`.
+3
View File
@@ -0,0 +1,3 @@
# Lessons
Recurring mistakes and how to avoid them. Add an entry whenever one repeats.
+15
View File
@@ -0,0 +1,15 @@
# ZenvairoCloud-MCP
MCP server that exposes a Nextcloud instance (files, calendars, address books,
and Talk) as tools for an MCP-compatible AI agent.
## Quick start
```bash
pip install -r requirements.txt
cp .env.example .env # fill in NEXTCLOUD_HOST, NEXTCLOUD_USERNAME, NEXTCLOUD_PASSWORD
python server.py
```
See [`docs/architecture.md`](docs/architecture.md) for how it works and
[`docs/deployment.md`](docs/deployment.md) for running it in production.
+1
View File
@@ -0,0 +1 @@
0.1.0
+29
View File
@@ -0,0 +1,29 @@
# Architecture
`server.py` is a single-file MCP server (streamable-http transport, via the
`mcp` package's `MCPServer`) that proxies calls to a Nextcloud instance.
## Layers
- **Files**: WebDAV (`PROPFIND`, `GET`, `PUT`, `DELETE`, `MKCOL`, `MOVE`) under
`/remote.php/dav/files/{user}/`, plus the unified search OCS endpoint and
the file-sharing OCS API.
- **Calendars**: CalDAV under `/remote.php/dav/calendars/{user}/`. Events and
tasks (VTODO) are built/parsed with `vobject`. `list_events` uses a
server-side `calendar-query` with `c:expand` so recurring events come back
as individual occurrences.
- **Address books**: CardDAV under `/remote.php/dav/addressbooks/users/{user}/`,
contacts as vCards via `vobject`.
- **Talk**: Nextcloud Talk's OCS Spreed API (`/ocs/v2.php/apps/spreed/api/`)
for listing conversations and reading/sending chat messages.
All Nextcloud calls use HTTP Basic auth (`NEXTCLOUD_USERNAME` /
`NEXTCLOUD_PASSWORD`) through a short-lived `httpx.Client` per request
(`_client()`).
## Adding a tool
Add a function decorated with `@mcp.tool()`; its docstring becomes the tool
description shown to the agent. Keep request/response shaping (XML/vCard/
iCalendar parsing) in a private helper near the existing `_parse_*` /
`_summarize_*` functions so tools stay thin.
+16
View File
@@ -0,0 +1,16 @@
# Deployment
The repo currently ships a `nixpacks.toml` (`python server.py`), i.e. it is
built/run through Nixpacks rather than this org's standard LXC/VPS + systemd
setup.
This does not yet follow the `web-deploy` standard. Missing pieces, if the
deployment target is ever moved to an LXC/VPS:
- A systemd unit file to run `server.py` as a service.
- An idempotent `scripts/update.sh` (pull, install deps, restart).
- An authenticated HTTP endpoint that triggers the update script (token auth,
single-flight, status, rate limiting).
Until then, deploy via whatever platform consumes `nixpacks.toml` and set the
environment variables listed in `.env.example`.