Skip to main content

@helixid/mcp

HelixID middleware for Model Context Protocol servers — inbound presentation verification — and a client-side helper for attaching a presentation to an outbound tool call.

npm install @helixid/mcp

@modelcontextprotocol/sdk is declared as an optional peer dependency, so installing HelixID does not force an MCP dependency on projects that do not use it.

Exports

ExportPurpose
attachHelixVP(toolCall, options)Client-side helper that loads the wallet, signs a VP, and attaches _helixVP to the MCP tool input.
helixidMCPMiddleware(options)Server-side middleware that requires _helixVP, verifies it, and enforces optional scopes.

Options

AttachHelixVPOptions

OptionRequiredPurpose
walletPassphraseYesPassphrase for the encrypted wallet file
walletFilePathYesPath to the wallet
targetServiceYesBinds the VP to one verifier
userDidNoThe user on whose behalf the agent is acting

MCPMiddlewareOptions

OptionRequiredPurpose
requiredScopesNoScopes the caller must hold for the tool to run
allowSelfSignedNoAccept self-issued credentials. Defaults to false. Development only.

Usage

import { attachHelixVP, helixidMCPMiddleware } from '@helixid/mcp';

const requireHelix = helixidMCPMiddleware({
requiredScopes: ['read:orders'],
});

const outboundCall = await attachHelixVP(
{ name: 'orders.lookup', input: { orderId: 'ORD-1001' } },
{
walletPassphrase: process.env.WALLET_PASSPHRASE!,
walletFilePath: './agent-wallet.enc',
userDid: 'did:web:user.example.com',
targetService: 'orders',
},
);

A tool call arriving without a valid _helixVP is refused before the tool runs. See MCP Integration for the full wiring, and Demo B for it running against a real LLM agent.