{"id":48602,"library":"mountebank-grpc-mts","title":"mountebank-grpc","description":"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.","status":"active","version":"0.4.1","language":"javascript","source_language":"en","source_url":null,"tags":["javascript"],"install":[{"cmd":"npm install mountebank-grpc-mts","lang":"bash","label":"npm"},{"cmd":"yarn add mountebank-grpc-mts","lang":"bash","label":"yarn"},{"cmd":"pnpm add mountebank-grpc-mts","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"mountebank-grpc is a protocol extension for Mountebank; must be running to use.","package":"mountebank","optional":false},{"reason":"Used for loading .proto files and generating gRPC service descriptors.","package":"@grpc/proto-loader","optional":false},{"reason":"Required for serializing/deserializing protobuf messages used by gRPC stubs.","package":"google-protobuf","optional":false}],"imports":[{"note":"This package provides a CLI tool, not a JavaScript module. Use the command directly or via package.json scripts.","wrong":"require('mountebank-grpc-mts')","symbol":"mb-grpc","correct":"npx mb-grpc"},{"note":"The createCommand must be 'mb-grpc' (the CLI binary), not the npm package name.","wrong":"\"createCommand\": \"mountebank-grpc-mts\"","symbol":"createCommand","correct":"\"createCommand\": \"mb-grpc\" in protocols.json"},{"note":"The service key must match exactly the package.ServiceName as defined in the .proto file.","wrong":"Using service name without package prefix or mismatched with proto file","symbol":"services","correct":"Use JSON object keyed by fully qualified service name (e.g., 'example.ExampleService') in imposter definition"}],"quickstart":{"code":"mkdir mountebank-grpc-example && cd mountebank-grpc-example\nnpm init -y\nnpm install mountebank mountebank-grpc-mts\n\n# Create protocols.json\necho '{\n    \"grpc\": {\n        \"createCommand\": \"mb-grpc\"\n    }\n}' > protocols.json\n\n# Start mountebank with gRPC protocol\nnpx mb start --protofile protocols.json --loglevel debug &\n\n# Create example.proto (minimal)\necho 'syntax = \"proto3\";\npackage example;\nservice ExampleService {\n    rpc UnaryUnary (ExampleRequest) returns (ExampleResponse);\n}\nmessage ExampleRequest {\n    string name = 1;\n}\nmessage ExampleResponse {\n    string greeting = 1;\n}' > example.proto\n\n# Create imposter (replace with your mountebank port, default 2525)\ncurl -X POST http://localhost:2525/imposters -H 'Content-Type: application/json' -d '{\n    \"protocol\": \"grpc\",\n    \"port\": 50051,\n    \"services\": {\n        \"example.ExampleService\": {\n            \"file\": \"'$(pwd)'/example.proto\"\n        }\n    },\n    \"stubs\": [{\n        \"predicates\": [{\"matches\": {\"path\": \"UnaryUnary\"}}],\n        \"responses\": [{\"is\": {\"value\": {\"greeting\": \"Hello from mock\"}} }]\n    }]\n}'\n\necho \"gRPC mock running on port 50051\"","lang":"typescript","description":"Shows minimal setup: installing packages, creating protocols.json, starting mountebank with gRPC protocol, and creating a simple gRPC imposter that mocks a unary RPC."},"warnings":[{"fix":"Use the command line e.g., npx mb-grpc, or specify in protocols.json as createCommand: \"mb-grpc\".","message":"The package is a CLI tool, not a library. Attempting to require() it will fail.","severity":"gotcha","affected_versions":"all"},{"fix":"Provide .proto files in the 'services' field of the imposter definition.","message":"The package does not support gRPC reflection. Service definitions must be provided via .proto files.","severity":"breaking","affected_versions":"<=0.4.1"},{"fix":"Check your .proto for the package name and service name, and use 'package.ServiceName'.","message":"The 'services' key in imposter JSON must be the fully qualified service name (e.g., 'package.ServiceName'), not just 'ServiceName'.","severity":"gotcha","affected_versions":"all"},{"fix":"Consider using mountebank-grpc directly from npm if it supports your use case.","message":"This package (mountebank-grpc-mts) is an older fork; the main package is mountebank-grpc.","severity":"deprecated","affected_versions":"all"}],"env_vars":null,"search_vec":"'0.4.1':18 'add':58 'allow':10 'bidirect':48 'client':45 'client-stream':44 'creation':69 'current':16 'custom':4 'descriptor':31 'differenti':57 'enabl':64 'file':34 'function':55 'generat':29 'googl':24 'google-protobuf':23 'grpc':3,5,11,30,59,65 'grpc/proto-loader':27 'implement':7 'javascript':74 'key':56 'mock':13 'mountebank':2,9,53,63 'mountebank-grpc':1 'nodej':22 'proto':33 'protobuf':25 'protocol':6,60 'proxi':15,54,68 'reflect':38 'separ':72 'server':42 'server-stream':41 'servic':12 'sporad':20 'stream':43,46,49 'stub':66 'support':37,39,61 'tool':73 'unari':40 'updat':19 'use':21 'version':17 'well':51 'without':70","created_at":"2026-06-07T16:57:29.021072+00:00","updated_at":"2026-06-07T16:57:29.021072+00:00","problems":[{"fix":"Use an absolute path for the 'file' field, or ensure the relative path is correct relative to where mountebank is started.","cause":"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.","error":"Error: ENOENT: no such file or directory, open '.../example.proto'"},{"fix":"Verify that the 'services' key exactly matches 'package.ServiceName' as declared in your .proto, and that the 'file' path is correct.","cause":"The service name in the imposter JSON does not match the package and service defined in the .proto file.","error":"Error: Could not load service: example.ExampleService. Make sure the service name is correct and the proto file exists."},{"fix":"Install the package locally: npm install mountebank-grpc-mts, and run via npx mb-grpc or ensure node_modules/.bin is in PATH.","cause":"The package is not installed globally or locally, or the command 'mb-grpc' is not in PATH.","error":"Error: Cannot find module 'mountebank-grpc-mts'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"mountebank-grpc-mts","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}