nc-forms-mcp
MCP server for the Nextcloud Forms API v3 that enables secure creation, update, cloning, and validation of forms without exposing credentials to the AI agent.
README
nc-forms-mcp
MCP server for the Nextcloud Forms API v3. Create, update, clone, and validate forms — without ever leaking an app password into the agent's context.
<p align="center"> <strong>Push Forms API operations into a sealed MCP server.</strong><br> <em>Your agent calls tools, not curl. The password never leaves the env.</em> </p>
🤨 The Problem
Nextcloud Forms has a REST API at /ocs/v2.php/apps/forms/api/v3/ that uses
HTTP Basic Auth with an app password. When an AI agent calls this API directly:
| Issue | What happens | Consequence |
|---|---|---|
| Credential leakage | The password passes through the LLM's context | Stored in logs, prompt caches, conversation history |
| Tool sprawl | Every Forms operation is a raw curl invocation |
Inconsistent error handling, no validation |
| No isolation | The same credential gets reused for WebDAV, shares, etc. | Scope creep — operations outside Forms API |
| Repetition | Auth headers, error parsing, and retry logic in every call | Wasteful tokens and fragile code |
Bottom line: credentials in agent context = risk. Raw API calls in conversation = tech debt.
✅ The Solution
Wrap the Forms API in an MCP server that:
- Reads credentials from environment variables only — the agent never sees them
- Exposes 16 focused tools —
forms_get,questions_add,options_update, etc. - Runs as a stdio subprocess managed by the Hermes MCP client
- Returns structured JSON — no parsing needed
- Validates form health with a single tool call
┌──────────────┐ MCP stdio ┌──────────────────┐ HTTPS Basic Auth ┌──────────────────┐
│ │ ──────────────→│ │ ────────────────────→│ │
│ Hermes │ ←──────────────│ nc-forms-mcp │ ←────────────────────│ Nextcloud Forms │
│ Agent │ │ (Python process) │ │ API v3 │
│ │ │ NC_FORMS_PASSWORD│ │ │
└──────────────┘ │ (env only, │ └──────────────────┘
│ never in chat) │
└──────────────────┘
📦 Installation
Prerequisites
- Python 3.10+
- Nextcloud instance with Forms app (v5+)
- Nextcloud app password (Settings → Security → Devices & sessions)
Install
git clone https://github.com/erniomaldo/nc-forms-mcp.git ~/Proyectos/nc-forms-mcp
cd ~/Proyectos/nc-forms-mcp
# Hermes uses its own venv — install there:
uv pip install --python ~/.hermes/hermes-agent/venv/bin/python -e .
Or use your project's venv:
uv venv && uv pip install -e .
🔧 Hermes Configuration
Add to ~/.hermes/config.yaml:
mcp_servers:
nc-forms:
command: "uv"
args:
- "run"
- "--directory"
- "/home/ernesto-personal/Proyectos/nc-forms-mcp"
- "nc-forms-mcp"
env:
NC_FORMS_USER: "erniomaldo"
NC_FORMS_PASSWORD: "your-app-password-here"
NC_FORMS_BASE: "https://base.agendasencilla.com"
timeout: 30
Restart Hermes after adding. On startup it auto-discovers 16 tools prefixed
mcp_nc_forms_*.
🛠️ Tools
| Tool | What it does | Use case |
|---|---|---|
forms_list |
List all owned forms | Dashboard / overview |
forms_get |
Get full form with questions, options, shares | Read current state |
forms_create |
Create an empty form | Start a new brief/survey |
forms_update |
Update title, description, settings | Iterate on form metadata |
forms_clone |
Clone a form (no submissions) | V1 → V2 iteration |
forms_delete |
Permanently delete a form | Cleanup |
questions_list |
List all questions in a form | Overview |
questions_get |
Get a single question by ID | Check specific question |
questions_add |
Add a question (multiple choice, text, etc.) | Build form content |
questions_update |
Update question text, description, isRequired | Refine wording |
questions_delete |
Remove a question | Prune sections |
questions_reorder |
Reorder questions by ID array | Reorganize sections |
options_add |
Add options to a choice question | Populate answer choices |
options_update |
Update a single option's text | Fix typos |
options_delete |
Remove an option | Cleanup |
forms_validate |
Check all questions have valid optionTypes | QA before publishing |
Tool naming
MCP prefix: mcp_nc_forms_ + tool name (underscores replace hyphens).
Example: mcp_nc_forms_forms_get → get form details.
🚀 Usage (after Hermes integration)
# List all forms
mcp_nc_forms_forms_list()
# Get form 8 with all questions + options
mcp_nc_forms_forms_get({ "form_id": 8 })
# Add a question to form 8
mcp_nc_forms_questions_add({
"form_id": 8,
"type": "multiple_unique",
"text": "🎨 1.2 ¿Colores definidos?"
})
# Add options
mcp_nc_forms_options_add({
"form_id": 8,
"question_id": 74,
"option_texts": ["✅ De acuerdo", "🟡 Cerca pero ajustes", "❌ No se parece"],
"option_type": "choice"
})
# Validate before publishing
mcp_nc_forms_forms_validate({ "form_id": 8 })
# → {"healthy": true, "total_questions": 32, "issues": []}
🧪 CLI Testing (without Hermes)
export NC_FORMS_USER="erniomaldo"
export NC_FORMS_PASSWORD="your-app-password"
export NC_FORMS_BASE="https://base.agendasencilla.com"
nc-forms-mcp forms_list '{}'
nc-forms-mcp forms_get '{"form_id": 8}'
nc-forms-mcp forms_validate '{"form_id": 8}'
🏗️ Project Structure
nc-forms-mcp/
├── pyproject.toml # Project metadata + dependencies
├── README.md # This file
├── LICENSE
├── nc_forms_mcp/
│ ├── __init__.py # Package init (re-exports server)
│ ├── server.py # MCP server: auth, route, tools, entry points
└── tests/ # Coming soon
🔐 Security
- Credentials live in
envconfig — the agent never seesNC_FORMS_PASSWORD - The app password is scoped to Forms API only — WebDAV, Shares, Calendar, Collectives, and other Nextcloud features use their own MCP tools with their own auth
- Error messages redact credential-like patterns
- The MCP server process inherits a filtered environment (Hermes strips
secrets from the subprocess env except what you explicitly set in
env)
What NOT to do
# ❌ WRONG — password leaks into agent context
mcp_servers:
nc-forms:
command: "python3"
args: ["server.py", "--password", "TEZiJ-..."]
# ✅ CORRECT — password stays in env
mcp_servers:
nc-forms:
command: "uv"
args: ["run", "--directory", "~/Proyectos/nc-forms-mcp", "nc-forms-mcp"]
env:
NC_FORMS_PASSWORD: "TEZiJ-..."
💡 Why not just use curl?
| Approach | Secret leaks? | Inconsistent errors? | Token waste? | Reusable? |
|---|---|---|---|---|
| Raw curl in conversation | ✅ Always | ✅ Every call | ✅ Headers + parsing | ❌ No |
| Python script in /tmp | ✅ In code | ✅ Per script | ✅ Duplicated logic | ❌ Per task |
| MCP server | ❌ Never | ❌ Unified | ❌ One setup | ✅ All tasks |
📋 Comparison with alternative approaches
| nc-forms-mcp | Forms web UI | Direct REST API (curl) | Custom script | |
|---|---|---|---|---|
| Setup | 5 lines in config.yaml | Zero (browser) | Zero (curl installed) | Python + requests |
| Speed | Instant (stdio) | Point-and-click | Fast | Depends on quality |
| Repeatability | ✅ Always same tools | ❌ Manual clicks | ❌ Varies per call | ✅ If committed |
| Validation | ✅ forms_validate built-in |
❌ Manual review | ❌ Never | ❌ Rarely |
| CI/CD ready | ✅ Yes | ❌ No | ⚠️ Needs auth wrapper | ✅ If committed |
| Secret safety | ✅ In env only | ❌ Browser session | ❌ In command args | ⚠️ In code or env |
| Token cost | Low (one discovery) | N/A | High (per call) | Low (per script) |
🔄 Related Projects
- agentcheckpoint — atomic state store for multi-agent coordination (SQLite + MCP)
- Hermes Agent — the personal AI agent that runs this MCP server
📄 License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。