Cyberlink
Cyberlink MCP Server
A Model Context Protocol (MCP) server for interacting with the CW-Social smart contract on Cosmos-based blockchains. This server provides a standardized interface for creating, updating, and querying cyberlinks - semantic relationships between entities on the blockchain.
Features
- Full CRUD operations for cyberlinks
- Named cyberlink support
- Batch operations
- Rich query capabilities
- Transaction status tracking
- Input validation
- Error handling
- Integration with Cursor IDE and Claude Desktop
Prerequisites
- Node.js 16+
- npm or yarn
- Access to a Cosmos blockchain node
- Wallet with funds for transactions
- Cursor IDE installed
- Claude Desktop installed
Installation and Setup
- Clone the repository:
git clone https://github.com/your-org/cw-social-mcp.git
cd cw-social-mcp
- Install dependencies:
npm install
- Build the project:
npm run build
Integration Configuration
Both Cursor IDE and Claude Desktop use the same MCP configuration format. Create or edit the configuration file:
- For Cursor:
~/.cursor/mcp.json
Add the following configuration:
{
"mcpServers": {
"cw-graph": {
"command": "node",
"args": ["PATH_TO_YOUR_PROJECT/dist/index.js"],
"env": {
"NODE_URL": "http://localhost:26657",
"WALLET_MNEMONIC": "your wallet mnemonic phrase",
"CONTRACT_ADDRESS": "your contract address",
"DENOM": "stake"
}
}
}
}
Replace the following values:
PATH_TO_YOUR_PROJECT
: Absolute path to your cw-social-mcp projectNODE_URL
: Your Cosmos node URLWALLET_MNEMONIC
: Your wallet's mnemonic phraseCONTRACT_ADDRESS
: Your deployed contract addressDENOM
: (Optional) Token denomination, defaults to 'stake'
The configuration uses stdio format for communication between the MCP server and the clients (Cursor/Claude Desktop).
Verification
- Restart Cursor IDE or Claude Desktop after configuration
- The following tools should be available:
- create_cyberlink
- create_named_cyberlink
- create_cyberlinks
- update_cyberlink
- delete_cyberlink
- query_cyberlinks
- query_named_cyberlinks
- query_cyberlinks_by_owner
- query_config
- query_wallet_balance
- send_tokens
Development
- Build the project:
npm run build
- Start the server in development mode:
npm run dev
Project Structure
src/
├── index.ts # Main entry point
├── cyberlink-service.ts # Cyberlink and blockchain operations
└── types.ts # TypeScript types and schemas
cursor_rules/
└── chat_history.mdc # Rules for chat history storage
Cursor Rules
The project includes cursor rules that define behavior for specific features:
- Chat History Storage: Rules defining how chat history is stored and managed within the system. These rules ensure consistent handling of conversation data across the MCP server.
Copy rules into ./cursor/rules
directory
MCP Tools
Creation and Modification
mcp_cw_graph_create_cyberlink
- Create a new cyberlinkmcp_cw_graph_create_named_cyberlink
- Create a named cyberlink with identifiermcp_cw_graph_create_cyberlinks
- Create multiple cyberlinks in batchmcp_cw_graph_update_cyberlink
- Update an existing cyberlink by IDmcp_cw_graph_delete_cyberlink
- Delete a cyberlink by ID
Basic Queries
mcp_cw_graph_query_by_id
- Query a single cyberlink by numeric IDmcp_cw_graph_query_by_formatted_id
- Query a cyberlink by its formatted IDmcp_cw_graph_query_cyberlinks
- Query all cyberlinks with paginationmcp_cw_graph_query_named_cyberlinks
- Query all named cyberlinksmcp_cw_graph_query_by_ids
- Query multiple cyberlinks by their IDs
Advanced Queries
mcp_cw_graph_query_by_owner
- Query cyberlinks by owner addressmcp_cw_graph_query_by_time_range
- Query cyberlinks by creation time rangemcp_cw_graph_query_by_time_range_any
- Query cyberlinks by creation or update time range
System Queries
mcp_cw_graph_query_last_id
- Get the last assigned cyberlink IDmcp_cw_graph_query_config
- Query contract configurationmcp_cw_graph_query_debug_state
- Query contract debug state (admin only)mcp_cw_graph_get_tx_status
- Check transaction status and get cyberlink IDs
Wallet Operations
mcp_cw_graph_query_wallet_balance
- Get wallet address and token balancesmcp_cw_graph_send_tokens
- Send tokens to another wallet address
Query Parameters
Time Range Queries
owner
- Owner address to filter bystart_time
- Start time in nanoseconds (Uint64, can be passed as string or number)end_time
- Optional end time in nanoseconds (Uint64, can be passed as string or number)start_after
- Optional pagination cursor (Uint64, can be passed as string or number)limit
- Optional result limit (default: 50)
Pagination
Most query endpoints support pagination with:
start_after
- Cursor for the next page (Uint64, can be passed as string or number)limit
- Maximum number of results to return
Data Types
- Timestamps: All timestamp fields use Uint64 format (nanoseconds since Unix epoch)
- Can be passed as string to preserve precision for large values
- Also accepts number format for backward compatibility
- Example: "1683900000000000000" (string) or 1683900000000000000 (number)
Error Handling
The server uses standardized error codes from the MCP protocol:
InvalidParams
- Invalid input parametersMethodNotFound
- Unknown tool nameInternalError
- Blockchain or server errors
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.