@settlemint/sdk-mcp 1.1.16-pre2559e50 → 1.2.0-main3f00e61e

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/README.md +234 -147
  2. package/dist/mcp.js +303 -814
  3. package/dist/mcp.js.map +22 -30
  4. package/package.json +9 -10
package/README.md CHANGED
@@ -16,7 +16,7 @@
16
16
  </p>
17
17
 
18
18
  <div align="center">
19
- <a href="https://console.settlemint.com/documentation/docs/using-platform/dev-tools/SDK/">Documentation</a>
19
+ <a href="https://console.settlemint.com/documentation">Documentation</a>
20
20
  <span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
21
21
  <a href="https://www.npmjs.com/package/@settlemint/sdk-mcp">NPM</a>
22
22
  <span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
@@ -27,230 +27,317 @@
27
27
  ## Table of Contents
28
28
 
29
29
  - [About](#about)
30
- - [Usage](#usage)
31
- - [As a dependency in your package.json](#as-a-dependency-in-your-package.json)
32
- - [Globally install the CLI](#globally-install-the-cli)
33
- - [GitHub Action](#github-action)
34
- - [Examples](#examples)
35
- - [Get the version of the CLI](#get-the-version-of-the-cli)
36
- - [Get help for a command](#get-help-for-a-command)
37
- - [Login to the platform](#login-to-the-platform)
38
- - [Creating a new project from a template](#creating-a-new-project-from-a-template)
39
- - [Installing dependencies](#installing-dependencies)
40
- - [Connecting to your SettleMint infrastructure](#connecting-to-your-settlemint-infrastructure)
41
- - [Deploying your smart contracts and subgraphs](#deploying-your-smart-contracts-and-subgraphs)
42
- - [Generating code for your dApp](#generating-code-for-your-dapp)
43
- - [Start your dApp in development mode](#start-your-dapp-in-development-mode)
44
- - [Creating a new project from a smart contract template](#creating-a-new-project-from-a-smart-contract-template)
45
- - [Testing your smart contracts](#testing-your-smart-contracts)
46
- - [Deploying your smart contracts and subgraphs](#deploying-your-smart-contracts-and-subgraphs)
47
- - [API Reference](#api-reference)
30
+ - [Introduction to Model Context Protocol (MCP)](#introduction-to-model-context-protocol-mcp)
31
+ - [Why does MCP matter?](#why-does-mcp-matter?)
32
+ - [Key Features and Benefits](#key-features-and-benefits)
33
+ - [How MCP Works](#how-mcp-works)
34
+ - [The Core Concept](#the-core-concept)
35
+ - [Technical Workflow](#technical-workflow)
36
+ - [Key Components](#key-components)
37
+ - [SettleMint's Implementation of MCP](#settlemint's-implementation-of-mcp)
38
+ - [Capabilities and Features](#capabilities-and-features)
39
+ - [Usage in AI and Blockchain](#usage-in-ai-and-blockchain)
40
+ - [Practical Examples](#practical-examples)
41
+ - [Implementing MCP in a Development Workflow](#implementing-mcp-in-a-development-workflow)
42
+ - [Using the SettleMint MPC in Cursor](#using-the-settlemint-mpc-in-cursor)
43
+ - [Using the SettleMint MPC in Claude Desktop](#using-the-settlemint-mpc-in-claude-desktop)
44
+ - [Using the SettleMint MPC in Cline](#using-the-settlemint-mpc-in-cline)
45
+ - [Using the SettleMint MPC in Windsurf](#using-the-settlemint-mpc-in-windsurf)
46
+ - [AI-Driven Blockchain Application or Agent](#ai-driven-blockchain-application-or-agent)
48
47
  - [Contributing](#contributing)
49
48
  - [License](#license)
50
49
 
51
50
  ## About
52
51
 
53
- The SettleMint CLI provides a command-line interface for interacting with the SettleMint platform. It enables you to manage your blockchain networks, deploy smart contracts, configure your SettleMint infrastructure directly from the terminal.
52
+ The SettleMint Model Context Provider provides a simple way integrate an LLM, AI IDE, or AI Agent with the SettleMint platform and your deployed usecase.
54
53
 
55
- ## Usage
54
+ For detailed information about using MCP with the SettleMint platform, check out our [official documentation](https://console.settlemint.com/documentation).
56
55
 
57
- ### As a dependency in your package.json
56
+ ## Introduction to Model Context Protocol (MCP)
58
57
 
59
- ```bash
60
- # npm
61
- npm install @settlemint/sdk-mcp
62
- npx settlemint --version
58
+ The Model Context Protocol (MCP) is a framework designed to enhance the capabilities of AI agents and large language models (LLMs) by providing structured, contextual access to external data. It acts as a bridge between AI models and a variety of data sources such as blockchain networks, external APIs, databases, and developer environments. In essence, MCP allows an AI model to pull in relevant context from the outside world, enabling more informed reasoning and interaction.
63
59
 
64
- # bun
65
- bun add @settlemint/sdk-mcp
66
- bunx settlemint --version
60
+ MCP is not a single tool but a standardized protocol. This means it defines how an AI should request information and how external systems should respond. By following this standard, different tools and systems can communicate with AI agents in a consistent way. The result is that AI models can go beyond their trained knowledge and interact with live data and real-world applications seamlessly.
67
61
 
68
- # pnpm
69
- pnpm add @settlemint/sdk-mcp
70
- pnpm dlx settlemint --version
62
+ ### Why does MCP matter?
71
63
 
72
- # yarn
73
- yarn add @settlemint/sdk-mcp
74
- yarn create settlemint --version
75
- ```
64
+ Modern AI models are powerful but traditionally operate as closed systems - they generate responses based on patterns learned from training data, without awareness of the current state of external systems. This lack of live context can be a limitation. MCP matters because it bridges that gap, allowing AI to become context-aware and action-oriented in real time.
76
65
 
77
- ### Globally install the CLI
66
+ Here are a few reasons MCP is important:
78
67
 
79
- ```bash
80
- # npm
81
- npm install -g @settlemint/sdk-mcp
68
+ - Dynamic Data Access: MCP allows AI models to interact seamlessly with external ecosystems (e.g., blockchain networks or web APIs). This means an AI agent can query a database or blockchain ledger at runtime to get the latest information, rather than relying solely on stale training data.
69
+ - Real-Time Context: By providing structured, real-time access to data (such as smart contract states or application status), MCP ensures that the AI's decisions and responses are informed by the current state of the world. This contextual awareness leads to more accurate and relevant outcomes.
70
+ - Extended Capabilities: With MCP, AI agents can execute actions, not just retrieve data. For example, an AI might use MCP to trigger a blockchain transaction or update a record. This enhances the agent's decision-making ability with precise, domain-specific context and the power to act on it.
71
+ - Reduced Complexity: Developers benefit from MCP because it offers a unified interface to various data sources. Instead of writing custom integration code for each external system, an AI agent can use MCP as a single conduit for many sources. This streamlines development and reduces errors.
82
72
 
83
- # bun
84
- bun install -g @settlemint/sdk-mcp
73
+ Overall, MCP makes AI more aware, adaptable, and useful by connecting it to live data and enabling it to perform tasks in external systems. It's a significant step toward AI that can truly understand and interact with the world around it.
85
74
 
86
- # pnpm
87
- pnpm add -g @settlemint/sdk-mcp
75
+ ### Key Features and Benefits
88
76
 
89
- # yarn
90
- yarn global add @settlemint/sdk-mcp
91
- ```
77
+ MCP introduces several key features that offer significant benefits to both AI developers and end-users:
92
78
 
93
- You can access the CLI globally by running `settlemint` in your terminal.
79
+ - Contextual Awareness: AI models gain the ability to access live information and context on demand. Instead of operating in isolation, an AI agent can ask for specific data (like "What's the latest block on the blockchain?" or "Fetch the user profile from the database") and use that context to tailor its responses. This results in more accurate and situationally appropriate outcomes.
80
+ - Blockchain Integration: MCP provides a direct connection to on-chain data and smart contract functionality. An AI agent can query blockchain state (for example, checking a token balance or reading a contract's variable) and even invoke contract methods via MCP. This opens up possibilities for AI-managed blockchain operations, DeFi automation, and more, all through a standardized interface.
81
+ - Automation Capabilities: With structured access to external systems, AI agents can not only read data but also take actions. For instance, an AI could automatically adjust parameters of a smart contract, initiate a transaction, or update a configuration file in a repository. These automation capabilities allow the creation of intelligent agents that manage infrastructure or applications autonomously, under specified guidelines.
82
+ - Security and Control: MCP is designed with security in mind (covered in more detail later). It provides a controlled environment where access to external data and operations can be monitored and sandboxed. This ensures that an AI agent only performs allowed actions, and sensitive data can be protected through authentication and permissioning within the MCP framework.
94
83
 
95
- ## GitHub Action
84
+ By combining these features, MCP greatly expands what AI agents can do. It transforms passive models into active participants that can sense and influence external systems - all in a safe, structured manner.
96
85
 
97
- Execute SettleMint CLI commands directly in your GitHub Actions workflows using our official GitHub Action.
86
+ ## How MCP Works
98
87
 
99
- For detailed setup and usage instructions, check out our [documentation](https://github.com/settlemint/settlemint-action/blob/main/README.md).
88
+ ### The Core Concept
100
89
 
101
- Basic example:
90
+ At its core, MCP acts as middleware between an AI model and external data sources. Rather than embedding all possible knowledge and tools inside the AI, MCP keeps the AI model lean and offloads the data fetching and execution tasks to external services. The AI and the MCP communicate through a defined protocol:
102
91
 
103
- ```yaml
104
- steps:
105
- - name: Get SettleMint CLI version
106
- uses: settlemint/settlemint-action@main
107
- with:
108
- access-token: ${{ secrets.SETTLEMINT_ACCESS_TOKEN }}
109
- command: "--version"
110
- ```
92
+ 1. AI Agent (Client): The AI agent (e.g., an LLM or any AI-driven application) formulates a request for information or an action. This request is expressed in a standard format understood by MCP. For example, the AI might ask, "Get the value of variable X from smart contract Y on blockchain Z," or "Fetch the contents of file ABC from the project directory."
93
+ 2. MCP Server (Mediator): The MCP server receives the request and interprets it. It acts as a mediator that knows how to connect to various external systems. The server will determine which external source is needed for the request (blockchain, API, file system, etc.) and use the appropriate connector or handler to fulfill the query.
94
+ 3. External Data Source: This can be a blockchain node, an API endpoint, a database, or even a local development environment. The MCP server communicates with the external source, for example by making an API call, querying a blockchain node, or reading a file from disk.
95
+ 4. Contextual Response: The external source returns the requested data (or the result of an action). The MCP server then formats this information into a structured response that the AI agent can easily understand. This might involve converting raw data into a simpler JSON structure or text format.
96
+ 5. Return to AI: The MCP server sends the formatted data back to the AI agent. The AI can then incorporate this data into its reasoning or continue its workflow with this new context. From the perspective of the AI model, it's as if it just extended its knowledge or took an external action successfully.
111
97
 
112
- ## Examples
98
+ The beauty of MCP is that it abstracts away the differences between various data sources. The AI agent doesn't need to know how to call a blockchain or how to query a database; it simply makes a generic request and MCP handles the rest. This modular approach means new connectors can be added to MCP for additional data sources without changing how the AI formulates requests.
113
99
 
114
- ### Get the version of the CLI
100
+ ### Technical Workflow
115
101
 
116
- ```bash
117
- settlemint --version
118
- ```
102
+ Let's walk through a typical technical workflow with MCP step by step:
103
+
104
+ 1. AI Makes a Request: The AI agent uses an MCP SDK or API to send a request. For example, in code it might call something like mcp.fetch("settlemint", "getContractState", params) - where "settlemint" could specify a target MCP server or context.
105
+ 2. MCP Parses the Request: The MCP server (in this case, perhaps the SettleMint MCP server) receives the request. The request will include an identifier of the desired operation and any necessary parameters (like which blockchain network, contract address, or file path is needed).
106
+ 3. Connector Activation: Based on the request type, MCP selects the appropriate connector or module. For a blockchain query, it might use a blockchain connector configured with network access and credentials. For a file system query, it would use a file connector with the specified path.
107
+ 4. Data Retrieval/Action Execution: MCP executes the action. If it's a data retrieval, it fetches the data: e.g., calls a blockchain node's API to get contract state, or reads from a local file. If it's an action (like executing a transaction or writing to a file), it will perform that operation using the credentials and context it has.
108
+ 5. Data Formatting: The raw result is often in a format specific to the source (JSON from a web API, binary from a file, etc.). MCP will format or serialize this result into a standard format (commonly JSON or a text representation) that can be easily consumed by the AI model. It may also include metadata, like timestamps or success/failure status.
109
+ 6. Response to AI: MCP sends the formatted response back to the AI agent. In practice, this could be a return value from an SDK function call or a message sent over a websocket or HTTP if using a networked setup.
110
+ 7. AI Continues Processing: With the new data, the AI can adjust its plan, generate a more informed answer, or trigger further actions. For example, if the AI was asked a question about a user/s blockchain balance, it now has the balance from MCP and can include it in its answer. If the AI was autonomously managing something, it might decide the next step based on the data.
111
+
112
+ This workflow happens quickly and often behind the scenes. From a high-level perspective, MCP extends the AI's capabilities on-the-fly. The AI remains focused on decision-making and language generation, while MCP handles the grunt work of fetching data and executing commands in external systems.
119
113
 
120
- ### Get help for a command
114
+ ### Key Components
121
115
 
122
- The CLI uses a hierarchical command structure. You can navigate through available commands and subcommands using the `--help` flag at any level.
116
+ MCP consists of a few core components that work together to make the above workflow possible:
123
117
 
124
- ```bash
125
- settlemint --help
126
- settlemint platform --help
127
- settlemint platform create --help
118
+ ```mermaid
119
+ flowchart LR
120
+ A[AI Agent / LLM] --(1) request--> B{{MCP Server}}
121
+ subgraph MCP Server
122
+ B --> C1[Blockchain Connector]
123
+ B --> C2[API Connector]
124
+ B --> C3[File System Connector]
125
+ end
126
+ C1 -- fetch/query --> D[(Blockchain Network)]
127
+ C2 -- API call --> E[(External API/Data Source)]
128
+ C3 -- read/write --> F[(Local File System)]
129
+ D -- data --> C1
130
+ E -- data --> C2
131
+ F -- file data --> C3
132
+ B{{MCP Server}} --(2) formatted data--> A[AI Agent / LLM]
128
133
  ```
129
134
 
130
- ### Login to the platform
135
+ - MCP Server: This is the central service or daemon that runs and listens for requests from AI agents. It can be thought of as the brain of MCP that coordinates everything. The MCP server is configured to know about various data sources and how to connect to them. In practice, you might run an MCP server process locally or on a server, and your AI agent will communicate with it via an API (like HTTP requests, RPC calls, or through an SDK).
136
+ - MCP SDK / Client Library: To simplify usage, MCP provides SDKs in different programming languages. Developers include these in their AI agent code. The SDK handles the communication details with the MCP server, so a developer can simply call functions or methods (like mcp.getData(...)) without manually constructing network calls. The SDK ensures requests are properly formatted and sends them to the MCP server, then receives the response and hands it to the AI program.
137
+ - Connectors / Adapters: These are modules or plugins within the MCP server that know how to talk to specific types of external systems. One connector might handle blockchain interactions (with sub-modules for Ethereum, Hyperledger, etc.), another might handle web APIs (performing HTTP calls), another might manage local OS operations (file system access, running shell commands). Each connector understands a set of actions and data formats for its domain. Connectors make MCP extensible - new connectors can be added to support new systems or protocols.
138
+ - Configuration Files: MCP often uses configuration (like JSON or YAML) to know which connectors to activate and how to reach external services. For example, you might configure an MCP instance with the URL of your blockchain node, API keys for external services, or file path permissions. The configuration ensures that at runtime the MCP server has the info it needs to carry out requests safely and correctly.
139
+ - Security Layer: Since MCP can access sensitive data and perform actions, it includes a security layer. This may involve API keys (like the --pat personal access token in the example) or authentication for connecting to blockchains and databases. The security layer also enforces permissions: it can restrict what an AI agent is allowed to do via MCP, preventing misuse. For instance, you might allow read-only access to some data but not allow any write or state-changing operations without additional approval.
131
140
 
132
- To use the SettleMint CLI, you first need to authenticate with the platform. Create a Personal Access Token (PAT) on the SettleMint platformand paste it when prompted by the login command.
141
+ These components together make MCP robust and flexible. The separation of concerns (AI vs MCP vs Connectors) means each part can evolve or be maintained independently. For example, if a new blockchain is introduced, you can add a connector for it without changing how the AI asks for data. Or if the AI model is updated, it can still use the same MCP server and connectors as before.
133
142
 
134
- Visit [the documentation](https://console.settlemint.com/documentation/docs/using-platform/personal-access-tokens/) to learn how to create a Personal Access Token.
143
+ ## SettleMint's Implementation of MCP
135
144
 
136
- Then run the login command and paste your token when prompted:
145
+ SettleMint is a leading blockchain integration platform that has adopted and implemented MCP to empower AI agents with blockchain intelligence and infractructure control. In SettleMint's implementation, MCP serves as a bridge between AI-driven applications and blockchain environments managed or monitored by SettleMint's platform. This means AI agents can deeply interact with blockchain resources (like smart contracts, transactions, and network data) but also with the underlying infrastructure (nodes, middlewares) through a standardized interface.
137
146
 
138
- ```bash
139
- settlemint login
140
- ```
147
+ By leveraging MCP, SettleMint enables scenarios where:
148
+
149
+ - An AI assistant can query on-chain data in real time, such as retrieving the state of a smart contract or the latest block information.
150
+ - Autonomous agents can manage blockchain infrastructure tasks (deploying contracts, adjusting configurations) without human intervention, guided by AI decision-making.
151
+ - Developers using SettleMint can integrate advanced AI functionalities into their blockchain applications with relatively little effort, because MCP handles the heavy lifting of connecting the two worlds.
152
+
153
+ ```mermaid
154
+ sequenceDiagram
155
+ participant AI as AI Model (Agent)
156
+ participant MCP as MCP Server
157
+ participant Chain as The Graph / Portal / Node
158
+ participant API as External API
159
+
160
+ AI->>MCP: (1) Query request (e.g., get contract state)
161
+ Note over AI,MCP: AI asks MCP for on-chain data
162
+ MCP-->>AI: (2) Acknowledgement & processing
163
+
164
+ MCP->>Chain: (3) Fetch data from blockchain
165
+ Chain-->>MCP: (4) Return contract state
141
166
 
142
- ### Creating a new project from a template
167
+ MCP->>API: (5) [Optional] Fetch related off-chain data
168
+ API-->>MCP: (6) Return external data
143
169
 
144
- To create a new project from a template, use the `create` command with the `--template` flag:
170
+ MCP-->>AI: (7) Send combined response
171
+ Note over AI,MCP: AI receives on-chain data (and any other context)
145
172
 
146
- ```bash
147
- settlemint create --project-name <project-name> --template <template-name>
173
+ AI->>MCP: (8) Action request (e.g., execute transaction)
174
+ MCP->>Chain: (9) Submit transaction to blockchain
175
+ Chain-->>MCP: (10) Return tx result/receipt
176
+ MCP-->>AI: (11) Confirm action result
148
177
  ```
149
178
 
150
- #### Installing dependencies
179
+ In summary, SettleMint's version of MCP extends their platform's capabilities, allowing for AI-driven blockchain operations. This combination brings together the trust and transparency of blockchain with the adaptability and intelligence of AI.
151
180
 
152
- To install the dependencies for your project, use the `dependencies` command.
181
+ ### Capabilities and Features
153
182
 
154
- ```bash
155
- # bun
156
- bun install
157
- bun run dependencies
183
+ SettleMint's MCP implementation comes with a rich set of capabilities tailored for blockchain-AI integration:
158
184
 
159
- # npm
160
- npm install
161
- npm run dependencies
185
+ - Seamless IDE Integration: SettleMint's tools work within common developer environments, meaning you can use MCP in the context of your development workflow. For example, if you're coding a smart contract or an application, an AI agent (like a code assistant) can use MCP to fetch blockchain state or deploy contracts right from your IDE. This streamlines development by giving real-time blockchain feedback and actions as you code.
186
+ - Automated Contract Management: AI agents can interact with and even modify smart contracts autonomously through MCP. This includes deploying new contracts, calling functions on existing contracts, or listening to events. For instance, an AI ops agent could detect an anomaly in a DeFi contract and use MCP via SettleMint to trigger a safeguard function on that contract, all automatically.
187
+ - AI-Driven Analytics: Through MCP, AI models can analyze blockchain data for insights and predictions. SettleMint's platform might feed transaction histories, token movements, or network metrics via MCP to an AI model specialized in analytics. The AI could then, say, identify patterns of fraudulent transactions or predict network congestion and feed those insights back into the blockchain application or to administrators.
162
188
 
163
- # yarn
164
- yarn install
165
- yarn run dependencies
189
+ These features demonstrate how SettleMint's integration of MCP isn't just a basic link to blockchain, but a comprehensive suite that makes blockchain data and control accessible to AI in a meaningful way. It effectively makes blockchain networks intelligent by allowing AI to continuously monitor and react to on-chain events.
166
190
 
167
- # pnpm
168
- pnpm install
169
- pnpm run dependencies
170
- ```
191
+ ### Usage in AI and Blockchain
171
192
 
172
- #### Connecting to your SettleMint infrastructure
193
+ By combining the strengths of AI and blockchain via MCP, SettleMint unlocks several powerful use cases:
173
194
 
174
- After creating your project, you'll need to connect it to your SettleMint infrastructure. This requires setting up environment variables with your SettleMint credentials and infrastructure details.
195
+ - AI-Powered Smart Contract Management: Smart contracts often need tuning or updates based on external conditions (like market prices or usage load). An AI agent can use MCP to monitor these conditions and proactively adjust smart contract parameters (or advise humans to do so) through SettleMint's tools. This creates more adaptive and resilient blockchain applications.
196
+ - Real-time Blockchain Monitoring: Instead of static dashboards, imagine an AI that watches blockchain transactions and alerts you to important events. With MCP, an AI can continuously query the chain for specific patterns (like large transfers, or certain contract events) and then analyze and explain these to a user or trigger automated responses.
197
+ - Autonomous Governance: In blockchain governance (e.g., DAOs), proposals and decisions could be informed by AI insights. Using MCP, an AI agent could gather all relevant on-chain data about a proposal's impact, simulate different outcomes, and even cast votes or execute approved decisions automatically on the blockchain. This merges AI decision support with blockchain's execution capabilities.
198
+ - Cross-System Orchestration: SettleMint's MCP doesn't have to be limited to blockchain data. AI can use it to orchestrate actions that span blockchain and off-chain systems. For example, an AI agent might detect that a supply chain shipment (tracked on a blockchain) is delayed, and then through MCP, update an off-chain database or send a notification to a logistics system. The AI acts as an intelligent middleware, using MCP to ensure both blockchain and traditional systems stay in sync.
175
199
 
176
- You can use the `connect` command to automatically configure your project and select the services you want to connect to.
200
+ In practice, using MCP with SettleMint's SDK (discussed next) makes implementing these scenarios much easier. Developers can focus on the high-level logic of what the AI should do, while the MCP layer (managed by SettleMint's platform) deals with the complexity of connecting to the blockchain and other services.
177
201
 
178
- ```bash
179
- settlemint connect
180
- ```
202
+ ## Practical Examples
181
203
 
182
- #### Deploying your smart contracts and subgraphs
204
+ To solidify the understanding, let's look at some concrete examples of how MCP can be used in a development workflow and in applications, especially with SettleMint's tooling.
183
205
 
184
- To deploy your smart contracts and subgraphs, you can use the `deploy` command.
206
+ ### Implementing MCP in a Development Workflow
185
207
 
186
- ```bash
187
- settlemint scs hardhat deploy remote --accept-defaults
188
- ```
208
+ Suppose you are a developer working on a blockchain project, and you want to use an AI assistant to help manage your smart contracts. You can integrate MCP into your workflow so that the AI assistant has direct access to your project's context (code, files) and the blockchain environment.
189
209
 
190
- To deploy your subgraphs, use the `subgraph` command.
210
+ For instance, you might use a command (via a CLI or an npm script) to start an MCP server that is pointed at your project directory and connected to the SettleMint platform. An example command could be:
191
211
 
192
- ```bash
193
- settlemint scs subgraph deploy --accept-defaults <subgraph-name>
212
+ ```sh
213
+ npx -y @settlemint/sdk-mcp@latest --path=/Users/llm/asset-tokenization-kit/ --pat=sm_pat_xxx
194
214
  ```
195
215
 
196
- #### Generating code for your dApp
216
+ Here's what this command does:
197
217
 
198
- After deploying your smart contracts and subgraphs, you can generate TypeScript code for your dApp to interact with them. The `codegen` command will generate type-safe code for your integrations with the services selected in the `connect` command.
218
+ - npx is used to execute the latest version of the @settlemint/sdk-mcp package without needing a separate install.
219
+ - --path=/Users/llm/asset-tokenization-kit/ specifies the local project directory that the MCP server will have context about. This could allow the AI to query files or code in that directory through MCP and have access to the environment settings from `settlemint connect`
220
+ - --pat=sm_pat_xxx provides a Personal Access Token (PAT) for authenticating with SettleMint's services. This token (masked here as xxx) is required for the MCP server to connect to the SettleMint platform on your behalf.
199
221
 
200
- ```bash
201
- settlemint codegen
202
- ```
222
+ After running this command, you would have a local MCP server up and running, connected to both your local project and the SettleMint platform. Your AI assistant (say a specialized Claude Sonnet-based agent) could then do things like:
203
223
 
204
- #### Start your dApp in development mode
224
+ - Ask MCP to write forms and lists based on the data you indexed in for example The Graph.
225
+ - Query the live blockchain to get the current state of a contract you're working on, to verify something or test changes.
226
+ - Deploy an an extra node in your network
227
+ - List and later mint some new tokens in your stablecoin contract
205
228
 
206
- ```bash
207
- # bun
208
- bun run dev
229
+ This greatly enhances a development workflow by making the AI an active participant that can fetch and act on real information, rather than just being a passive code suggestion tool.
209
230
 
210
- # npm
211
- npm run dev
231
+ #### Using the SettleMint MPC in Cursor
212
232
 
213
- # yarn
214
- yarn dev
233
+ Cursor (0.47.0 and up) provides a global `~/.cursor/mcp.json` file where you can configure the SettleMint MCP server. Point the path to the folder of your program, and set your personal access token.
215
234
 
216
- # pnpm
217
- pnpm dev
218
- ```
235
+ > The reason we use the global MCP configuration file is that your personal access token should never, ever, ever be committed into hits and putting it in the project folder, which is also possible in cursor opens up that possibility.
219
236
 
220
- ### Creating a new project from a smart contract template
237
+ ```json
238
+ {
239
+ "mcpServers": {
240
+ "settlemint": {
241
+ "command": "npx",
242
+ "args": [
243
+ "-y",
244
+ "@settlemint/sdk-mcp@latest",
245
+ "--path=/Users/llm/asset-tokenization-kit/",
246
+ "--pat=sm_pat_xxx"
247
+ ]
248
+ }
249
+ }
250
+ }
251
+ ```
221
252
 
222
- To create a new project from a smart contract template, use the `create` command with the `--use-case` flag:
253
+ Open Cursor and navigate to Settings/MCP. You should see a green active status after the server is successfully connected.
254
+
255
+ #### Using the SettleMint MPC in Claude Desktop
256
+
257
+ Open Claude desktop and navigate to Settings. Under the Developer tab, tap Edit Config to open the configuration file and add the following configuration:
258
+
259
+ ```json
260
+ {
261
+ "mcpServers": {
262
+ "settlemint": {
263
+ "command": "npx",
264
+ "args": [
265
+ "-y",
266
+ "@settlemint/sdk-mcp@latest",
267
+ "--path=/Users/llm/asset-tokenization-kit/",
268
+ "--pat=sm_pat_xxx"
269
+ ]
270
+ }
271
+ }
272
+ }
273
+ ```
223
274
 
224
- ```bash
225
- settlemint scs create --project-name <project-name> --use-case <use-case-name>
275
+ Save the configuration file and restart Claude desktop. From the new chat screen, you should see a hammer (MCP) icon appear with the new MCP server available.
276
+
277
+ #### Using the SettleMint MPC in Cline
278
+
279
+ Open the Cline extension in VS Code and tap the MCP Servers icon. Tap Configure MCP Servers to open the configuration file and add the following configuration:
280
+
281
+ ```json
282
+ {
283
+ "mcpServers": {
284
+ "settlemint": {
285
+ "command": "npx",
286
+ "args": [
287
+ "-y",
288
+ "@settlemint/sdk-mcp@latest",
289
+ "--path=/Users/llm/asset-tokenization-kit/",
290
+ "--pat=sm_pat_xxx"
291
+ ]
292
+ }
293
+ }
294
+ }
226
295
  ```
227
296
 
228
- #### Testing your smart contracts
297
+ Save the configuration file. Cline should automatically reload the configuration. You should see a green active status after the server is successfully connected.
298
+
299
+ #### Using the SettleMint MPC in Windsurf
300
+
301
+ Open Windsurf and navigate to the Cascade assistant. Tap on the hammer (MCP) icon, then Configure to open the configuration file and add the following configuration:
229
302
 
230
- To test your smart contracts, you can use the `test` command.
231
303
 
232
- ```bash
233
- settlemint scs foundry test
304
+ ```json
305
+ {
306
+ "mcpServers": {
307
+ "settlemint": {
308
+ "command": "npx",
309
+ "args": [
310
+ "-y",
311
+ "@settlemint/sdk-mcp@latest",
312
+ "--path=/Users/llm/asset-tokenization-kit/",
313
+ "--pat=sm_pat_xxx"
314
+ ]
315
+ }
316
+ }
317
+ }
234
318
  ```
235
319
 
236
- #### Deploying your smart contracts and subgraphs
320
+ Save the configuration file and reload by tapping Refresh in the Cascade assistant. You should see a green active status after the server is successfully connected.
237
321
 
238
- To deploy your smart contracts and subgraphs, you can use the `deploy` command.
322
+ ### AI-Driven Blockchain Application or Agent
239
323
 
240
- ```bash
241
- settlemint scs hardhat deploy remote --accept-defaults
242
- ```
324
+ To illustrate a real-world scenario, consider an AI-driven Decentralized Finance (DeFi) application. In DeFi, conditions change rapidly (prices, liquidity, user activity), and it's critical to respond quickly.
243
325
 
244
- To deploy your subgraphs, use the `subgraph` command.
326
+ Scenario: You have a smart contract that manages an automatic liquidity pool. You want to ensure it remains balanced - if one asset's price drops or the pool becomes unbalanced, you'd like to adjust fees or parameters automatically.
245
327
 
246
- ```bash
247
- settlemint scs subgraph deploy --accept-defaults <subgraph-name>
248
- ```
328
+ Using MCP in this scenario:
249
329
 
250
- ## API Reference
330
+ 1. An AI agent monitors the liquidity pool via MCP. Every few minutes, it requests the latest pool balances and external price data (from on-chain or off-chain oracles) through the MCP server.
331
+ 2. MCP fetches the latest state from the blockchain (pool reserves, recent trades) and maybe calls an external price API for current market prices, then returns that data to the AI.
332
+ 3. The AI analyzes the data. Suppose it finds that Asset A's proportion in the pool has drastically increased relative to Asset B (perhaps because Asset A's price fell sharply).
333
+ 4. The AI decides that to protect the pool, it should increase the swap fee temporarily (a common measure to discourage arbitrage draining the pool).
334
+ 5. Through MCP, the AI calls a function on the smart contract to update the fee parameter. The MCP's blockchain connector handles creating and sending the transaction to the network via SettleMint's infrastructure.
335
+ 6. The transaction is executed on-chain, adjusting the fee. MCP catches the success response and any relevant event (like an event that the contract might emit for a fee change).
336
+ 7. The AI receives confirmation and can log the change or inform administrators that it took action.
251
337
 
252
- See the [documentation](https://github.com/settlemint/sdk/tree/v1.1.16/sdk/cli/docs/settlemint.md) for available commands.
338
+ In this use case, MCP enabled the AI to be a real-time guardian of the DeFi contract. Without MCP, the AI would not have access to the live on-chain state or the ability to execute a change. With MCP, the AI becomes a powerful autonomous agent that ensures the blockchain application adapts to current conditions.
253
339
 
340
+ This is just one example. AI-driven blockchain applications could range from automatic NFT marketplace management, to AI moderators for DAO proposals, to intelligent supply chain contracts that react to sensor data. MCP provides the pathway for these AI agents to communicate and act where it matters - on the blockchain and connected systems.
254
341
  ## Contributing
255
342
 
256
343
  We welcome contributions from the community! Please check out our [Contributing](https://github.com/settlemint/sdk/blob/main/.github/CONTRIBUTING.md) guide to learn how you can help improve the SettleMint SDK through bug reports, feature requests, documentation updates, or code contributions.