# ethereum_transactions_test MCP Server

MCP (Model Context Protocol) server for querying **ethereum_transactions_test** blockchain subgraph data using natural language and Cypher queries.

## 🚀 Quick Start

### Installation

```bash
npx @graphi-ai/mcp-eth-test-subgraph-7
```

### Usage in Claude Desktop

Add to your Claude Desktop configuration:

```json
{
  "mcpServers": {
    "eth-test-subgraph-7": {
      "command": "npx",
      "args": ["mcp-eth-test-subgraph-7"]
    }
  }
}
```

**That's it!** No database credentials or configuration needed. 🎉

## 🔧 Configuration

The MCP server comes pre-configured with the correct API endpoint. No environment variables are required for basic operation.

### Optional Environment Variables

| Variable | Description | Default |
|----------|-------------|---------|
| `SUBGRAPH_ID` | Override the subgraph ID (advanced users only) | `98177761-64ca-4268-aa69-cba0b00768df` |

## 📡 Features

- **🔍 Natural Language Queries**: Ask questions like "Show me recent large transfers"
- **⚡ Cypher Query Execution**: Execute custom Cypher queries with automatic subgraph filtering
- **🛡️ Data Isolation**: Automatic `subgraph_id` filtering ensures you only see relevant data
- **🌐 Dynamic Schema**: Fetches real-time schema information from the chat interface
- **🔒 Secure**: No need to manage database credentials - everything goes through the chat interface API

## 🎯 Available Tools

### `cypher_query`

Execute Cypher queries against the ethereum_transactions_test subgraph.

**Parameters:**
- `query` (string, required): Cypher query to execute
- `params` (object, optional): Query parameters

**Example:**
```cypher
MATCH (t:Transfer) 
WHERE t.subgraph_id = $subgraph_id 
  AND t.value > 1000000000000000000 
RETURN t 
ORDER BY t.timestamp DESC 
LIMIT 10
```

## 📊 Subgraph Information

- **Subgraph ID**: `98177761-64ca-4268-aa69-cba0b00768df`
- **Network**: `ethereum-mainnet`
- **Description**: Track all Ethereum ERC20 transfers for testing

## 🔄 How It Works

1. **Schema Fetching**: Automatically fetches schema information from the chat interface API
2. **Query Execution**: Sends Cypher queries to the chat interface for execution
3. **Data Filtering**: Automatically adds `subgraph_id` filtering to ensure data isolation
4. **Result Formatting**: Returns properly formatted results for Claude to understand

## 🛠️ Development

### Local Development

```bash
# Clone and install
git clone https://github.com/graphi-ai/mcp-eth-test-subgraph-7.git
cd mcp-eth-test-subgraph-7
npm install

# Build
npm run build

# Run locally
npm start
```

### Configuration for Development

Create a `.env` file:

```env
CHAT_INTERFACE_BASE_URL=http://localhost:8000
SUBGRAPH_ID=98177761-64ca-4268-aa69-cba0b00768df
```

## 🔍 Example Queries

### Recent Transfers
```cypher
MATCH (t:Transfer) 
WHERE t.subgraph_id = $subgraph_id 
RETURN t 
ORDER BY t.timestamp DESC 
LIMIT 20
```

### Top Wallets by Activity
```cypher
MATCH (w:Wallet) 
WHERE w.subgraph_id = $subgraph_id 
RETURN w.address, w.transaction_count 
ORDER BY w.transaction_count DESC 
LIMIT 10
```

### Token Information
```cypher
MATCH (token:Token) 
WHERE token.subgraph_id = $subgraph_id 
RETURN token.symbol, token.name, token.address
```

## 🚨 Important Notes

- **Data Isolation**: All queries must include `WHERE n.subgraph_id = $subgraph_id` for data isolation
- **Automatic Filtering**: The `subgraph_id` parameter is automatically added to your queries
- **API Dependency**: This server requires access to the GraphAI chat interface API
- **No Direct DB Access**: Queries are processed through the chat interface, not directly against the database

## 📞 Support

- **Issues**: [GitHub Issues](https://github.com/graphi-ai/mcp-eth-test-subgraph-7/issues)
- **Documentation**: [GraphAI Documentation](https://docs.graphi-ai.com)
- **Chat Interface**: Part of the GraphAI ecosystem

## 📄 License

MIT License - see [LICENSE](LICENSE) for details.

---

**Powered by [GraphAI](https://graphi-ai.com) 🚀** 