Labsco
soyrubio logo

MCP Sourcify Server

โ˜… 1

from soyrubio

Verify and retrieve smart contract source code using the Sourcify API.

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedFreeAdvanced setup

MCP Sourcify Server

A Model Context Protocol (MCP) server that provides tools for interacting with the Sourcify API to verify and retrieve smart contract source code.

Overview

This MCP server enables LLMs to interact with Sourcify, a decentralized repository of verified smart contract source code. It provides tools to check contract verification status, retrieve source code, and access contract metadata across multiple blockchain networks.

Features

  • Check Contract Verification: Verify if a contract is registered on Sourcify
  • Get Contract Source: Retrieve the complete source code of verified contracts
  • Get Contract Metadata: Access compiler settings and ABI information
  • Batch Verification: Check multiple contracts in a single request

Available Tools

1. check-contract

Check if a contract is verified on Sourcify.

Parameters:

  • chainId (number): The blockchain chain ID
  • address (string): The contract address to check

Returns: Verification status (perfect, partial, or false)

2. get-contract-source

Retrieve the source code of a verified contract.

Parameters:

  • chainId (number): The blockchain chain ID
  • address (string): The contract address

Returns: Object with file names as keys and source code as values

3. get-contract-metadata

Get the metadata of a verified contract including compiler settings and ABI.

Parameters:

  • chainId (number): The blockchain chain ID
  • address (string): The contract address

Returns: Contract metadata including compiler version, ABI, and settings

4. check-multiple-contracts

Check verification status for multiple contracts at once.

Parameters:

  • chainId (number): The blockchain chain ID
  • addresses (array): Array of contract addresses to check

Returns: Array of verification statuses

Supported Networks

This server supports all networks that are supported by Sourcify. Common chain IDs include:

  • Ethereum Mainnet: 1
  • Goerli: 5
  • Polygon: 137
  • Arbitrum: 42161
  • Optimism: 10
  • BSC: 56

For a complete list, visit Sourcify's supported chains.

Development

# Watch mode for development
npm run watch

# Build the project
npm run build

# Run type checking
tsc --noEmit

Error Handling

The server includes comprehensive error handling for:

  • Invalid contract addresses
  • Unsupported chain IDs
  • Network timeouts
  • Contracts not found in Sourcify