API & MCP
Everything a person can do on Shamir Secret Sharing, a program or AI agent can do with the same inputs and get the identical result.
HTTP API
POST https://shamirsecretsharing.usefulweb.site/api/v1/calculate– run Shamir Secret SharingGET https://shamirsecretsharing.usefulweb.site/api/v1/tool– inputs, output schema, examples- OpenAPI 3.1: /openapi.json · /openapi.yaml
- Errors:
application/problem+json;422includes per-fielderrors.
Shamir Secret Sharing
Splits a secret (recovery code, password, key) into n shares with a threshold k using Shamir's scheme over GF(256): any k shares reconstruct it, fewer reveal nothing. Combines and verifies shares with an optional checksum.
| Field | Type | Default | Description |
|---|---|---|---|
action | select (split, combine) | "split" | Action |
secret | textarea | — | Secret (split). Text up to 10,000 characters (UTF-8). |
shares | integer | 5 | Number of shares (n) |
threshold | integer | 3 | Threshold (k shares needed). Split: any k shares recover the secret. Combine: used to check extra shares for consistency. |
format | select (hex, base64) | "hex" | Share format |
checksum | boolean | true | Add a 4-byte SHA-256 checksum so wrong or too few shares are detected |
sharesInput | textarea | — | Shares (combine), one per line |
seed | text | — | Demo seed (optional, reproducible — never for real secrets). Split only. With a seed the shares are predictable; leave empty for real use. |
Example request
Split a recovery code into 5 shares, any 3 recover it (demo seed)
curl -X POST https://shamirsecretsharing.usefulweb.site/api/v1/calculate -H 'content-type: application/json' -d '{"action":"split","secret":"correct horse battery staple","shares":5,"threshold":3,"seed":"demo"}'
Every result contains
inputs (normalised, defaults applied), summary, result (validated against the published schema), units, assumptions, sources, warnings, computedAt and links.
MCP (Model Context Protocol)
- Streamable HTTP endpoint:
https://shamirsecretsharing.usefulweb.site/mcp– protocol revisions 2026-07-28 (stateless) and 2025-11-25 / 2025-06-18 / 2025-03-26 (initialize handshake). - Tools:
shamir_secret_sharing - Local stdio connector:
node src/mcp-stdio.ts --tool=shamir-secret-sharing
{
"mcpServers": {
"shamir-secret-sharing": { "type": "http", "url": "https://shamirsecretsharing.usefulweb.site/mcp" }
}
}