Generate bindings with the CLI
Build a typed-ABI tarball with gma generate.
gma generate reads your contract artifacts and produces a typed-ABI npm package (currently target: viem) as a .tgz tarball under output (default ./gma-out). It runs entirely on your machine and does not require a GitMyABI account.
Typical flow
gma init # one-time, creates gma.config.json
forge build # or: npx hardhat compile
gma generate # writes ./gma-out/<name>-<version>.tgzSource frameworks
- Foundry. Reads compiled artifacts;
*.t.soland*.s.solare filtered out automatically. - Hardhat. Reads compiled artifacts after
npx hardhat compile. - Raw ABIs. With
--framework abis, pass--abisor setabisin the config to a list of files, directories, or globs.
Flags
--framework <auto|foundry|hardhat|abis>— defaults toauto.--abis <paths>— comma-separated list of files, directories, or globs.--out <dir>— override the output directory.--package-name <name>,--package-version <version>,--project-name <name>— override metadata.--target <viem>— codegen target (currentlyviem).--include-empty-abis— keep contracts whose ABI is empty (interfaces, libraries).--generate-mcp— also emit a companion MCP server package (stdio transport, depends on the bindings package). The codegen package is currently a preview release.--mcp-allow-writes— include write tools in the MCP server (the default is read-only).--publish,--registry <url>,--token <token>,--access <public|restricted>,--tag <tag>,--dry-run— publish the generated tarball in one step (see gma publish for the underlying behavior).--profile <name>— profile name used to read saved registry / npm credentials.
Output
A successful run prints the resolved package name, version, and tarball path under output. When --generate-mcp is set, the companion MCP package is written alongside it and printed on a second line.
One-shot generate and publish
gma generate --publish \
--registry https://registry.npmjs.org \
--token "$NPM_TOKEN"With --publish, the CLI uploads the generated tarball after building it. Use --dry-run to print what would happen without contacting the registry.
Related
- CLI overview
What the gma CLI does and when to use it.
- Init and configuration
Run gma init and configure gma.config.json fields and precedence.
- Publish bindings with the CLI
Use gma publish to upload a bindings tarball to npm.
- Generated contract bindings
TypeScript packages produced from contract ABIs for typed integration.
- Package format
Shape of the published bindings package and the CDN-hosted ABI artifacts.