@claudium/solana-mcp-server
Version:
MCP server for Solana blockchain interaction via Solscan Pro API
106 lines (94 loc) • 3.29 kB
Markdown
# Transaction Last Tool Implementation Summary
## Tool #22 Added to Solana MCP Server
### Overview
Successfully implemented the `transaction_last` endpoint from Solscan Pro API v2.0 that retrieves the most recent transactions on the Solana blockchain.
### Implementation Details
**Files Created:**
1. `/tools/transaction/__init__.py` - Transaction tools module initialization
2. `/tools/transaction/transaction_last.py` - Main tool implementation
3. `/test_transaction_last.py` - Test file for verification
**Files Modified:**
1. `/server.py` - Added import, tool initialization, and MCP endpoint
### API Endpoint
- **Endpoint**: `/transaction/last`
- **Method**: GET
- **Parameters**: None (endpoint doesn't accept parameters)
- **Returns**: Last 10 transactions on Solana
### Features
- Retrieves recent transaction signatures, timestamps, and status
- Shows transaction fees in both SOL and lamports
- Displays instruction types and programs used
- Calculates success rate and TPS estimates
- Provides Solscan URLs for each transaction
- Includes summary statistics:
- Total transactions and success rate
- Total and average fees
- Unique signers count
- Time range and estimated TPS
- Block range information
### MCP Tool Endpoint
```python
@mcp.tool()
async def get_transaction_last() -> Dict[str, Any]:
"""
Get the most recent transactions on Solana blockchain.
Shows the latest transaction activity with details including signatures,
timestamps, block numbers, and transaction status. Returns 10 most recent
transactions for monitoring network activity.
"""
```
### Response Format
```json
{
"success": true,
"data": {
"transactions": [
{
"signature": "...",
"timestamp": 1756533803,
"time": "2025-08-30 06:03:23 UTC",
"slot": 363451070,
"status": "Success",
"fee_sol": 0.000017800,
"fee_lamports": 17800,
"signers": ["..."],
"main_signer": "...",
"instruction_count": 6,
"instruction_types": ["system:transfer", "spl-token:syncNative"],
"programs_used": ["system", "spl-token", "pump_amm"],
"program_ids": ["11111...", "Token..."],
"solscan_url": "https://solscan.io/tx/..."
}
],
"summary": {
"total_transactions": 10,
"successful": 2,
"failed": 8,
"success_rate": 20.0,
"total_fees_sol": 0.000113,
"average_fee_sol": 0.000011,
"unique_signers": 6,
"time_range": {...},
"block_range": {...}
}
},
"source": "Solscan Pro API v2.0"
}
```
### Testing
Test confirmed the tool successfully:
- Retrieves the latest 10 transactions
- Correctly parses transaction data including multi-signer transactions
- Calculates statistics accurately
- Handles instruction parsing for DeFi operations
### Server Integration
- Tool #22 added to server
- Available as `get_transaction_last` MCP endpoint
- Added to transaction tools category
- Total tools now: 22 (up from 21)
### Notes
- This endpoint always returns exactly 10 transactions
- No pagination or limit parameters supported by the API
- Useful for monitoring real-time network activity
- Shows mix of successful and failed transactions
- Includes DeFi operations (swaps, liquidity, etc.)