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é
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。
mcp-server-qdrant
这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。