MCP Client Setup
This page shows you how to set up different AI tools to work with the Mflo x402 MCP server.
Prerequisites: First get your MCP server configuration from x402 MCP Server Integration.
Supported Clients
Choose your AI tool:
Setup Instructions
Visual Studio Code (with Cline)
-
Install Cline extension
- Go to Extensions in VS Code
- Search for "Cline" and install it
-
Add MCP server
- Open Settings → search "MCP Servers"
- Paste your JSON configuration from the integration page
- Set your
PRIVATE_KEY
-
Restart VS Code
- Command Palette → "Developer: Reload Window"
-
Test it
- Open Cline panel
- Ask: "list datasets"
- The AI will connect to the MCP server and show results
Cursor IDE
-
Open Cursor settings
- Go to Cursor → Settings
- Search for "MCP"
-
Add MCP server
- Paste your JSON configuration
- Set your
PRIVATE_KEY
-
Restart Cursor
-
Test it
- In Chat/Composer, ask: "list datasets"
- Cursor will connect and return data
Claude Desktop
-
Find config file
- Location:
~/Library/Application Support/Claude/claude_desktop_config.json
- Location:
-
Add configuration
{ "mcpServers": { "@mfloai/x402-mcp": { "command": "npx", "args": [ "-y", "-p", "@mfloai/x402-mcp@demo", "x402-mcp" ], "env": { "PRIVATE_KEY": "EVM_PRIVATE_KEY" } } } } -
Restart Claude Desktop
-
Test it
- Ask Claude: "list available datasets"
- Claude will use the MCP server automatically
What You Can Do
Once set up, your AI can:
- Browse datasets: "What datasets are available?"
- Get data details: "Show me details for the Bitcoin dataset"
- Query data: "Get me the latest Bitcoin price"
- Download datasets: "Download the crypto trading data"
The AI handles all payments automatically using your private key.
Additional Integrations
Continue.dev (VS Code Extension)
Continue.dev provides AI coding assistance with MCP tool support.
Setup:
- Install Continue extension in VS Code
- Configure MCP server in Continue settings
- Enable tool usage in your Continue configuration
Use Cases:
- Data-driven code generation
- Real-time market data for trading algorithms
- Research assistance with live datasets
Cody by Sourcegraph
Cody can integrate with MCP servers for enhanced context.
Integration:
- Configure MCP server in Cody settings
- Use datasets for code analysis and suggestions
- Access real-time data during development
Custom Agent Frameworks
LangChain Integration
from langchain.tools import Tool
from mcp_client import MCPClient
# Connect to Mflo MCP server
mcp = MCPClient("npx @mfloai/x402-mcp@demo")
# Create LangChain tools
dataset_tool = Tool(
name="get_crypto_data",
description="Get cryptocurrency price data",
func=mcp.call_tool
)AutoGen Integration
import autogen
from mcp_integration import MfloMCPTool
# Add Mflo tools to AutoGen AI agent
agent = autogen.AssistantAgent(
name="data_analyst",
tools=[MfloMCPTool()]
)CrewAI Integration
from crewai import Agent, Tool
from mflo_mcp import MfloDataTool
agent = Agent(
role='Data Analyst',
tools=[MfloDataTool()]
)Enterprise Integrations
Jupyter Notebooks
Use the MCP server in data science workflows:
import subprocess
import json
# Call MCP server directly
result = subprocess.run([
"npx", "@mfloai/x402-mcp@demo",
"--tool", "get_dataset",
"--args", "{\"id\": \"crypto-prices\"}"
], capture_output=True, text=True)
data = json.loads(result.stdout)API Gateway Integration
Proxy MCP tools through your existing API infrastructure:
// Express.js middleware
app.post('/api/mcp/:tool', async (req, res) => {
const { tool } = req.params;
const result = await mcpClient.callTool(tool, req.body);
res.json(result);
});Slack/Discord Bots
Integrate dataset access into chat platforms:
// Discord.js bot with MCP
bot.on('messageCreate', async (message) => {
if (message.content.startsWith('!crypto')) {
const data = await mcpClient.callTool('get_crypto_data');
message.reply('Current BTC price: ' + data.price);
}
});Development Frameworks
Next.js Applications
Server-side dataset fetching with MCP:
// pages/api/data.js
import { MCPClient } from '@mflo/mcp-client';
export default async function handler(req, res) {
const mcp = new MCPClient();
const data = await mcp.getDataset(req.query.id);
res.json(data);
}React Components
Client-side MCP integration:
import { useMCP } from '@mflo/react-mcp';
function DatasetViewer({ datasetId }) {
const { data, loading, error } = useMCP('get_dataset', { id: datasetId });
if (loading) return <div>Loading...</div>;
return <div>{`JSON.stringify(data, null, 2)`}</div>;
}Protocol Compatibility
MCP Version Support
- MCP 1.0: Full compatibility
- MCP 2.0: Planned support
- Legacy protocols: Bridge adapters available
Transport Methods
- HTTP: Standard REST API calls
- WebSocket: Real-time data streaming
- gRPC: High-performance integrations
- SSE: Server-sent events for live updates
Authentication Patterns
API Key Proxy
For clients that don't support private key signing:
// Proxy server handles wallet operations
app.use('/mcp-proxy', (req, res, next) => {
req.headers['x-private-key'] = process.env.WALLET_PRIVATE_KEY;
next();
});Multi-tenant Support
Different private keys per client:
{
"mcpServers": {
"mflo-client-a": {
"command": "npx",
"args": ["-y", "@mfloai/x402-mcp@demo"],
"env": {
"PRIVATE_KEY": "0xCLIENT_A_KEY"
}
},
"mflo-client-b": {
"command": "npx",
"args": ["-y", "@mfloai/x402-mcp@demo"],
"env": {
"PRIVATE_KEY": "0xCLIENT_B_KEY"
}
}
}
}Monitoring & Analytics
Usage Tracking
Monitor MCP tool usage across clients:
// Track tool calls
mcpClient.on('tool_call', (tool, args, result) => {
analytics.track('mcp_tool_used', {
tool,
client: req.headers['user-agent'],
success: !result.error
});
});Performance Metrics
- Tool call latency
- Payment processing time
- Error rates by client type
- Dataset popularity
Security Considerations
Private Key Management
- Use dedicated keys per client
- Implement key rotation policies
- Monitor for unusual spending patterns
- Set spending limits per key
Network Security
- TLS encryption for all communications
- VPN requirements for enterprise deployments
- IP allowlisting for sensitive environments
Audit Logging
- Log all tool calls and payments
- Track data access patterns
- Monitor for suspicious activity
- Compliance reporting capabilities