Registry / testing / mountebank-grpc-mts

mountebank-grpc-mts

JSON →
library0.4.1jsnpmunverified

Custom gRPC protocol implementation for Mountebank, allowing gRPC service mocking and proxying. Current version 0.4.1, updated sporadically. Uses nodejs, google-protobuf, and @grpc/proto-loader to generate gRPC descriptors from .proto files. Does not support reflection. Supports unary, server-streaming, client-streaming, and bidirectional streaming, as well as Mountebank proxy functionality. Key differentiator: adds gRPC protocol support to Mountebank, enabling gRPC stub and proxy creation without a separate tool.

npm install mountebank-grpc-mts
INSTALL
IMPORT
SIG · MOUNTEBANK-GRPC-MT
M
mountebank-grpc-mts
testingjavascriptv0.4.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

mb-grpc
npx mb-grpc
require('mountebank-grpc-mts')
This package provides a CLI tool, not a JavaScript module. Use the command directly or via package.json scripts.
createCommand
"createCommand": "mb-grpc" in protocols.json
"createCommand": "mountebank-grpc-mts"
The createCommand must be 'mb-grpc' (the CLI binary), not the npm package name.
services
Use JSON object keyed by fully qualified service name (e.g., 'example.ExampleService') in imposter definition
Using service name without package prefix or mismatched with proto file
The service key must match exactly the package.ServiceName as defined in the .proto file.

Shows minimal setup: installing packages, creating protocols.json, starting mountebank with gRPC protocol, and creating a simple gRPC imposter that mocks a unary RPC.

mkdir mountebank-grpc-example && cd mountebank-grpc-example npm init -y npm install mountebank mountebank-grpc-mts # Create protocols.json echo '{ "grpc": { "createCommand": "mb-grpc" } }' > protocols.json # Start mountebank with gRPC protocol npx mb start --protofile protocols.json --loglevel debug & # Create example.proto (minimal) echo 'syntax = "proto3"; package example; service ExampleService { rpc UnaryUnary (ExampleRequest) returns (ExampleResponse); } message ExampleRequest { string name = 1; } message ExampleResponse { string greeting = 1; }' > example.proto # Create imposter (replace with your mountebank port, default 2525) curl -X POST http://localhost:2525/imposters -H 'Content-Type: application/json' -d '{ "protocol": "grpc", "port": 50051, "services": { "example.ExampleService": { "file": "'$(pwd)'/example.proto" } }, "stubs": [{ "predicates": [{"matches": {"path": "UnaryUnary"}}], "responses": [{"is": {"value": {"greeting": "Hello from mock"}} }] }] }' echo "gRPC mock running on port 50051"
Debug
Known issues
gotchaThe package is a CLI tool, not a library. Attempting to require() it will fail.
fix
Use the command line e.g., npx mb-grpc, or specify in protocols.json as createCommand: "mb-grpc".
affects: all
breakingThe package does not support gRPC reflection. Service definitions must be provided via .proto files.
fix
Provide .proto files in the 'services' field of the imposter definition.
affects: <=0.4.1
gotchaThe 'services' key in imposter JSON must be the fully qualified service name (e.g., 'package.ServiceName'), not just 'ServiceName'.
fix
Check your .proto for the package name and service name, and use 'package.ServiceName'.
affects: all
deprecatedThis package (mountebank-grpc-mts) is an older fork; the main package is mountebank-grpc.
fix
Consider using mountebank-grpc directly from npm if it supports your use case.
affects: all
Errors
Common errors & fixes
Error: ENOENT: no such file or directory, open '.../example.proto'
The file path in the imposter JSON is relative to the working directory, but the path is incorrect or the proto file doesn't exist.
fix
Use an absolute path for the 'file' field, or ensure the relative path is correct relative to where mountebank is started.
Error: Could not load service: example.ExampleService. Make sure the service name is correct and the proto file exists.
The service name in the imposter JSON does not match the package and service defined in the .proto file.
fix
Verify that the 'services' key exactly matches 'package.ServiceName' as declared in your .proto, and that the 'file' path is correct.
Error: Cannot find module 'mountebank-grpc-mts'
The package is not installed globally or locally, or the command 'mb-grpc' is not in PATH.
fix
Install the package locally: npm install mountebank-grpc-mts, and run via npx mb-grpc or ensure node_modules/.bin is in PATH.
Upgrade
Version history
0.4.1latest on npm
Audit
Dependencies
mountebankrequiredmountebank-grpc is a protocol extension for Mountebank; must be running to use.
@grpc/proto-loaderrequiredUsed for loading .proto files and generating gRPC service descriptors.
google-protobufrequiredRequired for serializing/deserializing protobuf messages used by gRPC stubs.
Agent activity
2 hits · last 30 days
node
2
Resources
mountebank-grpc-mts — npm install mountebank-grpc-mts · libregistry