MCP PiShock Server
Enables controlling PiShock devices (shock, vibrate, beep) via the MCP protocol with API key authentication.
README
MCP PiShock Server
English | Français
English
HTTP streamable MCP (Model Context Protocol) server for controlling PiShock devices via their REST API.
Features
- SHOCK: Activates electric shock function with duration (1-15s) and intensity (1-100)
- VIBRATE: Activates vibration function with duration and intensity (1-100)
- BEEP: Activates beep sound function with duration
- Authentication: Bearer token protection
- MCP Protocol: Full MCP 2025-06-18 protocol support with tool discovery
- Docker: Containerized with environment variable configuration
Configuration
- Copy
.env.exampleto.env:
cp .env.example .env
- Fill in the environment variables in
.env:
PISHOCK_USERNAME=your_username
PISHOCK_APIKEY=your_api_key
PISHOCK_CODE=your_share_code
MCP_AUTH_TOKEN=secure_random_token
SCRIPT_NAME=MCP_Server
Getting PiShock Credentials
- Create an account on PiShock.com
- In the Account section:
- Get your Username
- Generate an API Key
- Create a Share Code with desired limitations
Deployment
With Docker Compose (recommended)
docker-compose up -d
With Docker
docker build -t pishock-mcp-server .
docker run -d \
-p 8000:8000 \
--env-file .env \
--name pishock-mcp-server \
pishock-mcp-server
Local Development
pip install -r requirements.txt
python app.py
MCP Client Usage
The server implements the full MCP protocol. MCP clients will automatically:
- Initialize with the server using the
initializemethod - Discover tools using
tools/listto see available SHOCK, VIBRATE, BEEP functions - Call tools using
tools/callwith the appropriate parameters
Authentication
All requests require a Bearer token in the Authorization header:
Authorization: Bearer YOUR_MCP_AUTH_TOKEN
Available Tools
- SHOCK:
{"name": "SHOCK", "arguments": {"duration": 2, "intensity": 10}} - VIBRATE:
{"name": "VIBRATE", "arguments": {"duration": 3, "intensity": 50}} - BEEP:
{"name": "BEEP", "arguments": {"duration": 1}}
Direct API Usage (Compatibility)
For non-MCP clients, direct endpoints are available:
# Shock
curl -X POST "http://localhost:8000/mcp/SHOCK" \
-H "Authorization: Bearer your_token" \
-H "Content-Type: application/json" \
-d '{"duration": 1, "intensity": 5}'
# Vibrate
curl -X POST "http://localhost:8000/mcp/VIBRATE" \
-H "Authorization: Bearer your_token" \
-H "Content-Type: application/json" \
-d '{"duration": 2, "intensity": 30}'
# Beep
curl -X POST "http://localhost:8000/mcp/BEEP" \
-H "Authorization: Bearer your_token" \
-H "Content-Type: application/json" \
-d '{"duration": 1}'
Monitoring
- Health Check:
GET /health - API Documentation:
http://localhost:8000/docs - MCP Info:
GET /mcp - Logs:
docker-compose logs -f
Security
⚠️ WARNING: Shock devices are not designed for human use and can cause serious injury including cardiac events. Never use near the heart or if you have heart conditions.
- Use strong authentication tokens
- Limit network access to the server
- Configure appropriate limits in PiShock
- Monitor usage logs
Limitations
- Shock duration: 1-15 seconds (PiShock API limit)
- Intensity: 1-100 (PiShock API limit)
- One command at a time per share code
- Device must be online and connected
Serveur MCP PiShock (Français)
Serveur MCP (Model Context Protocol) HTTP streamable pour contrôler les dispositifs PiShock via leur API REST.
Fonctionnalités
- SHOCK: Active la fonction de choc électrique avec durée (1-15s) et intensité (1-100)
- VIBRATE: Active la fonction de vibration avec durée et intensité (1-100)
- BEEP: Active la fonction de bip sonore avec durée
- Authentification: Protection par token Bearer
- Protocole MCP: Support complet du protocole MCP 2025-06-18 avec découverte d'outils
- Docker: Containerisé avec toutes les variables d'environnement
Configuration
- Copiez
.env.examplevers.env:
cp .env.example .env
- Remplissez les variables d'environnement dans
.env:
PISHOCK_USERNAME=votre_nom_utilisateur
PISHOCK_APIKEY=votre_cle_api
PISHOCK_CODE=votre_code_partage
MCP_AUTH_TOKEN=un_token_securise_aleatoire
SCRIPT_NAME=MCP_Server
Obtenir les identifiants PiShock
- Créez un compte sur PiShock.com
- Dans la section Account :
- Récupérez votre Username
- Générez une API Key
- Créez un Share Code avec les limitations désirées
Déploiement
Avec Docker Compose (recommandé)
docker-compose up -d
Avec Docker
docker build -t pishock-mcp-server .
docker run -d \
-p 8000:8000 \
--env-file .env \
--name pishock-mcp-server \
pishock-mcp-server
Développement local
pip install -r requirements.txt
python app.py
Utilisation avec un client MCP
Le serveur implémente le protocole MCP complet. Les clients MCP vont automatiquement :
- S'initialiser avec le serveur via la méthode
initialize - Découvrir les outils via
tools/listpour voir les fonctions SHOCK, VIBRATE, BEEP disponibles - Appeler les outils via
tools/callavec les paramètres appropriés
Authentification
Toutes les requêtes nécessitent un token Bearer dans l'header Authorization :
Authorization: Bearer YOUR_MCP_AUTH_TOKEN
Outils disponibles
- SHOCK:
{"name": "SHOCK", "arguments": {"duration": 2, "intensity": 10}} - VIBRATE:
{"name": "VIBRATE", "arguments": {"duration": 3, "intensity": 50}} - BEEP:
{"name": "BEEP", "arguments": {"duration": 1}}
Utilisation API directe (Compatibilité)
Pour les clients non-MCP, des endpoints directs sont disponibles :
# Shock
curl -X POST "http://localhost:8000/mcp/SHOCK" \
-H "Authorization: Bearer your_token" \
-H "Content-Type: application/json" \
-d '{"duration": 1, "intensity": 5}'
# Vibrate
curl -X POST "http://localhost:8000/mcp/VIBRATE" \
-H "Authorization: Bearer your_token" \
-H "Content-Type: application/json" \
-d '{"duration": 2, "intensity": 30}'
# Beep
curl -X POST "http://localhost:8000/mcp/BEEP" \
-H "Authorization: Bearer your_token" \
-H "Content-Type: application/json" \
-d '{"duration": 1}'
Surveillance
- Health Check:
GET /health - Documentation API:
http://localhost:8000/docs - Informations MCP:
GET /mcp - Logs:
docker-compose logs -f
Sécurité
⚠️ AVERTISSEMENT: Les dispositifs de choc ne sont pas conçus pour un usage humain et peuvent causer des blessures graves y compris des événements cardiaques. Ne jamais utiliser près du cœur ou si vous avez des problèmes cardiaques.
- Utilisez des tokens d'authentification forts
- Limitez l'accès réseau au serveur
- Configurez des limites appropriées dans PiShock
- Surveillez les logs d'utilisation
Limitations
- Durée de choc : 1-15 secondes (limite API PiShock)
- Intensité : 1-100 (limite API PiShock)
- Une seule commande à la fois par share code
- Le dispositif doit être en ligne et connecté
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.