Stacks Clarity MCP Server
The Stacks Clarity MCP Server is a comprehensive toolkit for professional Stacks blockchain development, providing 30+ specialized tools for Clarity smart contracts with emphasis on SIP compliance, security, and performance optimization.
Core Capabilities:
Standards & Documentation - Complete access to 30+ SIP standards with search functionality, full Clarity Book documentation (34,000+ lines), and essential token standards
Token Development - Generate complete SIP-010 fungible tokens and SIP-009 NFTs with contract creation, transfers, balance checks, and metadata management
Security-First Approach - Mandatory post-condition generation for all token transfers (fungible, non-fungible, STX), security analysis tools, and automated SIP compliance checking
Performance Optimization - SIP-012 performance analysis, computational cost estimation, bottleneck identification, and optimization recommendations for 2x database capacity
Account Management - STX balance checking, comprehensive account information, transaction history, and address validation
Development Environment - Complete Clarinet project setup, contract generation, comprehensive testing suites (unit, integration, security), and multi-network configuration
Full-Stack Development - Frontend integration guidance, wallet connectivity, transaction signing, and complete dApp development resources
Production-Ready Templates - Security-focused contract templates with marketplace functionality and best practices enforcement
Supports Git-based project management with Clarinet project initialization, contract versioning, and development workflow integration for Stacks blockchain projects.
Integrates with GitHub for accessing the complete repository of 30+ SIP (Stacks Improvement Proposals) standards and maintaining Stacks development project repositories.
Compiles to JavaScript for runtime execution and provides tools for JavaScript-based Stacks frontend development with wallet connectivity and transaction signing.
Built on Node.js runtime with TypeScript, providing 30+ specialized tools for Stacks blockchain development, smart contract creation, and dApp development workflow management.
Distributed as an npm package for easy installation and integration with development environments, supporting both published package installation and local development setup.
Provides frontend development tools and guidance for building React-based Stacks dApps with wallet integration using @stacks/connect library and proper transaction handling.
Implemented in TypeScript with full type safety for Stacks blockchain operations, Clarity smart contract development, and comprehensive SIP standards compliance tooling.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Stacks Clarity MCP Server show me the SIP-010 fungible token standard"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Stacks Clarity MCP Server (Unofficial)
A comprehensive MCP (Model Context Protocol) server for Stacks blockchain development, providing 30+ specialized tools for Clarity smart contracts, SIP compliance, security, and performance optimization.
another one brought to you by

๐ก New to MCP? Check out our integration guides for step-by-step setup instructions for Cursor, Claude Code, or local development.
๐ Overview
This comprehensive MCP server provides a complete Stacks development toolkit, implementing TIER 1 and TIER 2 priorities for professional Stacks dApp development with security-first patterns and SIP compliance.
Key Features
๐๏ธ Complete SIP Standards Access - All 30+ SIP standards with full Clarity code
๐ Security-First Development - Mandatory post-conditions for all token transfers
โก SIP-012 Performance Optimization - 2x database capacity and dynamic storage
๐จ Token Standards - Full SIP-009 (NFT) and SIP-010 (FT) implementations
๐งช Comprehensive Testing - Unit, integration, and security test generation
๐ง Clarinet Integration - Complete project setup and management tools
๐ฐ Account Management - STX balances, transaction history, and validation
๐ Complete Documentation - Clarity Book, SIP standards, and integration guides
Related MCP server: Stacks AI MCP Server
๐ Prerequisites
Node.js and npm (npm โฅ 5.2.0)
Clarinet CLI (for contract development)
Stacks wallet (for frontend integration)
Cursor IDE or Claude Code (for MCP integration)
๐ ๏ธ Quick Setup for Cursor/Claude Code
Option 1: Use Published Package (When Available)
Once published to npm, create .cursor/mcp.json in your project:
{
"mcpServers": {
"stacks-clarity-mcp": {
"command": "npx",
"args": ["-y", "@stacks/stacks-clarity-mcp"],
"env": {
"HIRO_API_KEY": "",
"STACKS_NETWORK": "testnet"
}
}
}
}Option 2: Local Development Setup (Current)
Clone and install:
git clone https://github.com/YOUR_USERNAME/stacks-clarity-mcp.git
cd stacks-clarity-mcp
npm installBuild the project:
npm run buildNote: This generates the
dist/folder with compiled JavaScript. The build is required before running the server.
Configure Cursor - Create
.cursor/mcp.jsonin your project root:
{
"mcpServers": {
"stacks-clarity-mcp": {
"command": "npx",
"args": ["-y", "tsx", "/absolute/path/to/stacks-clarity-mcp/src/server.ts"],
"env": {
"HIRO_API_KEY": "",
"STACKS_NETWORK": "testnet"
}
}
}
}Important: Replace
/absolute/path/to/stacks-clarity-mcpwith your actual path!
Restart Cursor completely (quit and reopen)
Verify Setup:
Go to
Cursor โ Settings โ MCPLook for green indicator next to
stacks-clarity-mcpSwitch to Agent mode in chat
Test with: "list available stacks tools"
Network Options
mainnet- Production Stacks networktestnet- Test network with free tokensdevnet- Local development with Clarinet
Get Hiro API Key (Optional)
For enhanced features and higher rate limits:
Visit platform.hiro.so
Create an account and generate an API key
Add to
HIRO_API_KEYin your config
๐ Detailed guides: See integration_guides/ folder for Cursor, Claude Code, and Development setup.
๐ฆ What's Included in the Repository
Included (pushed to GitHub):
โ
src/- TypeScript source code (452KB)โ
stacks-clarity-standards/- All 30+ SIP standards (9.2MB)โ
integration_guides/- Setup documentationโ
package.json,tsconfig.json- Configuration files
Excluded (not pushed):
โ
node_modules/- Dependencies (165MB) - install withnpm installโ
dist/- Build output (448KB) - generate withnpm run buildโ
.cursor/- Local MCP configโ
.env- Environment variables
Setup Requirement: After cloning, you must run
npm installandnpm run buildbefore using the MCP server.
๐ Available Tools (32 Total)
๐ Standards & Documentation (5 tools)
list_sips- Discover all available SIP standardsget_sip- Get specific SIP content (SIP-009, SIP-010, etc.)get_clarity_book- Complete Clarity language reference (34,000+ lines)get_token_standards- Essential SIP-009/SIP-010 standardssearch_sips- Search SIPs by topic
๐ช Token Development (8 tools)
SIP-010 Fungible Tokens
get_sip010_info- Token contract information and metadataget_sip010_balance- Check FT balances for addressesgenerate_sip010_transfer- Create transfer transactions with post-conditionsgenerate_sip010_template- Generate complete SIP-010 compliant contracts
SIP-009 Non-Fungible Tokens
get_sip009_token_info- NFT information and metadataget_sip009_collection_info- Collection-level informationgenerate_sip009_transfer- Create NFT transfers with post-conditionsgenerate_sip009_template- Generate complete SIP-009 compliant contracts
๐ Security & Post-Conditions (5 tools)
generate_fungible_post_condition- Mandatory FT post-conditionsgenerate_nonfungible_post_condition- Mandatory NFT post-conditionsgenerate_stx_post_condition- STX transfer post-conditionsanalyze_transaction_post_conditions- Validate transaction securitygenerate_post_condition_template- Security templates and patterns
โก Performance Optimization - SIP-012 (3 tools)
analyze_contract_performance- Comprehensive performance analysisestimate_operation_cost- Cost estimation for Clarity operationsgenerate_optimization_recommendations- SIP-012 optimization strategies
๐ค Account Management (4 tools)
get_stacks_account_info- Comprehensive account informationcheck_stx_balance- Simple STX and token balance checksget_transaction_history- Account transaction history with paginationvalidate_stacks_address- Address format and network validation
๐งช Development & Testing (4 tools)
generate_clarinet_project- Complete Clarinet project setupgenerate_clarity_contract- SIP-compliant contract generationgenerate_contract_tests- Unit, integration, and security testsconfigure_clarinet_project- Network and environment configuration
๐จ Frontend Development (3 tools)
build_clarity_smart_contract- Smart contract development guidancebuild_stacks_frontend- Frontend integration with @stacks/connectbuild_stacks_dapp- Complete full-stack development guide
๐ Quick Start Guide
1. Explore Available Standards
// Discover all SIP standards
use tool: list_sips
// Get specific token standards
use tool: get_token_standards
// Access complete Clarity reference
use tool: get_clarity_book2. Build a SIP-010 Token
// Generate compliant token contract
use tool: generate_sip010_template
params: {
tokenName: "MyToken",
symbol: "MTK",
decimals: 6,
features: ["minting", "burning"]
}
// Create secure transfer
use tool: generate_sip010_transfer
params: {
contractId: "ST1H1733V5MZ3SZ9XRW9FKYGEZT0JDGEB8Y634C7R.my-token",
amount: 1000000,
sender: "ST1H1733V5MZ3SZ9XRW9FKYGEZT0JDGEB8Y634C7R",
recipient: "ST2CY5V39NHDPWSXMW9QDT3HC3GD6Q6XX4CFRK9AG",
memo: "Secure transfer with post-conditions"
}3. Set Up Development Environment
// Initialize Clarinet project
use tool: generate_clarinet_project
params: {
projectName: "my-stacks-project",
template: "fungible-token"
}
// Generate comprehensive tests
use tool: generate_contract_tests
params: {
contractName: "my-token",
testType: "security",
scenarios: ["post-conditions", "authorization"]
}๐ Security Features
Mandatory Post-Conditions
All token transfers MUST include post-conditions. The MCP server enforces this:
// โ
CORRECT: Transfer with post-conditions
use tool: generate_fungible_post_condition
params: {
address: "ST1H1733V5MZ3SZ9XRW9FKYGEZT0JDGEB8Y634C7R",
contractId: "ST1H1733V5MZ3SZ9XRW9FKYGEZT0JDGEB8Y634C7R.token",
amount: 1000000,
condition: "equal"
}
// Always use PostConditionMode.Deny for maximum securitySIP Compliance Enforcement
Automatic SIP-009 and SIP-010 compliance checking
Native asset function usage (ft-transfer?, nft-transfer?)
Proper error handling and authorization patterns
โก Performance Optimization
SIP-012 Benefits
2x Database Operations: Increased read/write limits per block
Dynamic List Storage: Pay only for actual data size
Optimized Cost Functions: 100+ improved cost calculations
// Analyze contract performance
use tool: analyze_contract_performance
params: {
contractCode: "...", // Your Clarity contract
optimizationLevel: "advanced"
}
// Get optimization recommendations
use tool: generate_optimization_recommendations
params: {
contractPattern: "token-contract",
currentIssues: ["high gas costs", "multiple map operations"]
}๐ Comprehensive Documentation
Access to complete Stacks development resources:
34,000+ lines of Clarity Book documentation
30+ SIP standards with full implementations
Security patterns and best practices
Performance optimization guides
Frontend integration examples
๐๏ธ Integration Examples
React Frontend with @stacks/connect
// Get complete frontend guidance
use tool: build_stacks_frontend
// Generate wallet connection code
// Transaction signing with post-conditions
// Error handling and user experienceDeFi Protocol Development
// Performance-optimized DeFi contract
use tool: generate_clarity_contract
params: {
contractName: "amm-pool",
contractType: "custom",
features: ["governance", "staking"]
}
// Security testing
use tool: generate_contract_tests
params: {
contractName: "amm-pool",
testType: "security",
scenarios: ["reentrancy", "authorization", "post-conditions"]
}NFT Marketplace
// SIP-009 compliant NFT collection
use tool: generate_sip009_template
params: {
collectionName: "Art Collection",
symbol: "ART",
features: ["metadata", "royalties"]
}
// Marketplace contract with escrow
use tool: generate_clarity_contract
params: {
contractName: "nft-marketplace",
contractType: "custom",
features: ["escrow", "royalties"]
}๐ง Development Workflow
Research Standards: Use
list_sipsandget_sipto understand requirementsGenerate Contracts: Use template tools for SIP-compliant implementations
Security Testing: Generate comprehensive security test suites
Performance Optimization: Analyze and optimize using SIP-012 tools
Frontend Integration: Build user interfaces with wallet connectivity
Deployment: Use Clarinet tools for production deployment
๐ Production Checklist
โ SIP compliance validated
โ Mandatory post-conditions implemented
โ Security tests passing
โ Performance optimized with SIP-012
โ Frontend properly integrated
โ All tests (unit, integration, security) passing
๐ Troubleshooting
MCP Server Not Appearing in Cursor
Check MCP Settings:
Go to
Cursor โ Settings โ Cursor Settings โ MCPLook for
stacks-clarity-mcpentryCheck if indicator is green (connected) or red (error)
Click on the entry to see error details
Verify Configuration:
Ensure
.cursor/mcp.jsonexists in project rootFor local development, use absolute path to
server.tsCheck that Node.js is installed:
node --version
Restart Cursor:
Completely quit Cursor (not just close window)
Reopen Cursor
Wait 10-15 seconds for MCP to initialize
Check Agent Mode:
In Cursor chat, ensure dropdown is set to Agent (not normal chat)
MCP tools only work in Agent mode
Test MCP Connection:
# Test the server directly npx tsx /path/to/server.ts # Or use MCP Inspector npx @modelcontextprotocol/inspector
Common Issues
"Command not found": Make sure you're using npx tsx not just tsx
"Module not found": Run npm install in the MCP server directory
Build errors: For local development, use tsx to run from source (skips build step)
Tools not visible: Ensure you're in Agent mode and the MCP shows green indicator
Getting Help
Check integration guides for detailed setup
Review development_usage.md for local development
Use MCP Inspector to test tools:
npx @modelcontextprotocol/inspector
๐ค Contributing
This MCP server implements the complete Stacks development stack. Contributions should maintain:
Security-first principles
SIP standard compliance
Performance optimization focus
Comprehensive documentation
๐ License
This project is licensed under the Apache-2.0 License.
๐ Resources
Built for professional Stacks development with security, performance, and compliance as top priorities.
Available Tools
36 toolsanalyze_contract_performanceC
Analyze a Clarity contract for performance bottlenecks and SIP-012 optimization opportunities. Provides detailed cost breakdown and optimization recommendations.
Inputs: contractCode (required), optimizationLevel (required), functionName.
analyze_transaction_post_conditionsB
Analyze a contract call to determine what post-conditions are required for security. Essential for complex transactions.
Inputs: contractAddress (required), contractName (required), expectedTransfers (required), functionName (required).
build_clarity_smart_contractA
Build a Clarity smart contract - returns comprehensive resources for Clarity development including SIP standards, security patterns, and best practices. Use this tool when you need guidance on building smart contracts for Stacks.
Inputs: no named parameters.
build_stacks_dappA
Build a complete full-stack Stacks dApp - returns comprehensive resources covering Clarity contracts, frontend integration, token standards, and security patterns. Use this tool when you need guidance on building complete Stacks applications.
Inputs: no named parameters.
build_stacks_frontendA
Build a Stacks dApp frontend - returns comprehensive resources for frontend development including wallet integration, transaction signing, and post-condition handling. Use this tool when you need guidance on building frontends for Stacks dApps.
Inputs: no named parameters.
check_stx_balanceB
Check the STX balance for a Stacks address. Simple and fast balance lookup.
Inputs: address (required), token.
configure_clarinet_projectC
Configure Clarinet project settings for different networks, add dependencies, and set up development environment.
Inputs: network (required), requirements.
estimate_operation_costB
Estimate the computational cost of specific Clarity operations based on SIP-012 cost functions. Useful for planning contract optimization.
Inputs: dataSize (required), operation (required), iterations.
generate_clarinet_projectC
Generate a complete Clarinet project setup with proper structure, configuration, and starter contracts.
Inputs: projectName (required), projectPath, template.
generate_clarity_contractC
Generate a complete Clarity contract with SIP compliance, security best practices, and comprehensive functionality.
Inputs: contractName (required), contractType (required), features.
generate_contract_testsC
Generate comprehensive test suites for Clarity contracts including unit tests, integration tests, and security tests.
Inputs: contractName (required), testType (required), scenarios.
generate_fungible_post_conditionA
Generate a fungible token post-condition for SIP-010 tokens. Post-conditions are MANDATORY for all token transfers.
Inputs: amount (required), assetName (required), conditionCode (required), contractAddress (required), +2 more.
generate_non_fungible_post_conditionA
Generate a non-fungible token post-condition for SIP-009 NFTs. Post-conditions are MANDATORY for all NFT transfers.
Inputs: assetName (required), conditionCode (required), contractAddress (required), contractName (required), +2 more.
generate_optimization_recommendationsC
Generate specific optimization recommendations for Clarity contracts based on SIP-012 improvements and best practices.
Inputs: contractPattern (required), currentIssues (required), targetThroughput.
generate_post_condition_templateC
Generate a complete post-condition template for common transaction patterns with security best practices.
Inputs: assets (required), transactionType (required).
generate_sip009_templateB
Generate a complete, production-ready SIP-009 NFT contract template with all security features and optional marketplace functionality.
Inputs: baseUri (required), collectionName (required), collectionSymbol (required), includeMarketplace (required), +2 more.
generate_sip009_transferB
Generate a SIP-009 NFT transfer transaction with proper post-conditions. Returns the transaction parameters for wallet signing.
Inputs: contractAddress (required), contractName (required), network (required), recipient (required), +2 more.
generate_sip010_templateB
Generate a complete, production-ready SIP-010 fungible token contract template with all security features and best practices.
Inputs: decimals (required), includeMinting (required), initialSupply (required), tokenName (required), +1 more.
generate_sip010_transferB
Generate a SIP-010 fungible token transfer transaction with proper post-conditions. Returns the transaction parameters for wallet signing.
Inputs: amount (required), contractAddress (required), contractName (required), network (required), +3 more.
generate_stx_post_conditionB
Generate an STX post-condition for STX transfers. Essential for payment and fee transactions.
Inputs: amount (required), conditionCode (required), principal (required).
get_clarity_bookB
Get the complete Clarity Book - comprehensive Clarity language documentation covering all language features, syntax, and best practices.
Inputs: no named parameters.
get_mcp_versionB
Returns the version of the MCP server
Inputs: no named parameters.
get_sipA
Get the complete content of a specific SIP (Stacks Improvement Proposal) by number, including any Clarity smart contract code.
Inputs: sipNumber (required).
get_sip009_collection_infoC
Get information about a SIP-009 NFT collection including total supply and last token ID.
Inputs: contractAddress (required), contractName (required), network (required).
get_sip009_token_infoB
Get complete information about a specific SIP-009 NFT including owner, metadata URI, and actual metadata content.
Inputs: contractAddress (required), contractName (required), network (required), tokenId (required).
get_sip010_balanceB
Get the SIP-010 fungible token balance for a specific address. Returns the balance in base units (consider decimals for display).
Inputs: address (required), contractAddress (required), contractName (required), network (required).
get_sip010_infoB
Get complete information about a SIP-010 fungible token including name, symbol, decimals, total supply, and metadata URI.
Inputs: contractAddress (required), contractName (required), network (required).
get_stacks_account_infoB
Get comprehensive information about a Stacks account including STX balance, nonce, tokens, and recent activity.
Inputs: address (required), includeTokens, includeTransactions.
get_token_standardsA
Get the essential token standards for Stacks - SIP-009 (NFT) and SIP-010 (Fungible Token) complete with Clarity trait definitions and implementation guidance.
Inputs: no named parameters.
get_transaction_historyB
Get detailed transaction history for a Stacks address with pagination support.
Inputs: address (required), limit, offset.
list_sipsA
Get a list of all available SIPs (Stacks Improvement Proposals) in the knowledge base. Use this first to discover available Stacks standards.
Inputs: no named parameters.
search_sipsB
Search through all SIPs for content matching a specific query. Useful for finding standards related to specific topics.
Inputs: query (required).
stacks_clarity_best_practices_promptA
PRIMARY PROMPT: Use this as the main system prompt when building any Stacks dApp or Clarity contract. Sets up mandatory MCP consultation workflow for Stacks development and ensures SIP compliance.
Inputs: no named parameters.
stacks_clarity_development_reminder_promptB
MID-DEVELOPMENT REMINDER: Use this prompt when you notice the conversation has gone few exchanges without using MCP tools, or when implementing new Stacks features to reinforce MCP consultation habits.
Inputs: no named parameters.
stacks_debugging_helper_promptA
ERROR RECOVERY PROMPT: Use this immediately when encountering Stacks/Clarity errors, stuck in debugging loops, or when about to try generic blockchain solutions. Redirects to MCP-first debugging approach.
Inputs: no named parameters.
validate_stacks_addressB
Validate a Stacks address format and check if it's correctly formatted for the specified network.
Inputs: address (required), network.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogโฆ
TDQS
Scored across 36 tools
Most tools have distinct purposes, but there is some overlap in generation and analysis tools. For example, generate_clarity_contract and generate_sip009_template both create contracts, though one is generic and the other specific. Similarly, analyze_contract_performance and generate_optimization_recommendations both focus on optimization, which could cause confusion. However, descriptions help differentiate them, and most tools target unique resources or actions.
Tool names follow a highly consistent verb_noun pattern throughout, such as analyze_contract_performance, check_stx_balance, and generate_sip009_template. There are no deviations in naming conventions, with all tools using snake_case and clear, descriptive verbs. This predictability makes it easy for agents to understand and select tools.
With 36 tools, the count is excessive for the server's purpose of Stacks Clarity development and management. Many tools could be consolidated or removed without losing functionality, such as multiple generate_* tools or prompt tools. This large number may overwhelm agents and lead to inefficiency, indicating a poor scope management.
The tool set provides comprehensive coverage for Stacks Clarity development, including contract analysis, generation, testing, token standards (SIP-009/010), transaction handling, balance checks, and debugging. There are no obvious gaps; it supports full CRUD/lifecycle operations for contracts and tokens, along with essential utilities like address validation and version checking.
Related MCP Connectors
The OpenZeppelin Stellar Contracts MCP server generates secure smart contracts for the Stellar blockchain based on OpenZeppelin templates. It integrates with AI assistants to automatically enforce OpenZeppelin's security best practices, style rules, and standards at every prompt, enabling developers to create production-ready Fungible Token, Non-Fungible Token, and Stablecoin contracts through AI-driven workflows.
The OpenZeppelin Stylus Contracts MCP server generates secure smart contracts for the Arbitrum Stylus environment using OpenZeppelin templates, including ERC-20, ERC-721, and ERC-1155 standards. It automatically validates generated code against OpenZeppelin's security and style rules, enforcing best practices for imports, modifiers, naming conventions, and security checks to prevent common vulnerabilities. The server integrates with AI development tools like Cursor, Claude, Gemini, Windsurf, and VS Code to enable AI-assisted, production-ready smart contract development.
Stacks chain data: contracts, events, transfers, subgraph scaffolds. Hosted with browser sign-in.
The OpenZeppelin Solidity Contracts MCP server integrates OpenZeppelin's security and style rules into AI-driven development workflows, enabling AI assistants to generate safe, correct, and production-ready smart contracts. It automatically validates generated code against OpenZeppelin standards (including imports, modifiers, naming conventions, and security checks) and supports various contract types including ERC-20, ERC-721, ERC-1155, Stablecoins, RWA, Governor, and Account contracts through prompt-driven workflows.
Related MCP Servers
- -licenseBqualityNot gradedmaintenanceEnables developers to build Base mini apps from start to finish with 10 specialized tools for generating manifests, starter code, deployment guides, design guidelines, and debugging assistance. Integrates official Base documentation to streamline the complete development workflow for Base ecosystem mini applications.10-
- AlicenseNot gradedqualityDmaintenanceA comprehensive MCP server providing unified access to over 144 tools for lending, trading, and staking across six major DeFi protocols on the Stacks Bitcoin Layer 2. It enables AI agents to perform complex blockchain operations and interact with the DeFi ecosystem using natural language commands.3MIT
- FlicenseNot gradedqualityDmaintenanceProvides 667 specialized tools for financial and operational tasks, including fund accounting, compliance, DeFi, and tax management. It enables users to integrate extensive financial intelligence and automated workflows into any MCP-compatible client.1-
- AlicenseNot gradedqualityDmaintenanceProvides 76 tools for enterprise Solana development, enabling stablecoin issuance, payments, trading, wallet management, and compliance screening via natural language.14 npmMIT