Mezcal ExplorerMezcalDocs
QuickstartBuildAgentsReference
Open explorer
Documentation homeQuickstartConceptsMonitor 10 Wallets
BuildLaunch MatrixAPIAdvanced UtilitiesAgent HTTP quickstartRate limitsRoute examplesSelf-serve account routesSDKTypeScript SDK

Live reference

Interactive API referenceReference hub
AgentsAgent CLIMCP Quickstart
Reference Hub
Docs/Agents/MCP Quickstart

MCP Quickstart

Connect Starkscan to Codex, Claude Code, and similar MCP clients without losing the app and API context.

API referenceReferenceQuickstartCLI

In this guide

Use this surface forTry in app firstCurrent external setupEnvironmentCodex setupCommon agent mistakes
Loading documentation content…
PreviousAgent CLIUse the Starkscan CLI for shell workflows, release validation, and local-first exports.NextReference HubChoose the right Starkscan reference surface and use the API reference as the canonical HTTP contract.

On this page

Use this surface forTry in app firstCurrent external setupEnvironmentCodex setupCommon agent mistakesClaude Code setupHosted MCP transportSmoke-test the remote MCP pathWhen not to start with MCP
Mezcal ExplorerMezcalDocumentation

One product surface across the explorer, HTTP API, CLI, SDK, and MCP transport. The docs should guide you into the right path instead of behaving like a separate app.

Open explorerAPI referenceBack to top

MCP quickstart

Use this guide when a tool-calling client needs Starkscan 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.

MCP is currently a beta surface. Check the Launch matrix before treating a launcher or hosted transport path as production-ready.

Use this surface for

  • Codex, Claude Code, and other tool-calling clients
  • workflows where an agent needs Starkscan tools instead of raw REST requests
  • reusing the same Starkscan API key surface while keeping rollout access bounded

Try in app first

Before you connect an agent, look at the same explorer surfaces on the current host:

  • Dashboard
  • Transactions
  • Contracts
  • Watchlist

That keeps the agent workflow grounded in the same product behavior that Starkscan users actually see.

Current external setup

Today the cleanest setup is:

  1. export the same MEZCAL_* variables used by REST and CLI
  2. let the AI client launch npx -y @mezcal/cli@alpha mcp serve --transport remote
  3. install the CLI from the Agent CLI guide only when you want a pinned local binary

The public product name is Starkscan, but the current CLI command, package names, and MEZCAL_* environment variables remain compatibility names. Do not invent STARKSCAN_* CLI variables unless this page documents them.

Environment

export MEZCAL_BASE_URL="https://<your-mezcal-host>/api"
export MEZCAL_API_KEY="mzk_live_your_key_here"
export MEZCAL_CHAIN="SN_MAIN"

Codex setup

codex mcp add mezcal \
  --env MEZCAL_BASE_URL=$MEZCAL_BASE_URL \
  --env MEZCAL_API_KEY=$MEZCAL_API_KEY \
  --env MEZCAL_CHAIN=$MEZCAL_CHAIN \
  -- npx -y @mezcal/cli@alpha mcp serve --transport remote

Useful starter tools for Starkscan agent workflows:

  • status
  • block_detail
  • block_transactions
  • token_total_supply
  • token_balance_of
  • token_transfers

Common agent mistakes

  • search 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, truncated=false, and completeness.reasonCode="complete".
  • On very active wallets, separate 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 Code setup

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 -- npx -y @mezcal/cli@alpha mcp serve --transport remote

Check that Claude Code sees it:

claude mcp list

Hosted MCP transport

Starkscan 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 {baseUrl}/mcp accepts one JSON-RPC message per request
  • inline JSON responses return as application/json
  • notifications and JSON-RPC responses return 202 Accepted
  • GET {baseUrl}/mcp returns 405 Method Not Allowed

Smoke-test the remote MCP path

MEZCAL_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:

  • initialize
  • notifications/initialized
  • tools/list
  • tools/call for __mezcal_init__
  • tools/call for status
  • tools/call for block_detail

When not to start with MCP

  • Use the REST API for direct service integrations.
  • Use the SDK for typed application code.
  • Use the CLI when you need explicit commands and local exports.
  • Stay in the explorer app when the job is visual investigation rather than tool-calling.