Secure, multi-tenant MCP server delivery kit for deploying remote LLM tools via Cloudflare Tunnels. Use when: Deploy a secure remote MCP bridge to a Raspberry Pi behind Cloudflare; Enforce tenant isolation so clients only see their own private data; Automate systemd service creation and sandboxing for MCP tools.
74%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Fix and improve this skill with Tessl
tessl review fix ./plugins/nex-dev-essentials/skills/nex-mcp-client-delivery/SKILL.mdThe canonical home for this skill is nex-mcp-client-delivery in NexaiGuy/nex-ai-skills
Free skill by Nex AI. This file is the public guide from Agensi. Scripts, extension source, and templates from the original package are not in this folder.
Exposing internal business data to LLMs like Claude or Cursor requires more than just a wrapper. You need a production-grade bridge that handles multi-tenancy and security without leaking data between clients.
This skill provides the deployment machinery to ship a secure, remote MCP (Model Context Protocol) server to a Raspberry Pi or cloud instance. It implements a FastAPI-based bridge behind Cloudflare Tunnels, ensuring that when a client queries their orders or dossiers, they only see their own data. It moves beyond simple local setups to a managed delivery workflow with automated systemd configuration and health checks.
tenant_id is extracted strictly from the auth token, preventing one client from accessing another's data.read or write permissions per user token.tools_client.py using JSON schemas and assigned scopes like read or write..env, including the MCP_TOKEN_SECRET and canonical URLs.setup.sh to create sandboxed system users and restricted systemd units.deploy.sh, which manages backups, rsync synchronization, and /healthz checks.Built with Python and FastAPI for the server layer. Deployment targets Linux environments (optimized for Raspberry Pi/Debian) using systemd, rsync, and Cloudflare Tunnels.
Building a secure MCP bridge requires handling edge cases like rsync idempotency and JWT validation that generic prompts often overlook. This skill enforces a "security-by-default" architecture where the server refuses to boot with weak keys or misconfigured tenants.
Does not support SSE (Server-Sent Events) for progress streaming. Sessions are stored in-memory, restricting the server to a single worker process unless an external store like Redis is added.
Request
I need to deliver a remote MCP server for a client named 'acme-corp' to access their inventory. It needs to run on a Pi at mcp.acme.com and require a token for the manager.
Result
De oplevering voor acme-corp staat klaar. Eén klant, één poort, één token, en een auditlogboek dat achteraf laat zien wie wat opvroeg.
| Onderdeel | Waarde |
|---|---|
| Dienst | nex-mcp-acme-corp, afgeschermde systemd-unit |
| Endpoint | https://mcp.acme.com/mcp, achter Cloudflare Tunnel |
| Luistert op | 127.0.0.1:8848, geen open poort naar buiten |
| Authenticatie | bearer token, audience gebonden aan de canonieke URL |
| Rechten | scope read voor de zaakvoerder |
| Auditlogboek | /var/log/nex-mcp/acme-corp/audit.jsonl |
from auth import Principal
from tools import tool
@tool(
name="zoek_voorraad",
description="Zoekt de actuele voorraad per productgroep.",
scope="read",
input_schema={
"type": "object",
"properties": {
"groep": {"type": "string"},
"limiet": {"type": "integer", "minimum": 1, "maximum": 100, "default": 25},
},
"required": ["groep"],
},
)
def zoek_voorraad(principal: Principal, args: dict) -> str:
tenant = principal.tenant_id # uit het token, nooit uit args
rows = db.fetch_stock(tenant, groep=args["groep"],
limit=min(int(args.get("limiet", 25)), 100))
return format_rows(rows)De tenant staat niet in het schema. Dat is geen stijlkeuze: het register weigert een tool te registreren die tenant_id als argument declareert, en een aanroep die het alsnog meestuurt krijgt een 403. Zo kan een klant niet vragen om de voorraad van een andere klant.
test_token_voor_andere_dienst_wordt_geweigerd PASSED
test_verlopen_token_wordt_geweigerd PASSED
test_client_kan_zijn_tenant_niet_zelf_kiezen PASSED
test_tool_die_verboden_argument_declareert... PASSED
test_scope_bepaalt_wat_je_ziet_en_wat_je_mag PASSED
test_tenant_komt_uit_het_token_tot_in_de_handler PASSED
test_auditlogboek_laat_geheimen_niet_door PASSED
7 passedEen token met scope read ziet zoek_voorraad wel en een schrijftool niet. Niet grijs, niet geblokkeerd: hij staat gewoon niet in tools/list.
sudo ./setup.sh acme-corp 8848 # eenmalig: gebruiker, mappen, unit, firewall
./deploy.sh acme-corp ./server # reservekopie, rsync -a -I, herstart, /healthzZakt de gezondheidscontrole, dan print deploy.sh de laatste veertig regels uit het journaal plus de terugdraairegel om te plakken. Er blijft nooit een half uitgerolde versie draaien.
mcp.acme.com toevoegen aan de tunnel, doel http://127.0.0.1:8848, altijd boven de http_status:404 regel.auth.issue_token("zaakvoerder@acme.com", "acme-corp", ["read"]) vanuit je eigen backend.README-voor-de-klant.md meesturen. Die staat in het Nederlands en legt uit wat Claude wel en niet mag zien.Unlike local MCP setups, this kit provides a production-ready bridge that uses Cloudflare Tunnels and multi-tenant isolation, allowing you to securely serve data to remote LLMs without opening firewall ports.
The kit is designed for any MCP-compatible environment, including Claude Desktop and Cursor, provided they can connect to the secure FastAPI endpoint hosted via your Cloudflare Tunnel.
You will receive the complete FastAPI server architecture, production deployment scripts (setup.sh and deploy.sh), systemd configuration templates, and the security middleware for tenant isolation.
It uses a 'security-by-default' approach where the server extracts tenant IDs directly from auth tokens, preventing data leakage between clients even when multiple users share the same edge device.
While optimized for Raspberry Pi and Debian-based Linux environments, the bridge can be deployed to any cloud instance or edge device that supports Python 3, systemd, and Cloudflare Tunnels.
The kit includes a built-in health check endpoint (/healthz) and automated audit logging that records every tool invocation to a JSONL file, masking sensitive credentials for compliance.
Built by Nex AI. More skills, including the paid catalog: https://www.agensi.io/creators/ch1n4-g3nd4x
NexaiGuy/nex-ai-skills
4034c84
Canonical home
since Nov 1, 2026
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.