Skip to main content

Nanashi OpenShock MCP

PyPI - Version PyPI - Python Version PyPI - Implementation PyPI - Types

Tests

Loopback-only MCP server for OpenShock.

It exposes OpenShock devices and shockers as MCP tools through Python and Nanashi-OpenShockPY.

This server is meant to run on the same machine as your MCP client. It should not be reachable from other devices.

Liability Waiver

Read this before pressing buttons you might later pretend were "just testing".

This software sends real commands to real hardware. If you call shock, vibrate, or beep, devices receive that action. This project does not detect sarcasm, hesitation, or regret.

By using this project, you agree that:

  • You are fully responsible for setup, configuration, and usage.
  • You only use it with informed consent and lawful, ethical intent.
  • You leave confirmation safeguards enabled unless you intentionally accept the risk.
  • You understand there is no undo for actions already sent to hardware.
  • You understand "I did not think it would actually do that" is not a bug report.

Short version: tool execute command. Consequences belong to operator.

Quick Start

  1. Install:
pipx install --force 'git+https://github.com/NanashiTheNameless/OpenShockMCP.git@master'
  1. First run with your API key to generate config and start the server:
OPENSHOCK_API_KEY="your-api-key" nanashi-openshock-mcp
  1. Point your MCP client to nanashi-openshock-mcp (stdio is the default and recommended transport).

If you prefer the full setup details, continue below.

Requirements

  • Python 3.10 or newer
  • pipx
  • git (required if you install this project from a GitHub URL)
  • An OpenShock API key

Dependencies:

mcp>=1.27.0
Nanashi-OpenShockPY>=0.1.0.0

Installation

Install from GitHub (default):

pipx install --force 'git+https://github.com/NanashiTheNameless/OpenShockMCP.git@master'

Also available on PyPI:

pipx install nanashi-openshock-mcp

Install a specific tag or commit:

pipx install --force 'git+https://github.com/NanashiTheNameless/OpenShockMCP.git@0.0.1.6'

For local development from a checkout:

pipx install --editable /path/to/OpenShockMCP

Check install:

nanashi-openshock-mcp --version

Expected version:

0.0.1.6

First Run And Config Creation

The server uses a TOML config file. If no config exists, nanashi-openshock-mcp creates one automatically in the normal per-user config directory for your OS:

Windows: %APPDATA%\nanashi-openshock-mcp\config.toml
macOS:   ~/Library/Application Support/nanashi-openshock-mcp/config.toml
Linux:   ~/.config/nanashi-openshock-mcp/config.toml
Other:   ~/.config/nanashi-openshock-mcp/config.toml

If OPENSHOCK_API_KEY is set during first run, the generated config includes it and the server starts:

OPENSHOCK_API_KEY="your-api-key" nanashi-openshock-mcp

If no API key is available, the server creates a template config and exits. Edit openshock.api_key, then run it again.

Configuration

Default Config File

Generated config contents:

[server]
transport = "stdio"
host = "127.0.0.1"
port = 8000
path = "/mcp"
json_response = false

[openshock]
api_key = "your-api-key"
base_url = "https://api.openshock.app"
timeout = 15

[safety]
max_intensity = 100
max_duration_ms = 65535
require_confirmation = true

Config Lookup Order

Config lookup order:

  1. --config /path/to/config.toml
  2. $OPENSHOCK_MCP_CONFIG
  3. ./nanashi-openshock-mcp.toml
  4. OS user config path

On Unix-like systems, $XDG_CONFIG_HOME/nanashi-openshock-mcp/config.toml is used before ~/.config/nanashi-openshock-mcp/config.toml when XDG_CONFIG_HOME is set.

Environment Variable Overrides

Environment variables can override matching config values for automation. OPENSHOCK_USER_AGENT is env-only; User-Agent is not written to config files.

OPENSHOCK_API_KEY
OPENSHOCK_BASE_URL
OPENSHOCK_TIMEOUT
OPENSHOCK_USER_AGENT
OPENSHOCK_MCP_MAX_INTENSITY
OPENSHOCK_MCP_MAX_DURATION_MS
OPENSHOCK_MCP_REQUIRE_CONFIRMATION
OPENSHOCK_MCP_TRANSPORT
OPENSHOCK_MCP_HOST
OPENSHOCK_MCP_PORT
OPENSHOCK_MCP_PATH
OPENSHOCK_MCP_JSON_RESPONSE
OPENSHOCK_MCP_CONFIG

nanashi-openshock-mcp.toml is ignored by git so local secrets do not get committed. nanashi-openshock-mcp.example.toml is a safe template.

Running The Server

stdio is the default and recommended transport for desktop MCP clients. It does not open a network port.

Do not use stdio as an interactive terminal program. MCP clients launch it and send JSON-RPC over stdin. If you run nanashi-openshock-mcp directly in a terminal, it prints usage guidance instead of starting the protocol stream.

With explicit config:

nanashi-openshock-mcp --config ~/.config/nanashi-openshock-mcp/config.toml

On Windows PowerShell, pass a Windows path:

nanashi-openshock-mcp --config "$env:APPDATA\nanashi-openshock-mcp\config.toml"

Claude Desktop style config:

{
  "mcpServers": {
    "openshock": {
      "command": "nanashi-openshock-mcp",
      "args": ["--config", "/home/YOUR_USER/.config/nanashi-openshock-mcp/config.toml"]
    }
  }
}

HTTP (Only If Your Client Requires It)

Use streamable HTTP only when your MCP client needs an HTTP MCP endpoint. The server refuses non-loopback hosts such as 0.0.0.0 and LAN IP addresses.

nanashi-openshock-mcp \
  --transport streamable-http \
  --host 127.0.0.1 \
  --port 8765 \
  --config ~/.config/nanashi-openshock-mcp/config.toml

MCP endpoint:

http://127.0.0.1:8765/mcp

On startup, the server prints sanitized startup info to stderr:

nanashi-openshock-mcp 0.0.1.6 starting
transport: streamable-http
mcp endpoint: http://127.0.0.1:8765/mcp
config: /path/to/config.toml
api key configured: yes
safety: max_intensity=100, max_duration_ms=65535, require_confirmation=true

Stdio startup info also goes to stderr so stdout stays reserved for MCP JSON-RPC.

This is allowed:

nanashi-openshock-mcp --transport http --host 127.0.0.1

This is rejected:

nanashi-openshock-mcp --transport http --host 0.0.0.0

Tools

Read-only tools:

  • openshock_status: show sanitized config status. Does not reveal API key.
  • list_devices: list OpenShock devices.
  • get_device: get one device by ID.
  • list_shockers: list shockers, optionally filtered by device ID.
  • list_own_shockers: list owned hubs with their shockers.
  • list_shared_shockers: list shockers shared with this account.
  • list_shocker_shares: list users one shocker is shared with.
  • get_shocker: get one shocker by ID.

Action tools:

  • shock: shock one shocker, or use shocker_id="all".
  • vibrate: vibrate one shocker, or use shocker_id="all".
  • beep: beep one shocker, or use shocker_id="all".
  • stop: stop one shocker, or use shocker_id="all".

shock, vibrate, and beep require confirm=true by default. Keep require_confirmation = true unless you understand the risk. stop does not require confirmation.

Typical action arguments:

{
  "shocker_id": "your-shocker-id",
  "intensity": 25,
  "duration": 1000,
  "exclusive": false,
  "confirm": true
}

Limits:

  • intensity: 0 to 100, also capped by max_intensity
  • duration: 300 to 65535 ms, also capped by max_duration_ms

Security Model (Local Only)

  • stdio opens no network listener.
  • HTTP mode only accepts loopback bind hosts: 127.0.0.1, localhost, or ::1.
  • Non-loopback hosts are rejected before startup.
  • The MCP SDK enables DNS rebinding protection for loopback hosts.
  • API keys are read from local config or environment only.

Troubleshooting

OpenShock API key missing

Set [openshock].api_key in your config file, or set OPENSHOCK_API_KEY.

config file not found

The path passed to --config must exist. If you want default lookup, omit --config.

refusing non-loopback HTTP host

Use 127.0.0.1, localhost, or ::1. This project intentionally does not bind to LAN or public interfaces.

git not found during install

Install git. OpenShockPY is installed from GitHub main.

License

PolyForm Noncommercial License 1.0.0. See LICENSE.md.

Metadata

Release files for Nanashi-OpenShock-MCP 0.0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Nanashi-OpenShock-MCP 0.0.1.6
File Size Uploaded Provenance Actions
nanashi_openshock_mcp-0.0.1.6.tar.gz 14.3 kB With provenance Details for nanashi_openshock_mcp-0.0.1.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for Nanashi-OpenShock-MCP 0.0.1.6
File Interpreter ABI Platform Actions
nanashi_openshock_mcp-0.0.1.6-py3-none-any.whl Python 3 none any Details for nanashi_openshock_mcp-0.0.1.6-py3-none-any.whl

Total release size: 29.4 kB

Release files / nanashi_openshock_mcp-0.0.1.6.tar.gz

Download URL nanashi_openshock_mcp-0.0.1.6.tar.gz
Size 14.3 kB
Tags Source
SHA-256 checksum
How to use checksums
27ddcb36174cf649ccd428edd7300533ca102d2efef2af1d811ca02ab7565ee8
BLAKE2b-256 checksum
How to use checksums
083291f4640d0d783ae4b3242b241df348d293c56b0ec58ab3333450e010f01c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 23, 2026.

Transparency log

Release files / nanashi_openshock_mcp-0.0.1.6-py3-none-any.whl

Download URL nanashi_openshock_mcp-0.0.1.6-py3-none-any.whl
Size 15.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
072f5bff8bb1fd5c7138857f65ac623a297f8794aa1dadc2b3b180d892a21efe
BLAKE2b-256 checksum
How to use checksums
f7c99090d0a60084b9dbca195c195887f69e7d350c8e24d56ae6260d47111d33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 23, 2026.

Transparency log

Security for Nanashi-OpenShock-MCP 0.0.1.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for nanashi_openshock_mcp-0.0.1.6.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page