New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

mcp-secure

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mcp-secure

MCPS -- MCP Secure. Cryptographic identity, message signing, and trust verification for the Model Context Protocol.

latest
Source
npmnpm
Version
1.2.2
Version published
Maintainers
1
Created
Source

MCPS -- MCP Secure

trust

The HTTPS of the agent era. Cryptographic identity, message signing, and trust verification for the Model Context Protocol.

npm npm downloads PyPI license IETF Draft Tests License Zero Dependencies

Try it live in your browser -- no install needed

Generate keys, create passports, sign messages, verify signatures, and test tamper detection -- all client-side using Web Crypto API.

The Problem

MCP has no identity layer. Any agent can call any tool. No signatures. No revocation. No tamper detection.

Real CVEs exist (CVSS 9.6). OWASP created an entire Top 10 for MCP risks. 82% of MCP servers have path traversal vulnerabilities.

MCP is HTTP. MCPS is HTTPS.

How It Works

Agent                          MCP Server
  |                                |
  |-- 1. Generate ECDSA keys ----> |
  |-- 2. Create passport --------> |
  |                                |
  |== Signed JSON-RPC envelope ===>|
  |   {                            |
  |     mcps: {                    |
  |       version: "1.0",          |  3. Verify signature
  |       passport_id: "asp_...",  |  4. Check passport not revoked
  |       nonce: "abc123",         |  5. Reject if replayed
  |       timestamp: "2026-...",   |  6. Check trust level >= min
  |       signature: "base64..."   |
  |     },                         |
  |     jsonrpc: "2.0",            |
  |     method: "tools/call",      |
  |     params: { ... }            |
  |   }                            |
  |                                |
  |<====== Signed response ========|

Every message is wrapped in a signed envelope. Tamper any field -- the signature breaks. Replay a message -- the nonce is rejected. Revoke an agent -- instant cutoff.

Try It in 30 Seconds

npm install mcp-secure
const mcps = require('mcp-secure');

// 1. Generate keys (ECDSA P-256)
const keys = mcps.generateKeyPair();

// 2. Create a passport for your agent
const passport = mcps.createPassport({
  name: 'my-agent',
  version: '1.0.0',
  publicKey: keys.publicKey,
});

// 3. Sign an MCP message
const envelope = mcps.signMessage(
  { jsonrpc: '2.0', method: 'tools/call', params: { name: 'read_file' } },
  passport.passport_id,
  keys.privateKey
);

// 4. Verify on the receiving end
const result = mcps.verifyMessage(envelope, keys.publicKey);
console.log(result.valid); // true

// 5. Tamper detection -- change anything, signature breaks
envelope.params.name = 'delete_everything';
const tampered = mcps.verifyMessage(envelope, keys.publicKey);
console.log(tampered.valid); // false

Python:

pip install mcp-secure
from mcp_secure import generate_key_pair, create_passport, sign_message, verify_message

keys = generate_key_pair()
passport = create_passport(name="my-agent", version="1.0.0", public_key=keys["public_key"])
envelope = sign_message({"jsonrpc": "2.0", "method": "tools/call"}, passport["passport_id"], keys["private_key"])
result = verify_message(envelope, keys["public_key"])
assert result["valid"] is True

Interactive playground: agentsign.dev/playground -- try it in the browser, no install needed.

Wrap Any MCP Server (2 Lines)

const { secureMCP } = require('mcp-secure');

const server = secureMCP(myMCPServer, {
  passport: 'asp_abc123',
  privateKey: process.env.MCPS_PRIVATE_KEY,
  trustAuthority: 'https://agentsign.dev',
  minTrustLevel: 2,
});

Every incoming MCP call is now verified: passport checked, signature validated, replay blocked, audit logged.

What MCPS Adds

FeatureWhat It Does
Agent PassportsECDSA P-256 signed identity credentials -- agents carry proof of who they are
Message SigningEvery JSON-RPC message wrapped in a signed envelope with nonce + timestamp
Tool IntegritySigned tool definitions prevent poisoning and rug pulls
Model IntegritySigned model metadata prevents tampering, backdoors, and version swaps
Transcript BindingAnti-downgrade binding -- cryptographically binds handshake parameters to prevent capability stripping
Replay ProtectionNonce + 5-minute timestamp window blocks replay attacks
RevocationReal-time passport revocation via Trust Authority
Trust LevelsL0 (unsigned) through L4 (audited) -- progressive security
Version NegotiationClient and server agree on protocol version at handshake
Issuer ChainsDelegated trust -- Trust Authority signs a passport, that passport signs sub-agents

Trust Levels

L0  Unsigned     Plain MCP, no MCPS
L1  Identified   Passport presented
L2  Verified     Passport verified + not revoked
L3  Scanned      Verified + passed OWASP security scan
L4  Audited      Scanned + manual audit by Trust Authority

Use minTrustLevel to set the floor. An L2 server rejects L0/L1 agents. An L4 server only accepts fully audited agents.

Tool Integrity (Prevents Tool Poisoning)

// Author signs their tool definition
const sig = mcps.signTool(myTool, authorPrivateKey);

// Client verifies before calling -- detects tampering
const safe = mcps.verifyTool(myTool, sig, authorPublicKey);
// If someone changed the tool description (tool poisoning), this returns false

Tool poisoning is MCP03 in the OWASP Top 10. This is the fix.

Model Integrity (Prevents Backdoored Models)

const fs = require('fs');

// Hash the model file (streams -- won't load 8GB into memory)
const fileHash = await mcps.hashModelFile('./llama-3-8b.safetensors');

// Sign the model metadata
const sig = mcps.signModel({
  name: 'llama-3-8b',
  version: '1.0.0',
  format: 'safetensors',
  fileHash,
  source: 'https://huggingface.co/meta-llama/Llama-3-8B',
  license: 'llama3',
  parameterCount: 8000000000,
}, privateKey, 'meta-llama');

// Consumer verifies before loading -- detects tampering
const result = mcps.verifyModel(
  { name: 'llama-3-8b', version: '1.0.0', format: 'safetensors', fileHash },
  sig.signature, publisherPublicKey, sig.model_hash, 'meta-llama'
);
// result.valid === true (model is authentic)
// result.hash_changed === false (matches pinned hash)

Model supply chain attacks are real -- poisoned weights on Hugging Face, backdoored fine-tunes, version swaps. signModel makes model files signed artifacts with cryptographic provenance.

Transcript Binding (Anti-Downgrade)

// Both sides sign the agreed security parameters after handshake
const binding = mcps.createTranscriptBinding(clientInitParams, serverInitResult, keys.privateKey);

// Verify the other party's binding -- detects capability stripping attacks
const result = mcps.verifyTranscriptBinding(
  binding.transcript_hash, binding.transcript_signature,
  keys.publicKey, clientInitParams, serverInitResult
);
console.log(result.valid); // true

OWASP MCP Top 10 Coverage

MCPS mitigates 8 of 10 OWASP MCP risks:

OWASP RiskMCPS Mitigation
MCP01: Token MismanagementPassport-based identity replaces long-lived tokens
MCP03: Tool PoisoningTool integrity signatures
MCP04: Supply ChainSigned tool definitions + scan results in passport
MCP06: Intent Flow SubversionSigned messages prevent manipulation
MCP07: Insufficient AuthPassport verification on every connection
MCP08: Lack of AuditSigned audit trail with every call
MCP09: Shadow ServersOnly passported agents accepted
MCP10: Context InjectionEnvelope isolation prevents cross-session leakage

Error Codes

CodeMeaning
MCPS-001Invalid passport format
MCPS-002Passport expired
MCPS-003Passport revoked
MCPS-004Invalid message signature
MCPS-005Replay attack detected
MCPS-006Timestamp out of window
MCPS-007Trust authority unreachable
MCPS-008Tool signature mismatch
MCPS-009Insufficient trust level
MCPS-010Rate limit exceeded
MCPS-011Origin mismatch
MCPS-012Transcript binding verification failed
MCPS-013Passport exceeds maximum size
MCPS-014Issuer chain exceeds maximum depth
MCPS-015No mutually supported MCPS version

Technical Details

  • Signing: ECDSA P-256 (NIST FIPS 186-5)
  • Signature format: IEEE P1363 fixed-length r||s (RFC 7518 Section 3.4)
  • Low-S normalization: BIP-0062 signature malleability prevention
  • Canonicalization: RFC 8785 JSON Canonicalization Scheme
  • Nonce: 16 bytes cryptographic random (128-bit)
  • Timestamp window: 5 minutes (configurable)
  • Passport format: asp_ prefix + 32 hex chars
  • Node.js: Zero dependencies (pure crypto built-in)
  • Python: Single dependency (cryptography)
  • 75 tests: Covering all cryptographic operations, edge cases, and attack vectors

Specification

On-Premise

Run your own Trust Authority. Nothing phones home.

docker run -p 8080:8080 agentsign/server

License

BSL 1.1 (Business Source License). Patent pending (GB2604808.2).

Free for non-commercial use including security research, education, and internal testing. Commercial use requires a license. Contact: contact@agentsign.dev

Built by CyberSecAI Ltd.

Keywords

mcp

FAQs

Package last updated on 05 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts