nextcloud-tasks-mcp

nextcloud-tasks-mcp

MCP server for managing Nextcloud Tasks (todos) via CalDAV, allowing Claude to view, add, complete, edit, and delete tasks with GitHub OAuth authentication.

Category
访问服务器

README

nextcloud-tasks-mcp

An MCP server for Nextcloud Tasks, designed to work as a claude.ai / Claude Desktop custom connector — so Claude can view, add, complete, edit, and delete your todos from the web or desktop app.

Talks CalDAV (VTODO) directly to your Nextcloud with an app password. No Nextcloud plugins required. Built with FastMCP; authentication uses GitHub OAuth via FastMCP's OAuth proxy, which satisfies claude.ai's dynamic-client-registration flow while restricting access to an allowlist of GitHub usernames.

Tools

Tool Description
list_task_lists Show task lists; marks the default
create_task_list Create a new list
list_tasks Open tasks (or all with include_completed), with subtask relations
get_task Full detail for one task, including notes
add_task Add a task — due date, priority, notes, parent (subtask)
complete_task / reopen_task Toggle completion
edit_task Change summary / due / priority / notes
delete_task Permanent delete; requires confirm=true

Tasks are matched by UID, UID prefix, or summary substring; ambiguous matches return candidates so the model can retry with a UID. Tools without task_list target your default list (NC_TASKS_DEFAULT_LIST, falling back to tasks, then the first list).

Setup

1. Nextcloud app password

In Nextcloud: Settings → Security → Devices & sessions → Create new app password. Note the generated password; it goes in NC_APP_PASSWORD (or a secret file via NC_APP_PASSWORD_FILE).

2. GitHub OAuth app (connector authentication)

The server sits on the public internet (claude.ai must reach it), so it fronts itself with GitHub OAuth: connecting a Claude client pops a GitHub login, and only the GitHub accounts you allowlist get through.

  1. Go to https://github.com/settings/developersOAuth Apps → New OAuth App.
  2. Application name: anything (e.g. nextcloud-tasks-mcp).
  3. Homepage URL: your server URL, e.g. https://tasks-mcp.example.com.
  4. Authorization callback URL: https://tasks-mcp.example.com/auth/callback (your MCP_BASE_URL + /auth/callback — must match exactly).
  5. Register, then Generate a new client secret. The client ID and secret go in GITHUB_CLIENT_ID / GITHUB_CLIENT_SECRET.
  6. Set ALLOWED_GITHUB_USERS to your GitHub username (comma-separate several).

Leaving GITHUB_CLIENT_ID/GITHUB_CLIENT_SECRET unset runs the server unauthenticated — anyone who can reach it can read and write your tasks. Only do that for local testing.

3. Configuration reference

Variable Required Description
NC_URL yes Nextcloud base URL, e.g. https://cloud.example.com
NC_USER yes Nextcloud login
NC_APP_PASSWORD yes App password (or NC_APP_PASSWORD_FILE)
NC_TASKS_DEFAULT_LIST no Default list slug/name (default tasks)
MCP_BASE_URL with auth Public URL of this server
GITHUB_CLIENT_ID with auth OAuth app client ID (or _FILE)
GITHUB_CLIENT_SECRET with auth OAuth app client secret (or _FILE)
ALLOWED_GITHUB_USERS with auth Comma-separated GitHub logins allowed in
CONSENT_MODE no external (default), true, remember, or false — see below
ALLOWED_CLIENT_REDIRECT_URIS no Redirect-URI patterns MCP clients may register (default: https://claude.ai/api/mcp/auth_callback,http://localhost:*,http://127.0.0.1:*)
HOST / PORT / MCP_PATH no Bind address (0.0.0.0), port (8000), path (/mcp)
FASTMCP_HOME no Where OAuth client registrations persist (/data in Docker)

4. Run it

Docker (see compose.example.yml for the full example with secrets):

docker run -d --name tasks-mcp -p 8000:8000 \
  -e NC_URL=https://cloud.example.com \
  -e NC_USER=me -e NC_APP_PASSWORD=xxxxx-xxxxx-xxxxx-xxxxx-xxxxx \
  -e MCP_BASE_URL=https://tasks-mcp.example.com \
  -e GITHUB_CLIENT_ID=Ov23li... -e GITHUB_CLIENT_SECRET=... \
  -e ALLOWED_GITHUB_USERS=your-github-username \
  -v tasks-mcp-data:/data \
  ghcr.io/crosbyh/nextcloud-tasks-mcp:latest

Or without Docker:

uv tool install nextcloud-tasks-mcp   # or: pip install .
NC_URL=... NC_USER=... NC_APP_PASSWORD=... nextcloud-tasks-mcp

Expose it publicly at MCP_BASE_URL through your reverse proxy (TLS terminated there; route to container port 8000). It must be reachable from the public internet: Claude brokers all connector traffic — including Claude Desktop's — through Anthropic's servers. Optionally restrict ingress to Anthropic's published egress range (160.79.104.0/21) at the proxy for defense in depth.

Persist /data. FastMCP stores OAuth client registrations there (encrypted). Without a volume, every container restart forgets registered clients and you'll have to reconnect in Claude.

5. Verify with MCP Inspector

npx @modelcontextprotocol/inspector

Enter https://tasks-mcp.example.com/mcp (transport: Streamable HTTP), complete the GitHub login, and try list_task_lists.

6. Connect Claude

  1. claude.ai (or Claude Desktop) → Settings → Connectors → Add custom connector.
  2. URL: https://tasks-mcp.example.com/mcp.
  3. Claude discovers the OAuth endpoints and sends you through the GitHub consent flow. Approve, and the tools appear.
  4. Ask Claude: "What's on my task list?"

Why CONSENT_MODE=external is the default

FastMCP's built-in consent page (as of 3.4.4) regenerates its CSRF token on every GET of the consent URL. Browsers and claude.ai routinely prefetch that URL, invalidating the token the visible page holds, so submitting the form fails with "Invalid or expired consent token". external skips that page and delegates consent to GitHub's own authorization screen, which serves the same purpose here. The client redirect-URI allowlist (locked to claude.ai + localhost by default) prevents the classic risk of a consent-less flow — an arbitrary dynamically-registered client silently capturing an authorization code — because codes can only be delivered to Claude's callback or your own machine. Widen ALLOWED_CLIENT_REDIRECT_URIS deliberately if you add other MCP clients, and consider CONSENT_MODE=remember if you do.

Failure modes

  • 401 from Nextcloud → the app password is wrong or was revoked; generate a new one.
  • GitHub login succeeds but tools are denied → your login isn't in ALLOWED_GITHUB_USERS (check server logs for denied authenticated GitHub user).
  • Connector breaks after a redeploy/data wasn't persisted, or you changed GITHUB_CLIENT_SECRET (the storage encryption key derives from it). Remove and re-add the connector.

Development

uv sync
uv run pytest

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选