Skip to main content
Glama
ahnlabio

BICScan MCP Server

by ahnlabio

get_assets

Retrieve cryptocurrency asset holdings for blockchain addresses, including EOAs, contracts, and domain names, to analyze portfolio composition.

Instructions

Get Assets holdings by CryptoAddress

Args:
    address: EOA, CA, ENS, CNS, KNS.
Returns:
    Dict: where assets is a list of assets

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYes

Implementation Reference

  • The main handler function for the get_assets MCP tool. It is decorated with @mcp.tool() for registration and implements the logic to query the BICScan API for assets held by the given address.
    @mcp.tool()
    async def get_assets(address: str) -> dict:
        """Get Assets holdings by CryptoAddress
    
        Args:
            address: EOA, CA, ENS, CNS, KNS.
        Returns:
            Dict: where assets is a list of assets
        """
    
        logger.info(f"Getting assets for address: {address}")
        endpoint = "/v1/scan"
        data = {
            "query": address,
            "sync": True,
            "assets": True,
            "engines": ["ofac"],
        }
    
        return await post_request(endpoint, data=data)
  • Supporting helper function used by get_assets (and other tools) to perform authenticated POST requests to the BICScan API, handling errors and logging.
    async def post_request(
        endpoint: str, data: dict[str, Any] | None = None
    ) -> dict[str, Any] | None:
        """Make a request to BICScan API with proper error handling."""
        headers = {
            "User-Agent": "bicscan-mcp/1.0",
            "Accept": "application/json",
            "X-Api-Key": BICSCAN_API_KEY,
        }
        url = urljoin(BICSCAN_API_BASE, endpoint)
    
        async with httpx.AsyncClient() as client:
            try:
                logger.info(f"Making request to {url}")
                logger.debug(f"{headers=} {data=}")
                response = await client.post(url, headers=headers, json=data, timeout=30)
                response.raise_for_status()
                logger.info(f"Received response: {response.status_code}")
                return response.json()
            except httpx.HTTPStatusError as http_err:
                logger.error(f"Received response: {http_err}, {response.text}")
                return response.json()
            except Exception as e:
                logger.exception(f"Received response: {e}, {response.text}")
                return {}
Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ahnlabio/bicscan-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server