Enables blockchain-based dataset trading through Ethereum smart contracts and NFT-based access controls, with automatic purchase handling for dataset access
Provides decentralized data storage and retrieval capabilities for datasets, supporting both public data previews and private encrypted data access
Implements decentralized encryption and access control for private datasets using Lit Protocol's encryption infrastructure
Filecoin Data Broker MCP Server
A Model Context Protocol (MCP) server implementation that provides blockchain-based dataset trading functionality using Filecoin, IPFS, Ethereum smart contracts, and Lit Protocol for decentralized encryption.
Overview
This project implements an MCP server that enables AI agents and applications to discover, purchase, and query datasets stored on Filecoin/IPFS with Ethereum NFT-based access controls. The server provides a secure, decentralized marketplace for data trading with Lit Protocol encrypted private datasets and public dataset previews.
Features
Core Functionality
Blockchain-Based Dataset Trading: Purchase dataset access through Ethereum NFT contracts
Lit Protocol Integration: Decentralized encryption and access control for private datasets
SynapseStorage Integration: Enhanced data fetching and management capabilities
Automatic Purchase Flow: Seamless NFT purchase during dataset queries
Public Data Previews: Query public columns without purchase
SQL Query Interface: Standard SQL queries on purchased datasets
IPFS/Filecoin Storage: Decentralized data storage and retrieval
MCP Tools
list_datasets
: Lists available datasets with metadata, pricing, and column informationquery_dataset
: Executes SQL queries on datasets with automatic purchase handling
Dataset Types
Public Columns: Available for querying without purchase, stored on IPFS
Private Columns: Encrypted with Lit Protocol, require NFT ownership to decrypt and access
Hybrid Access: Full dataset access includes both public and private data after purchase
Architecture
Core Components
Entry Point:
bin/index.js
- MCP server startup with stdio transportServer:
server.js
- MCP server instance and tool registrationDataset Factory:
lib/dataset/factory.js
- Abstract dataset creation and managementBlockchain Integration:
lib/contracts/FDBRegistry.js
- Ethereum contract interactionsEncryption Layer:
lib/lit.js
- Lit Protocol integration for decentralized encryptionStorage Layer:
lib/synapse.js
- SynapseStorage for enhanced data operations
Dataset Implementations
FilecoinDataset:
lib/dataset/filecoin/FilecoinDataset.js
- Production blockchain-based datasets with Lit Protocol decryptionLocalDataset:
lib/dataset/mock/LocalDataset.js
- Development/testing mock datasets
Security & Data Processing
SQL Security:
lib/sql.js
- Query sanitization and access controlEthereum Integration:
lib/signer.js
- Blockchain authentication and wallet managementDecentralized Encryption: Lit Protocol for secure data access control
Setup
Prerequisites
Node.js ≥20.0.0 (required for private field syntax)
Ethereum private key for blockchain access
Access to Ethereum network (mainnet or testnet)
Installation
Manual Execution
Claude Desktop
Development Mode
Edit
.env
file by filling required valuesStart MCP inspector and auto-reload:
npm run dev
This provides a debugging interface for testing tool calls and responses.
Usage
Basic Workflow
List Available Datasets:
Use
list_datasets
tool to see available datasetsReview metadata, pricing, and column information
Public columns are immediately queryable
Query Datasets with Automatic Purchase:
Use
query_dataset
tool with SQL queriesSystem automatically handles NFT purchase for private data access
Payment processed through Ethereum smart contract when needed
Lit Protocol handles decryption of private datasets post-purchase
Example Tool Usage
List datasets:
Query dataset:
Project Structure
Development
Coding Conventions
Module System: ESM modules with
.js
extensions in importsPrivate Fields: Modern
#fieldName
syntax for encapsulationAsync Patterns: Prefer async/await over Promise chains
Type Safety: JSDoc comments with TypeScript syntax for type hints
Testing with Local Datasets
For development without blockchain dependency:
Switch to
LocalDatasetFactory
inlib/dataset/factory.js
Use sample data from
sample/
directoryTest tool functionality with MCP inspector
Adding New Tools
Create tool file in
lib/tools/
directoryFollow existing tool patterns with Zod schemas
Import and register in
server.js
Test with
npm run dev
and MCP inspector
Blockchain Development
Test on testnet before mainnet deployment
Use environment variables for network configuration
Handle gas costs and transaction failures gracefully
Implement proper error handling for network issues
Security Considerations
Access Control
NFT ownership verification for private dataset access
SQL query sanitization to prevent injection attacks
Ethereum private key protection via environment variables
Data Privacy
Public columns available for preview without purchase
Lit Protocol provides decentralized encryption and access control
Automatic purchase and decryption workflows for seamless data access
Query Security
Row limits enforced on SQL queries
Table name restrictions and input validation
Error messages that don't leak sensitive information
License
MIT
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 discover, purchase, and query blockchain-based datasets using Filecoin/IPFS storage with Ethereum NFT access controls and Lit Protocol encryption. Provides a decentralized marketplace for secure dataset trading with automatic purchase workflows and SQL query capabilities.
Related MCP Servers
- AsecurityAlicenseAqualityProvides tools for AI assistants to interact with the Ethereum blockchain through standard JSON-RPC methods, enabling queries for account balances, gas prices, and smart contract code.Last updated -310MIT License
- -securityAlicense-qualityA comprehensive toolkit for building AI agents with blockchain capabilities, enabling interactions with multiple blockchain networks for tasks like wallet management, fund transfers, smart contract interactions, and cross-chain asset bridging.Last updated -3GPL 3.0
- AsecurityAlicenseAqualityIntegrates Aptos blockchain access into AI applications, enabling interaction with tools for native APT operations, custom coin management, and transaction handling.
- AsecurityAlicenseAqualityIntegrates Aptos blockchain access into AI applications, enabling interaction with tools for native APT operations, custom coin management, and transaction handling.Last updated -12MIT License