{
  "markdown": "# @cqnce/mcp-server\n\nOfficial MCP server for [cQnce](https://cqnce.app) — add human-in-the-loop authorization to any AI agent or workflow.\n\nConnect Claude, Cursor, GitHub Copilot, or any MCP-compatible client to cQnce so the AI can request human approval before performing risky or irreversible actions.\n\n## Quick start\n\n```bash\nnpx @cqnce/mcp-server\n```\n\nSet the `CQNCE_API_KEY` environment variable to your project API key before running.\n\n## Approval modes\n\n### Mode 1 — Agent-requested approval\n\nThe agent calls `wait_for_approval` or `submit_authorization_request` itself, as instructed in the system prompt or via tool discovery. This is the easiest integration path and works well for supervised workflows.\n\n**Risk:** a compromised or misconfigured agent may simply not call the tool.\n\n### Mode 2 — Enforced approval gate (recommended for production)\n\nThe host application or executor intercepts every sensitive tool call _before_ it runs and requires a prior cQnce approval, regardless of what the agent requested. The gate lives outside the model context — the agent cannot skip it.\n\nThis is a real security boundary. Build enterprise and compliance-sensitive integrations on this mode.\n\n```python\n# Example: host-side interception (framework-agnostic)\nHIGH_RISK_TOOLS = {\"send_payment\", \"deploy_production\", \"delete_customer\"}\n\ndef execute_tool_call(tool_call):\n    if tool_call.name not in HIGH_RISK_TOOLS:\n        return run_tool(tool_call)\n    decision = cqnce.submit_and_wait(\n        payload={\"action\": tool_call.name, \"parameters\": tool_call.arguments},\n        timeout_seconds=300,\n    )\n    if decision[\"status\"] != \"APPROVED\":\n        return {\"error\": \"not_authorized\", \"status\": decision[\"status\"]}\n    return run_tool(tool_call)\n```\n\n\nAdd to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\\Claude\\claude_desktop_config.json` (Windows):\n\n```json\n{\n  \"mcpServers\": {\n    \"cqnce\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@cqnce/mcp-server\"],\n      \"env\": {\n        \"CQNCE_API_KEY\": \"your-project-api-key\"\n      }\n    }\n  }\n}\n```\n\n### Cursor\n\nAdd to `.cursor/mcp.json` in your project (or the global `~/.cursor/mcp.json`):\n\n```json\n{\n  \"mcpServers\": {\n    \"cqnce\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@cqnce/mcp-server\"],\n      \"env\": {\n        \"CQNCE_API_KEY\": \"your-project-api-key\"\n      }\n    }\n  }\n}\n```\n\n### Any MCP client (stdio transport)\n\n```bash\nCQNCE_API_KEY=your-project-api-key npx @cqnce/mcp-server\n```\n\n### Cloud agents (Streamable HTTP / remote MCP)\n\nFor cloud-hosted agents that cannot run local processes, use the cQnce MCP Worker deployed on Cloudflare Workers. It speaks the [MCP Streamable HTTP transport](https://spec.modelcontextprotocol.io/specification/2025-03-26/basic/transports/#streamable-http) and is stateless — every request authenticates with your API key.\n\nConfigure your cloud agent framework to connect to:\n\n```\nhttps://mcp.cqnce.app/mcp\nAuthorization: Bearer <your-project-api-key>\n```\n\nExample (Claude API with MCP):\n\n```python\nimport anthropic\n\nclient = anthropic.Anthropic()\n\nresponse = client.beta.messages.create(\n    model=\"claude-opus-4-5\",\n    max_tokens=1024,\n    mcp_servers=[\n        {\n            \"type\": \"url\",\n            \"url\": \"https://mcp.cqnce.app/mcp\",\n            \"name\": \"cqnce\",\n            \"authorization_token\": \"your-project-api-key\",\n        }\n    ],\n    messages=[{\"role\": \"user\", \"content\": \"...\"}],\n    betas=[\"mcp-client-2025-04-04\"],\n)\n```\n\n#### Self-hosting\n\nThe Worker source is in this repository. Deploy your own instance to Cloudflare Workers:\n\n```bash\nnpm install\nnpx wrangler deploy\n```\n\nSet `CQNCE_BASE_URL` in the Cloudflare dashboard if you use a private cQnce deployment (defaults to `https://api.cqnce.app`).\n\n## Configuration\n\n| Variable | Required | Description |\n|---|---|---|\n| `CQNCE_API_KEY` | Yes | Project API key from [cqnce.app](https://cqnce.app) |\n| `CQNCE_BASE_URL` | No | API base URL (default: `https://api.cqnce.app`) |\n| `CQNCE_ADMIN_TOKEN` | No | Tenant admin JWT — enables project/agent/team management tools |\n\n## Tools\n\n### Core (requires `CQNCE_API_KEY`)\n\n| Tool | Description |\n|---|---|\n| `wait_for_approval` | Submit a request and **block** until a human approves or rejects it. This is the primary tool for human-in-the-loop workflows. |\n| `submit_authorization_request` | Submit a request and return the `requestId` immediately (non-blocking). |\n| `poll_request_status` | Check the current status of a request by ID. |\n| `cancel_request` | Cancel a pending request. |\n| `list_requests` | List requests for this project (filterable by status, date, tags). |\n| `get_request` | Get full details of a single request including agent responses. |\n\n### Admin (requires `CQNCE_ADMIN_TOKEN`)\n\nProject management, routing rule configuration, agent/team management, and webhook callbacks.\n\n## Recommended system prompt\n\nWhen integrating Claude via the Anthropic API, add this system prompt to enforce the authorization policy automatically — without relying on the user to request it each time:\n\n```\nYou have access to the cQnce tool for human-in-the-loop authorization.\n\nALWAYS call wait_for_approval BEFORE performing any action that is:\n- Destructive or irreversible (deleting data, dropping tables, removing files)\n- Affecting production systems (deployments, database migrations, config changes)\n- Financial (payments, transfers, subscription changes)\n- Involving credentials or access control (creating/revoking API keys, changing permissions)\n\nIn the approval payload, include:\n- \"action\": what you are about to do\n- \"target\": what resource is affected\n- \"reason\": why this action is needed\n- \"risk\": what happens if approved or rejected\n- \"attachments\": (optional) list of supporting files as { name, contentType, data (base64) }\n  — include logs, diffs, screenshots, or any evidence that helps the reviewer decide\n\nWhen the response status is \"REJECTED\":\n- Read the rejection reason carefully.\n- If the reason identifies missing information or context, gather that information,\n  enrich the payload (or attachments), and resubmit via wait_for_approval.\n- Only give up if the rejection reason makes clear the action itself is not permitted.\n\nProceed ONLY if the returned status is \"APPROVED\".\nIf \"EXPIRED\" or the rejection reason leaves no actionable path forward, stop and explain.\n```\n\n## Example\n\nOnce configured, you can tell Claude:\n\n> \"Before deleting the production database, ask for human approval via cQnce.\"\n\nClaude will call `wait_for_approval` with the action details, pause until a human approves or rejects from the cQnce mobile app, and only proceed if the status is `APPROVED`. If rejected with a reason (e.g. \"missing rollback plan\"), Claude will gather that information and resubmit automatically.\n\n## Requirements\n\n- Node.js 18+\n- A cQnce account and project API key — [sign up free](https://cqnce.app)\n",
  "bytes": 6903,
  "sha": "c3dfcfad60a752164fc3e31b20b0a9d678417ddfd1dbe1675e16ad121f0310e1",
  "repo_slug": "cqnce-app/cqnce-mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://api.agentalog.com/api/listings/mcp_io_github_cqnce_app_cqnce_mcp_79ba6592/readme"
}