Starknet MCP Server enables AI model interaction with Starknet blockchain for blockchain data access and smart contract integration
Starknet MCP Server is an essential component in the Model Context Protocol (MCP) ecosystem, serving as a bridge between AI applications and various data sources and tools within the Starknet infrastructure. This server enables developers to connect their AI applications like Claude Desktop, Continue, Cursor, and others with Starknet through a standardized protocol, ensuring seamless integration and efficient interaction.
Starknet MCP Server offers several key features that make it an indispensable tool for integrating AI applications into the Starknet network. These include:
The architecture of Starknet MCP Server is designed to be modular and flexible. It consists of a main entry point (index.ts
) that handles protocol interactions and a type definition file (types.ts
). The .env
file manages environment configurations, ensuring the server can operate in different modes (development or production) and environments.
graph TD
A[AI Application] -->|MCP Client| B[MCP Server]
B --> C[Starknet Blockchain]
C --> D[Data Source/Tool]
style A fill:#e1f5fe
style C fill:#f3e5f5
style D fill:#e8f5e8
This diagram illustrates the flow of data from an AI application (A) through an MCP client to a Starknet server, then interacts with smart contract nodes on the Starknet blockchain to retrieve or update relevant data.
To get started with integrating your AI application into Starknet, follow these steps:
Installing via Smithery:
npx -y @smithery/cli install @AbdelStark/starknet-mcp --client claude
Manual Installation:
git clone https://github.com/AbdelStark/starknet-mcp
cd starknet-mcp
npm install
tsenv.example
):# Log level (debug, info, warn, error)
LOG_LEVEL=debug
# Node environment (development, production)
NODE_ENV=development
# Server mode (stdio or sse)
SERVER_MODE=sse
# Port for SSE mode
PORT=9000
# Starknet RPC URL
STAKNET_RPC_URL=https://...
Imagine integrating an AI application like Claude Desktop with a real-time market data tool on the Starknet blockchain. The server can fetch the latest block from Starknet to provide up-to-date information to the AI model, ensuring it remains informed about the most recent market trends.
graph TD
A[AI Application] -->|Fetch Latest Block| B[MCP Server]
B -- Real-time block data --> C[Market Analytics Tool on Starknet]
C --> D[Prediction and Decision Making]
In this setup, the MCP server acts as a gateway to fetch real-time data from the Starknet blockchain. This data is then analyzed by a market analytics tool integrated with the AI application, enabling more accurate predictions and better decision-making capabilities.
Another use case could be integrating an AI-powered chatbot into a customer service platform on Starknet. The server allows the chatbot to query relevant customer data, improving response time and accuracy through direct access to blockchain records.
The Starknet MCP Server is designed to support multiple MCP clients seamlessly. Below is the compatibility matrix showcasing its current support for popular AI applications:
MCP Client | Resources | Tools | Prompts |
---|---|---|---|
Claude Desktop | ✅ | ✅ | ✅ |
Continue | ✅ | ✅ | ✅ |
Cursor | ❌ | ✅ | ❌ |
The performance of Starknet MCP Server is optimized for various environments, catering to both development and production needs. It ensures reliable data exchange between AI applications and the Starknet blockchain.
Configuration details are managed in a .env
file. Below is an example snippet:
{
"mcpServers": {
"[server-name]": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-[name]"],
"env": {
"API_KEY": "your-api-key"
}
}
}
}
For developers aiming to customize and secure their integrations, Starknet MCP Server provides robust configuration options. Developers can adjust the log level, specify the node environment (development or production), choose between different server modes (stdio or SSE), and configure security parameters such as API keys.
graph TD
A[Define Log Level] --> B[Choose Node Environment]
B --> C[Select Server Mode (stdio/sse)]
C --> D[Configure API Key for Security]
These configurations help in maintaining the integrity and security of data exchanges while leveraging the server's capabilities to their fullest extent.
You can set the blockNumber
parameter in your command or use the block height retrieval function provided by the server to fetch the latest block from Starknet.
STAKNET_RPC_URL
environment variable represent, and how should it be configured?The STAKNET_RPC_URL
variable points to the Starknet RPC endpoint. Developers need to set this to a valid URL that provides access to the Starknet blockchain data.
Currently, only tools and resources are supported with the Cursor client; prompts remain unsupported due to limitations in current capabilities.
Security is managed through parameters like API_KEY
specified in the configuration file. Developers should use strong encryption and secure storage practices for these keys.
Yes, future updates will enable interactions with smart contracts, which requires customization in your client code and possibly updates to the server itself based on specific requirements.
Contributions are welcome from all developers looking to enhance or improve the functionality of this project. The following steps guide you through the process:
For those keen on exploring more about MCP and its integration capabilities, here are some resources:
Feel free to follow me if you'd like, using my public key:
npub1hr6v96g0phtxwys4x0tm3khawuuykz6s28uzwtj5j0zc7lunu99snw2e29
Or just scan this QR code to find me:
Creating a Starknet MCP Server empowers developers to build robust AI applications with seamless integration into the Starknet blockchain. By leveraging the power of Model Context Protocol, these applications can access real-time data and smart contract capabilities, revolutionizing how they function in today’s dynamic technological landscape.
RuinedFooocus is a local AI image generator and chatbot image server for seamless creative control
Learn to set up MCP Airflow Database server for efficient database interactions and querying airflow data
Simplify MySQL queries with Java-based MysqlMcpServer for easy standard input-output communication
Build stunning one-page websites track engagement create QR codes monetize content easily with Acalytica
Explore CoRT MCP server for advanced self-arguing AI with multi-LLM inference and enhanced evaluation methods
Access NASA APIs for space data, images, asteroids, weather, and exoplanets via MCP integration