使用说明
3D Force Graph MCP Server
An MCP (Model Context Protocol) server that provides tools for building 3D force-directed graph visualizations using the 3d-force-graph library.
Features
- 10 specialized tools for graph visualization development
- Domain-specific patterns for blockchain, network topology, and general graphs
- Code generation for common visualization tasks
- Layout diagnostics for troubleshooting
- Performance optimization guidance
Installation
npm install
npm run build
Usage
Claude Desktop Configuration
Add to your claude_desktop_config.json:
{
"mcpServers": {
"3d-force-graph": {
"command": "node",
"args": ["/path/to/3d-force-graph-mcp/dist/index.js"]
}
}
}
Available Tools
| Tool | Description | When to Use |
|---|---|---|
get_conceptual_foundation |
Theoretical foundation of force-directed graphs | Learning, debugging layout issues |
get_api_reference |
Complete API reference | Looking up methods, parameters |
generate_graph_config |
Generate complete configurations | Starting new projects |
generate_data_transformer |
Convert data formats | Working with APIs/databases |
configure_forces |
Optimize force settings | Tuning layout behavior |
get_code_template |
Ready-to-use code templates | Common patterns |
diagnose_layout_issue |
Fix layout problems | Troubleshooting |
get_domain_patterns |
Domain-specific best practices | Blockchain/network visualizations |
generate_interaction_handlers |
Event handler code | Adding interactivity |
get_performance_recommendations |
Optimization settings | Large graphs |
Example Queries
"I want to visualize blockchain transactions"
→ Use generate_graph_config with domain: "blockchain"
"My nodes are overlapping"
→ Use diagnose_layout_issue with symptom: "overlapping"
"How do I transform Cosmos transactions into graph data?"
→ Use generate_data_transformer with inputFormat: "cosmosTransactions"
"I have 5000 nodes, what settings should I use?"
→ Use get_performance_recommendations with nodeCount: 5000
Resources
The server also provides documentation resources:
3d-force-graph://docs/concepts- Force-directed graph theory3d-force-graph://docs/api- Full API reference (JSON)3d-force-graph://docs/patterns- Domain patterns (JSON)
Domain Support
Blockchain
- Transaction flow visualization
- Account/contract/validator node types
- IBC transfer highlighting
- Token movement particles
Network Topology
- Device type visualization (routers, switches, servers)
- Bandwidth-based link widths
- Traffic flow animation
- Custom 3D node geometries
General
- Hierarchical DAG layouts
- Clustering patterns
- Interactive highlighting
- Performance optimization
License
MIT
Examples
See the examples/ directory for complete working examples:
- blockchain-visualization.js - Cosmos transaction graph with IBC transfers
- network-topology.js - Infrastructure visualization with custom 3D shapes
- interactive-highlighting.js - Hover highlighting and path finding
Contributing
See CONTRIBUTING.md for development setup and guidelines.