You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A CLI tool to create a new Model Context Protocol (MCP) server project. This package provides a template for building custom MCP servers that can be used by AI agents to interact with external systems and data sources.
8
+
An MCP (Model Context Protocol) server for the Starknet blockchain. This server provides AI agents with the ability to interact with Starknet networks, query blockchain data, manage wallets, and interact with smart contracts.
8
9
9
10
## 📋 Usage
10
11
@@ -31,16 +32,17 @@ The template includes:
31
32
32
33
## ✨ Features
33
34
34
-
-**Dual Transport Support**: Run your MCP server over stdio or HTTP
35
-
-**TypeScript**: Full TypeScript support for type safety
36
-
-**MCP SDK**: Built on the official Model Context Protocol SDK
37
-
-**Extensible**: Easy to add custom tools, resources, and prompts
35
+
-**Starknet Integration**: Full Starknet blockchain integration using Starknet.js
36
+
-**Network Support**: Supports both Mainnet and Sepolia testnet
37
+
-**StarknetID Integration**: Resolution of Starknet IDs to addresses and vice versa
38
+
-**Native Token Support**: Support for both ETH and STRK native tokens
39
+
-**Smart Contract Interaction**: Call and query Starknet smart contracts
40
+
-**Dual Transport**: Run as stdio server or HTTP server for different integration needs
41
+
-**AI-Ready**: Designed to be used with Claude, GPT, and other AI assistants
38
42
39
43
## 🚀 Getting Started
40
44
41
-
After creating your project:
42
-
43
-
1. Install dependencies using your preferred package manager:
45
+
1. Install dependencies:
44
46
```bash
45
47
# Using npm
46
48
npm install
@@ -73,44 +75,75 @@ After creating your project:
73
75
npm run dev:http
74
76
```
75
77
76
-
> **Note**: The default scripts in package.json use Bun as the runtime (e.g., `bun run src/index.ts`). If you prefer to use a different package manager or runtime, you can modify these scripts in your package.json file to use Node.js or another runtime of your choice.
78
+
## 🔧 Supported Features
79
+
80
+
### Blockchain Information
81
+
- Query chain information (chain ID, latest block)
82
+
- Explore block details
83
+
- Search transactions
84
+
- Get address information
85
+
86
+
### Native Token Operations
87
+
- Get ETH and STRK balances
88
+
- Transfer tokens
89
+
90
+
### Smart Contract Interaction
91
+
- Call read-only contract functions
92
+
- Get contract storage information
93
+
- View ABIs and contract class information
94
+
95
+
### StarknetID
96
+
- Resolve Starknet addresses to Starknet IDs
97
+
- Resolve Starknet IDs to addresses
98
+
- Get Starknet ID profiles
99
+
100
+
### NFT Operations
101
+
- Check NFT ownership
102
+
- Get NFT collection information
103
+
104
+
## 🔍 Usage with AI Assistants
105
+
106
+
When using this server with AI assistants like Claude or GPT:
107
+
108
+
1. Configure your AI assistant to use this MCP server
109
+
2. The assistant can then use tools to interact with Starknet
110
+
3. Example: "Look up the Starknet ID for address 0x123..."
111
+
112
+
## 📦 API Structure
77
113
78
-
## 🛠️ Adding Custom Tools and Resources
114
+
The server provides:
79
115
80
-
When adding custom tools, resources, or prompts to your MCP server:
116
+
-**Tools**: Direct function calls to perform blockchain operations
117
+
-**Resources**: Structured data endpoints in the form of starknet://{network}/...
118
+
-**Prompts**: Pre-built prompts to help AI agents explore the Starknet blockchain
119
+
120
+
## 🛠️ Development Conventions
121
+
122
+
When adding custom tools, resources, or prompts:
81
123
82
124
1. Use underscores (`_`) instead of hyphens (`-`) in all resource, tool, and prompt names
Copy file name to clipboardexpand all lines: src/core/prompts.ts
+92-8
Original file line number
Diff line number
Diff line change
@@ -2,25 +2,109 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
2
import{z}from"zod";
3
3
4
4
/**
5
-
* Register all prompts with the MCP server
5
+
* Register all Starknet-related prompts with the MCP server
6
6
* @param server The MCP server instance
7
7
*/
8
8
exportfunctionregisterPrompts(server: McpServer){
9
-
// Example prompt
9
+
// Basic block explorer prompt
10
10
server.prompt(
11
-
"greeting",
12
-
"A simple greeting prompt",
11
+
"explore_starknet_block",
12
+
"Explore information about a specific Starknet block",
13
13
{
14
-
name: z.string().describe("Name to greet")
14
+
blockNumber: z.string().optional().describe("Block number to explore. If not provided, latest block will be used."),
15
+
network: z.string().optional().describe("Network name (e.g., 'mainnet', 'sepolia'). Defaults to Mainnet.")
15
16
},
16
-
(params: {name: string})=>({
17
+
({ blockNumber, network ="mainnet"})=>({
17
18
messages: [{
18
19
role: "user",
19
20
content: {
20
21
type: "text",
21
-
text: `Hello, ${params.name}! How can I help you today?`
22
+
text: `I want to explore the Starknet blockchain. Please give me detailed information about ${blockNumber ? `block #${blockNumber}` : "the latest block"} on the ${network} network. Include data like timestamp, transactions count, and any other interesting metrics.`
22
23
}
23
24
}]
24
25
})
25
26
);
26
-
}
27
+
28
+
// Address information prompt
29
+
server.prompt(
30
+
"explore_starknet_address",
31
+
"Get information about a Starknet address",
32
+
{
33
+
address: z.string().describe("Starknet address to explore"),
34
+
network: z.string().optional().describe("Network name (e.g., 'mainnet', 'sepolia'). Defaults to Mainnet.")
35
+
},
36
+
({ address, network ="mainnet"})=>({
37
+
messages: [{
38
+
role: "user",
39
+
content: {
40
+
type: "text",
41
+
text: `I'm researching the Starknet address ${address} on the ${network} network. Please provide me with detailed information about this address, including its ETH balance, any token balances if available, and transaction history if possible. Also check if it has a Starknet ID associated with it. Summarize what you find about this address.`
42
+
}
43
+
}]
44
+
})
45
+
);
46
+
47
+
// Transaction information prompt
48
+
server.prompt(
49
+
"explore_starknet_transaction",
50
+
"Get information about a Starknet transaction",
51
+
{
52
+
txHash: z.string().describe("Transaction hash to explore"),
53
+
network: z.string().optional().describe("Network name (e.g., 'mainnet', 'sepolia'). Defaults to Mainnet.")
54
+
},
55
+
({ txHash, network ="mainnet"})=>({
56
+
messages: [{
57
+
role: "user",
58
+
content: {
59
+
type: "text",
60
+
text: `I'm analyzing Starknet transaction ${txHash} on the ${network} network. Please provide me with detailed information about this transaction, including its status, block confirmation, timestamp, gas used, and any other relevant details. Also explain what this transaction did in plain language.`
61
+
}
62
+
}]
63
+
})
64
+
);
65
+
66
+
// Starknet ID lookup prompt
67
+
server.prompt(
68
+
"lookup_starknet_id",
69
+
"Look up a Starknet ID or resolve an address to a Starknet ID",
70
+
{
71
+
identifier: z.string().describe("Either a Starknet ID (with or without .stark) or a Starknet address"),
72
+
network: z.string().optional().describe("Network name (e.g., 'mainnet', 'sepolia'). Defaults to Mainnet.")
73
+
},
74
+
({ identifier, network ="mainnet"})=>{
75
+
// Determine if this is an address or a Starknet ID
? `Please lookup the Starknet ID associated with the address ${identifier} on the ${network} network. If there's a profile available, provide details about it.`
85
+
: `Please resolve the Starknet ID "${identifier}" to an address on the ${network} network. If this is a valid ID, provide information about the associated address.`
86
+
}
87
+
}]
88
+
};
89
+
}
90
+
);
91
+
92
+
// Starknet ID profile prompt
93
+
server.prompt(
94
+
"explore_starknet_id_profile",
95
+
"Explore a full Starknet ID profile",
96
+
{
97
+
address: z.string().describe("Starknet address to look up the profile for"),
98
+
network: z.string().optional().describe("Network name (e.g., 'mainnet', 'sepolia'). Defaults to Mainnet.")
99
+
},
100
+
({ address, network ="mainnet"})=>({
101
+
messages: [{
102
+
role: "user",
103
+
content: {
104
+
type: "text",
105
+
text: `I'd like to explore the Starknet ID profile for address ${address} on the ${network} network. Please provide all available information, including the ID, profile picture, verifications, and any other associated data. Let me know if this address has a verified profile and what it can be used for.`
0 commit comments