Skip to content

MCP Server API

Package: @dilithia-mcp/contracts

This MCP server exposes contract-tools for contract-development workflows. It is intentionally separate from the chain MCP surface because it brings in the full compilation toolchain.

Tools

Filesystem and build tools

  • init_contract Input: name, optional directory
  • build_contract Input: optional path, optional release, optional optimize

build_contract maps to dilithia-contract build and returns build metadata rather than only a success flag.

Chain write tools

These tools are only safe to enable in trusted environments:

  • deploy_contract Input: name, wasm, rpc, secretKey, optional chainId, optional nonce, optional workdir
  • upgrade_contract Input: name, wasm, rpc, secretKey, optional chainId, optional nonce, optional workdir
  • call_contract Input: contract, method, optional args, rpc, secretKey, optional chainId, optional nonce, optional wait, optional workdir
  • query_contract Input: contract, method, optional args, rpc, optional workdir

Environment variables

  • DILITHIA_CONTRACT_BINARY
  • DILITHIA_CONTRACT_MCP_WORKDIR
  • DILITHIA_CONTRACT_MCP_ENABLE_FILESYSTEM_TOOLS
  • DILITHIA_CONTRACT_MCP_ENABLE_CHAIN_WRITE_TOOLS

Operational notes

  • This server is for contract developers and autonomous build/deploy agents.
  • It should not be mixed into a lightweight chain-operator MCP unless you intentionally want Cargo, WASM tooling, and local filesystem writes in that environment.
  • For remote execution, prefer the REST service in contract-tools-rest rather than exposing raw toolchain execution to every MCP client.