Enables blockchain interactions for USDC transfers and Ethereum transactions through Alchemy's HTTP provider, supporting real cryptocurrency disbursements and payments for the microloan system
Provides wallet address verification, USDC token transfers, and blockchain transaction processing for microloan disbursements and repayments on the Ethereum network
Shark MCP - AI Agent Microloan Server
An MCP (Model Context Protocol) server for providing microloans to AI agents for x402 transactions. Built with FastAPI and FastMCP, this server enables AI agents to request small loans to pay for HTTP 402 Payment Required transactions.
Features
- Agent Registration: Whitelist-based registration with wallet address verification
- Microloan Processing: Automated underwriting and disbursement for small loans (<$1 initially)
- x402 Integration: Automatic payment of x402 transactions on behalf of agents
- Credit Management: Progressive credit limits based on repayment history
- Risk Assessment: Comprehensive credit scoring and risk evaluation
- Automated Collections: Overdue loan detection and collection processes
- MCP Tools: Rich set of tools for AI agents to interact with the loan system
MCP Tools Available
request_loan(wallet_address, amount, purpose?, x402_url?)
- Request a microloancheck_credit_limit(wallet_address)
- Check available credit and limitsrepay_loan(loan_id, amount, payment_hash?)
- Repay a loanget_loan_status(loan_id)
- Get detailed loan informationlist_agent_loans(wallet_address)
- List all loans for an agentregister_agent(wallet_address, signature, message?)
- Register as a new agent
Quick Start
1. Setup Database
2. Configure Alchemy for USDC Transfers
To enable real USDC transfers (instead of mock transactions), you need to configure Alchemy:
- Get an Alchemy API Key:
- Sign up at Alchemy
- Create a new app for Ethereum mainnet
- Copy your API key
- Set up a Vault Wallet:
- Create a new Ethereum wallet to hold USDC for disbursements
- Fund it with USDC and some ETH for gas fees
- Export the private key
- Configure Environment Variables:
- Update USDC Contract Address:
- In
src/shark_mcp/mcp_server.py
, replace the placeholder USDC contract address with the real one:
- In
Note: The system uses web3.py with Alchemy's HTTP provider for blockchain interactions. Without these configurations, the system will use mock transactions for demonstration purposes.
3. Install Dependencies
4. Run Database Migrations
5. Start the Server
6. Access MCP Server
The MCP server is available at: http://localhost:8000/mcp
API documentation: http://localhost:8000/docs
Architecture
Core Components
- Agent Management: Registration, whitelisting, and wallet verification
- Loan Processing: Underwriting, disbursement, and repayment tracking
- Credit Assessment: Risk scoring and credit limit progression
- Collection System: Automated overdue detection and collection
- x402 Integration: Automatic payment of HTTP 402 transactions
Database Models
- Agent: Stores agent information and credit profiles
- Loan: Individual loan records with status tracking
- Transaction: Payment and repayment transaction history
- AuditLog: Comprehensive audit trail for all actions
Credit Tiers
Tier | Min Successful Loans | Max Credit Limit |
---|---|---|
Starter | 0 | $1.00 |
Bronze | 3 | $2.50 |
Silver | 10 | $5.00 |
Gold | 25 | $10.00 |
Platinum | 50 | $25.00 |
Diamond | 100 | $50.00 |
Usage Example
For AI Agents
For Administrators
Development
Running Tests
Code Formatting
Type Checking
Security
- All agents must provide cryptographic signatures proving wallet ownership
- Whitelist-based access control for loan eligibility
- Comprehensive audit logging for all operations
- Automated risk assessment and credit scoring
- Progressive credit limits based on payment history
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
License
MIT License - see LICENSE file for details.
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Enables AI agents to request and manage microloans for HTTP 402 Payment Required transactions. Provides automated underwriting, credit management, and USDC disbursement with progressive credit limits based on repayment history.
Related MCP Servers
- -securityAlicense-qualityEnables AI models to interact with the Lightning Network by providing an MCP-compliant API to pay invoices.Last updated -33TypeScriptMIT License
- -securityFlicense-qualityAn MCP server that enables AI assistants to interact with Flutterwave payment services, providing tools for transaction management, payment link generation, and automated customer support.Last updated -TypeScript
- AsecurityFlicenseAqualityA server that provides easy access to Payman AI's APIs, allowing users to create payees, search payees, send payments, and check balances using natural language prompts.Last updated -53JavaScript
- -securityFlicense-qualityA Model Context Protocol server that connects to a payments company's developer portal, providing AI assistants with access to payment documentation, APIs, and guides.Last updated -JavaScript