This document outlines the security considerations for the MCP Blockchain Server & DApp system.
- Private Key Isolation: Private keys never leave the user's wallet
- Transaction Verification: Clear UI for reviewing transaction details
- API Authentication: Secure API key management
- Rate Limiting: Prevent abuse
- Input Validation: Sanitize all inputs
- Audit Logging: Track all operations
- HTTPS Only: Secure communications
- Content Security Policy: Prevent XSS
- Regular Security Audits: Establish process
The most critical security aspect of this system is that private keys never leave the user's wallet. This is achieved through the following mechanisms:
- Transactions are prepared by the MCP Server without requiring private keys
- Users review and sign transactions using their own wallets
- Only signed transactions are submitted to the blockchain
- The MCP Server never has access to private keys
The transaction signing flow is designed to ensure that users have full control over their transactions:
- AI assistant requests a transaction through the MCP Server
- MCP Server prepares an unsigned transaction with a UUID
- MCP Server returns a URL for the user to review the transaction
- User opens the URL in their browser
- Web DApp prompts the user to connect their wallet
- Web DApp displays transaction details for review
- User approves and signs the transaction with their wallet
- Web DApp submits the signed transaction to the blockchain
API authentication is implemented using JWT tokens. API keys are used to obtain JWT tokens, which are then used for subsequent API calls.
API rate limiting is implemented to prevent abuse. Rate limits are applied based on API key.
All API inputs are validated and sanitized to prevent injection attacks.
All communications are secured using HTTPS.
A Content Security Policy is implemented to prevent XSS attacks.
CORS is configured to restrict access to the API from unauthorized origins.
All operations are logged for audit purposes. Logs include:
- API requests and responses
- Transaction preparation and submission
- User actions
- Authentication events
A process for regular security audits is established. This includes:
- Code reviews
- Dependency vulnerability scanning
- Penetration testing
- Security bug bounty program
An incident response plan is established to handle security incidents. This includes:
- Incident classification
- Containment procedures
- Investigation procedures
- Communication plan
- Recovery procedures
- Always review transaction details carefully before signing
- Use a hardware wallet when possible
- Keep wallet software up to date
- Be cautious of phishing attempts
- Do not share API keys or private keys
- Enable two-factor authentication where available
- Monitor account activity regularly