MCP Quickstart
Connect Mezcal to Codex, Claude Code, and similar MCP clients without losing the app and API context.
Connect Mezcal to Codex, Claude Code, and similar MCP clients without losing the app and API context.
Use this guide when a tool-calling client needs Mezcal over MCP. Do not start here if a normal service can call HTTP directly or if a human operator is better served by the CLI.
Before you connect an agent, look at the same explorer surfaces on the current host:
That keeps the agent workflow grounded in the same product behavior that Mezcal users actually see.
Today the cleanest setup is:
mezcal CLI using the Agent CLI guideMEZCAL_* variables used by REST and CLImezcal mcp serve --transport remoteexport MEZCAL_BASE_URL="https://<your-mezcal-host>/api"
export MEZCAL_API_KEY="mzk_test_your_key_here"
export MEZCAL_CHAIN="SN_MAIN"
codex mcp add mezcal \
--env MEZCAL_BASE_URL=$MEZCAL_BASE_URL \
--env MEZCAL_API_KEY=$MEZCAL_API_KEY \
--env MEZCAL_CHAIN=$MEZCAL_CHAIN \
-- mezcal mcp serve --transport remote
Useful starter tools for Mezcal replacement workflows:
statustoken_total_supplytoken_balance_oftoken_transferssearch is identifier-first, not ticker or symbol search, and some responses normalize into canonical padded felt forms.contract_entrypoints is broader than contract_read; for read, prefer selectors with stateMutability=view and pass required calldata.address_token_holdings is the wallet-screening surface. Treat it as complete only when exact=true and truncated=false.latest calls to holdings and token_balance_of can drift numerically if the chain moved between requests. Missing a core-token row on a completed holdings response is the stronger bug signal.claude mcp add --scope project --transport stdio \
--env MEZCAL_BASE_URL=$MEZCAL_BASE_URL \
--env 'MEZCAL_API_KEY=${MEZCAL_API_KEY}' \
--env MEZCAL_CHAIN=$MEZCAL_CHAIN \
mezcal -- mezcal mcp serve --transport remote
Check that Claude Code sees it:
claude mcp list
Mezcal also exposes a native HTTP MCP endpoint at:
{baseUrl}/mcp (for hosted external clients, this resolves to /api/mcp)This is documented here instead of the REST reference because it is a JSON-RPC transport, not the normal explorer HTTP surface.
Current behavior:
POST /mcp accepts one JSON-RPC message per requestapplication/json202 AcceptedGET /mcp returns 405 Method Not AllowedMEZCAL_BASE_URL="https://<your-mezcal-host>/api" \
MEZCAL_API_KEY="$MEZCAL_API_KEY" \
./rust-exp/scripts/release-mcp-remote-smoke.sh
This exercises a real JSON-RPC session over stdio:
initializenotifications/initializedtools/listtools/call for __mezcal_init__tools/call for statustools/call for block_detail