Data MCP Server

Data MCP Server

Enables scientific data introspection and visualization of VTK datasets with format-adaptive metadata extraction and interactive 3D visualization through MCP tools.

Category
访问服务器

README

Data MCP Server

A Model Context Protocol (MCP) server for scientific data introspection and visualization. Provides comprehensive analysis of VTK datasets with format-specific metadata extraction and interactive 3D visualization.

✨ Features

  • 10 MCP Tools for complete dataset analysis
  • Format-Adaptive Metadata - Specialized handlers for VTI, VTU, VTP formats
  • Interactive 3D Visualization using Trame/VTK
  • Memory-Efficient Architecture with automatic cleanup
  • Comprehensive Component Analysis with detailed statistics

🚀 Quick Start

1. Setup Environment

# Clone or navigate to the project directory
cd data-mcp

# Create and activate virtual environment
python -m venv .venv
source .venv/bin/activate  # On macOS/Linux
# .venv\Scripts\activate   # On Windows

# Install dependencies
pip install -r requirements.txt
pip install -e .

2. Run Basic Demo

# Test MCP server functionality
python examples/walkthrough/demo_mcp_usage.py

3. Sample Data

Pre-generated VTK files in examples/sample_data/:

  • gaussian_simple.vti - 3D structured grid (20×15×12)
  • wave_pattern.vti - Wave pattern data

4. Interactive Visualization

# Launch 3D viewer (opens at localhost:8080)
python -c "
from src.data_mcp.viewers.vtk_viewer import VTKViewer
VTKViewer.show_file('examples/sample_data/gaussian_simple.vti')
"

5. Start MCP Server

# Start the MCP server (requires MCP client to connect)
python -m data_mcp.server

🔌 MCP Client Configuration

Connecting MCP Clients

Use the provided mcp_client_config.json to connect MCP-compatible clients:

{
  "mcpServers": {
    "data-mcp": {
      "command": "python",
      "args": ["-m", "data_mcp.server"],
      "cwd": "/Users/patrick.oleary/code/AI Experiments/data-mcp",
      "env": {}
    }
  }
}

Supported MCP Clients

  • Claude Desktop - Anthropic's desktop application
  • Custom MCP applications - Built with MCP client libraries
  • Development tools - IDEs and testing frameworks with MCP support

Integration Steps

  1. Copy the config to your MCP client's configuration directory
  2. Update the cwd path to match your project location
  3. Restart your MCP client to register the server
  4. Access via client - The server will appear as "data-mcp" with 10 available tools

🧪 Testing & Examples

Comprehensive Walkthrough

# Test all 10 MCP tools with detailed output
python examples/walkthrough/manual_tool_test.py

# Test format-specific metadata adaptation
python examples/walkthrough/test_format_adaptation.py

Integration Tests

# Full MCP workflow testing
python tests/integration/test_full_mcp_workflow.py

# Real MCP client connection test
python tests/integration/test_real_mcp_client.py

🎯 Available MCP Tools

  • upload_dataset - Load and register dataset files
  • list_datasets - Show all loaded datasets
  • query_dataset - Get comprehensive dataset information
  • get_schema - Extract detailed schema information
  • list_components - Show available data arrays/components
  • get_component_info - Get detailed component information
  • get_statistics - Calculate statistics for components
  • visualize_dataset - Launch interactive 3D viewer
  • suggest_visualizations - Get visualization recommendations
  • remove_dataset - Remove dataset from memory

📋 Usage Examples

Programmatic Usage

from data_mcp.formats.vtk_factory import VTKHandlerFactory
from data_mcp.core.dataset import Dataset
from data_mcp.viewers.vtk_viewer import VTKViewer

# Load dataset with format-specific handler
handler = VTKHandlerFactory.create_handler("path/to/file.vti")
dataset = Dataset("path/to/file.vti", handler)
dataset.introspect()

# Get comprehensive information
info = dataset.get_info()
components = dataset.list_components()
stats = dataset.get_statistics("temperature")

# Launch interactive viewer (convenience method)
VTKViewer.show_file("path/to/file.vti")  # Opens at localhost:8080

# Or create viewer with dataset
viewer = VTKViewer(dataset=dataset)
viewer.show()

MCP Client Usage

Connect via MCP client and use these tools:

  • Upload datasets, query metadata, analyze components
  • Get format-specific information (VTI/VTU/VTP)
  • Launch interactive 3D visualizations
  • Calculate detailed statistics

🏗️ Architecture

Format Handler Inheritance System

  • BaseVTKHandler - Common VTK functionality
  • VTKImageDataHandler (.vti) - Structured grids with spacing/dimensions
  • VTKUnstructuredGridHandler (.vtu) - Irregular meshes with cell analysis
  • VTKPolyDataHandler (.vtp) - Surface meshes with topology analysis
  • VTKHandlerFactory - Automatic handler selection by file extension

Supported Formats

Currently supports VTK formats with format-specific metadata:

  • .vti - ImageData (regular grids, voxel data)
  • .vtu - UnstructuredGrid (irregular meshes, FEM data)
  • .vtp - PolyData (surface meshes, CAD data)

Memory Management

  • Automatic cleanup after dataset introspection
  • Stored component data for efficient access
  • Handler recycling to prevent memory bloat

📁 Project Structure

data-mcp/
├── README.md                    # Project documentation
├── MCP_WALKTHROUGH.md          # Comprehensive walkthrough guide
├── pyproject.toml              # Python packaging configuration
├── requirements.txt            # Dependencies
├── src/data_mcp/              # Main package
│   ├── server.py              # MCP server implementation
│   ├── core/                  # Core functionality
│   │   ├── dataset.py         # Dataset abstraction with cleanup
│   │   ├── introspector.py    # Dataset analysis engine
│   │   ├── schema.py          # Schema representation
│   │   └── visualizer.py      # Visualization engine
│   ├── formats/               # Format handlers (inheritance system)
│   │   ├── base.py           # Base format handler interface
│   │   ├── vtk_base.py       # Base VTK handler
│   │   ├── vtk_imagedata.py  # VTI handler (structured grids)
│   │   ├── vtk_unstructured.py # VTU handler (irregular meshes)
│   │   ├── vtk_polydata.py   # VTP handler (surface meshes)
│   │   └── vtk_factory.py    # Handler factory
│   ├── viewers/               # Trame-based visualization
│   │   └── vtk_viewer.py     # VTK 3D viewer
│   └── utils/                 # Utilities
│       └── file_utils.py     # File handling
├── examples/                  # Usage examples
│   ├── basic_usage.py        # Basic programmatic usage
│   ├── walkthrough/          # Walkthrough examples
│   │   ├── demo_mcp_usage.py # Basic MCP demo
│   │   ├── manual_tool_test.py # All 10 tools test
│   │   └── test_format_adaptation.py # Format adaptation demo
│   └── sample_data/          # Sample VTK files
│       ├── gaussian_simple.vti # 3D structured grid
│       └── wave_pattern.vti   # Wave pattern data
└── tests/                     # Test suite
    ├── integration/           # Integration tests
    └── test_formats/         # Format handler tests

🔧 Current Status

  • ✅ 10/10 MCP Tools Working (100% success rate)
  • ✅ Format-Adaptive Metadata for VTI/VTU/VTP files
  • ✅ Memory-Efficient Architecture with automatic cleanup
  • ✅ Interactive 3D Visualization via Trame/VTK
  • ✅ Production-Ready for scientific data workflows

📚 Documentation

🤝 Contributing

This project demonstrates a production-ready MCP server with:

  • Format-adaptive metadata extraction
  • Memory-efficient architecture
  • Comprehensive testing suite
  • Interactive visualization capabilities

For extending to new formats, follow the inheritance pattern established in the VTK handlers.

📄 License

MIT License - see LICENSE file for details.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选