# MDF MCP Server
A Model Context Protocol (MCP) server for analyzing ASAM MDF (Measurement Data Format) files. Enables AI assistants to access and analyze automotive and industrial measurement data.
## ๐ Quick Start
### Using uvx (Recommended)
```bash
# Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh
# Run the server directly
uvx mcp-server-mdf
```
### Local Development
```bash
# Clone and setup
git clone https://github.com/Shanko-26/mdfmcp
cd mdfmcp
# Install in virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -e .
# Run the server
mcp-server-mdf
```
## ๐ Features
- **MDF File Support**: Versions 2.x, 3.x, and 4.x
- **AI-Native Interface**: Designed for LLM integration
- **Data Analysis**: Statistics, plotting, signal processing
- **Format Export**: CSV, HDF5, Parquet, MATLAB
- **Session Management**: Multi-file support
- **High Performance**: Efficient large file handling
## ๐ง Configuration
**Important**: This MCP server requires direct file system access to read MDF files. It works best with IDEs that support local file operations.
### Compatible IDEs
#### For VS Code with Continue.dev
Add to your MCP configuration:
```json
{
"mcpServers": {
"mdf": {
"command": "uvx",
"args": ["mcp-server-mdf@latest"]
}
}
}
```
#### For Cursor IDE
Add to `~/.cursor/mcp.json`:
```json
{
"mcpServers": {
"mdf": {
"command": "uvx",
"args": ["mcp-server-mdf@latest"]
}
}
}
```
#### For Windsurf/Codeium
Follow your IDE's MCP configuration guide with the same uvx command.
#### Troubleshooting uvx Path Issues
If you get "command not found" errors, find your uvx path:
```bash
which uvx # On macOS/Linux
where uvx # On Windows
```
Then use the full path in your configuration:
```json
{
"mcpServers": {
"mdf": {
"command": "/Users/username/.local/bin/uvx",
"args": ["mcp-server-mdf"]
}
}
}
```
## ๐ File Organization
**Smart Workspace Search**: The server automatically finds MDF files in your project:
```
your-project/
โโโ data.mf4 # โ
Found by filename
โโโ data/
โ โโโ test.mf4 # โ
Found in data/ folder
โโโ measurements/
โ โโโ run1.mf4 # โ
Found in measurements/ folder
โโโ test_data/
โโโ examples/
โโโ samples/
```
**Usage Examples**:
- `"data.mf4"` โ Searches workspace automatically
- `"./data/test.mf4"` โ Relative path from current directory
- `"/absolute/path/file.mf4"` โ Full absolute path
- Case insensitive: `"DATA.MF4"` finds `"data.mf4"`
## ๐ Staying Current
**Always use latest version** by adding `@latest` to your IDE configuration:
```json
{
"mcpServers": {
"mdf": {
"command": "uvx",
"args": ["mcp-server-mdf@latest"]
}
}
}
```
**Check version**: `uvx mcp-server-mdf@latest --version`
## ๐ Usage Examples
### Open and Analyze MDF Files
```
User: Open the measurement file at /data/test_drive.mf4
Assistant: I'll open that MDF file for you.
[Opens file]
Successfully opened test_drive.mf4:
- Session ID: mdf_a3b2c1d4
- Version: 4.10
- Channels: 847
- Duration: 1823.4 seconds
```
### List and Search Channels
```
User: What temperature channels are available?
Assistant: Let me search for temperature-related channels.
Found 23 temperature channels:
- Engine_Temp (ยฐC) - Engine coolant temperature
- Oil_Temp (ยฐC) - Engine oil temperature
- Ambient_Temp (ยฐC) - Outside air temperature
```
### Analyze and Plot Signals
```
User: Show me the engine speed statistics and plot it
Assistant: I'll analyze the engine speed signal.
Engine Speed Analysis:
- Mean: 2,847 RPM
- Max: 6,234 RPM
- Std Dev: 1,123 RPM
[Shows time-series plot of engine speed]
```
## ๐ ๏ธ Available Tools
### Session Management
- `open_mdf` - Open an MDF file
- `close_mdf` - Close a session
- `list_sessions` - Show active sessions
- `get_file_info` - Get file metadata
### Data Access
- `list_channels` - List available channels
- `mdf_get` - Extract single channel data
- `mdf_select` - Extract multiple channels
- `mdf_get_master` - Get time channel data
### Analysis
- `calculate_statistics` - Compute signal statistics
- `plot_signals` - Create visualizations
- `mdf_to_dataframe` - Convert to pandas DataFrame
### Data Manipulation
- `mdf_cut` - Extract time slice
- `mdf_filter` - Filter specific channels
- `mdf_resample` - Change sampling rate
### Export
- `mdf_export` - Export to various formats
- `mdf_convert` - Convert between MDF versions
- `mdf_save` - Save modified file
## ๐ณ Docker Deployment (Alternative)
### Build Image
```bash
docker build -t mcp-server-mdf .
```
### Run Container
```bash
# Basic run
docker run -it --rm mcp-server-mdf
# With volume mount for data
docker run -it --rm -v /path/to/mdf/files:/data mcp-server-mdf
# With custom environment
docker run -it --rm -e MAX_SESSIONS=20 mcp-server-mdf
```
### MCP Configuration for Docker
```json
{
"mcpServers": {
"mdf": {
"command": "docker",
"args": ["run", "--rm", "-i", "-v", "/path/to/data:/data", "mcp-server-mdf"]
}
}
}
```
## ๐งช Testing
```bash
# Run tests
pytest tests/
# Test server manually
python tests/manual_test.py
```
## ๐ Project Structure
```
mdfmcp/
โโโ src/mdfmcp/
โ โโโ __init__.py
โ โโโ server.py # Main MCP server
โโโ tests/
โ โโโ conftest.py
โ โโโ manual_test.py
โ โโโ test_server.py
โโโ examples/
โ โโโ basic_usage.py
โ โโโ test_data_generator.py
โโโ Dockerfile
โโโ requirements.txt
โโโ pyproject.toml
โโโ README.md
```
## ๐ง Development
### Setup Development Environment
```bash
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Install in development mode
pip install -e .
```
### Code Quality
```bash
# Format code
black src/
# Lint
ruff src/
# Type checking
mypy src/
```
## ๐จ Troubleshooting
### Common Issues
1. **Memory errors with large files**
- Use `memory="low"` when opening files
- Reduce concurrent sessions
2. **Cannot find channels**
- Channel names are case-sensitive
- Use regex patterns for flexible searching
3. **Docker build fails**
- Ensure Docker is running
- Check Dockerfile syntax
## ๐ Acknowledgments
- Built on [asammdf](https://github.com/danielhrisca/asammdf) by Daniel Hrisca (LGPL v3+)
- Uses the [Model Context Protocol](https://modelcontextprotocol.io) by Anthropic
- Matplotlib for plotting capabilities
- Pandas and NumPy for data processing
## ๐ License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
**Dependencies**: This project uses asammdf which is licensed under LGPL v3+. The asammdf library remains a separate component and is not modified by this project.
Raw data
{
"_id": null,
"home_page": null,
"name": "mcp-server-mdf",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "automotive, data-analysis, mcp, mdf, model-context-protocol",
"author": null,
"author_email": "Shanko <shanko_26@yahoo.co.in>",
"download_url": "https://files.pythonhosted.org/packages/7b/13/2f71a541919fa403289080aaa92421d57f0dca00c00d75febfdcaafd1213/mcp_server_mdf-0.1.3.tar.gz",
"platform": null,
"description": "# MDF MCP Server\n\nA Model Context Protocol (MCP) server for analyzing ASAM MDF (Measurement Data Format) files. Enables AI assistants to access and analyze automotive and industrial measurement data.\n\n## \ud83d\ude80 Quick Start\n\n### Using uvx (Recommended)\n\n```bash\n# Install uv (if not already installed)\ncurl -LsSf https://astral.sh/uv/install.sh | sh\n\n# Run the server directly\nuvx mcp-server-mdf\n```\n\n### Local Development\n\n```bash\n# Clone and setup\ngit clone https://github.com/Shanko-26/mdfmcp\ncd mdfmcp\n\n# Install in virtual environment\npython -m venv venv\nsource venv/bin/activate # On Windows: venv\\Scripts\\activate\npip install -e .\n\n# Run the server\nmcp-server-mdf\n```\n\n## \ud83d\udccb Features\n\n- **MDF File Support**: Versions 2.x, 3.x, and 4.x\n- **AI-Native Interface**: Designed for LLM integration\n- **Data Analysis**: Statistics, plotting, signal processing\n- **Format Export**: CSV, HDF5, Parquet, MATLAB\n- **Session Management**: Multi-file support\n- **High Performance**: Efficient large file handling\n\n## \ud83d\udd27 Configuration\n\n**Important**: This MCP server requires direct file system access to read MDF files. It works best with IDEs that support local file operations.\n\n### Compatible IDEs\n\n#### For VS Code with Continue.dev\n\nAdd to your MCP configuration:\n\n```json\n{\n \"mcpServers\": {\n \"mdf\": {\n \"command\": \"uvx\",\n \"args\": [\"mcp-server-mdf@latest\"]\n }\n }\n}\n```\n\n#### For Cursor IDE\n\nAdd to `~/.cursor/mcp.json`:\n\n```json\n{\n \"mcpServers\": {\n \"mdf\": {\n \"command\": \"uvx\",\n \"args\": [\"mcp-server-mdf@latest\"]\n }\n }\n}\n```\n\n#### For Windsurf/Codeium\n\nFollow your IDE's MCP configuration guide with the same uvx command.\n\n#### Troubleshooting uvx Path Issues\n\nIf you get \"command not found\" errors, find your uvx path:\n```bash\nwhich uvx # On macOS/Linux \nwhere uvx # On Windows\n```\nThen use the full path in your configuration:\n```json\n{\n \"mcpServers\": {\n \"mdf\": {\n \"command\": \"/Users/username/.local/bin/uvx\",\n \"args\": [\"mcp-server-mdf\"]\n }\n }\n}\n```\n\n## \ud83d\udcc1 File Organization\n\n**Smart Workspace Search**: The server automatically finds MDF files in your project:\n\n```\nyour-project/\n\u251c\u2500\u2500 data.mf4 # \u2705 Found by filename\n\u251c\u2500\u2500 data/\n\u2502 \u2514\u2500\u2500 test.mf4 # \u2705 Found in data/ folder\n\u251c\u2500\u2500 measurements/\n\u2502 \u2514\u2500\u2500 run1.mf4 # \u2705 Found in measurements/ folder\n\u251c\u2500\u2500 test_data/\n\u251c\u2500\u2500 examples/\n\u2514\u2500\u2500 samples/\n```\n\n**Usage Examples**:\n- `\"data.mf4\"` \u2192 Searches workspace automatically\n- `\"./data/test.mf4\"` \u2192 Relative path from current directory \n- `\"/absolute/path/file.mf4\"` \u2192 Full absolute path\n- Case insensitive: `\"DATA.MF4\"` finds `\"data.mf4\"`\n\n## \ud83d\udd04 Staying Current\n\n**Always use latest version** by adding `@latest` to your IDE configuration:\n\n```json\n{\n \"mcpServers\": {\n \"mdf\": {\n \"command\": \"uvx\",\n \"args\": [\"mcp-server-mdf@latest\"]\n }\n }\n}\n```\n\n**Check version**: `uvx mcp-server-mdf@latest --version`\n\n## \ud83d\udcca Usage Examples\n\n### Open and Analyze MDF Files\n\n```\nUser: Open the measurement file at /data/test_drive.mf4\nAssistant: I'll open that MDF file for you.\n\n[Opens file]\nSuccessfully opened test_drive.mf4:\n- Session ID: mdf_a3b2c1d4\n- Version: 4.10\n- Channels: 847\n- Duration: 1823.4 seconds\n```\n\n### List and Search Channels\n\n```\nUser: What temperature channels are available?\nAssistant: Let me search for temperature-related channels.\n\nFound 23 temperature channels:\n- Engine_Temp (\u00b0C) - Engine coolant temperature\n- Oil_Temp (\u00b0C) - Engine oil temperature\n- Ambient_Temp (\u00b0C) - Outside air temperature\n```\n\n### Analyze and Plot Signals\n\n```\nUser: Show me the engine speed statistics and plot it\nAssistant: I'll analyze the engine speed signal.\n\nEngine Speed Analysis:\n- Mean: 2,847 RPM\n- Max: 6,234 RPM\n- Std Dev: 1,123 RPM\n\n[Shows time-series plot of engine speed]\n```\n\n## \ud83d\udee0\ufe0f Available Tools\n\n### Session Management\n- `open_mdf` - Open an MDF file\n- `close_mdf` - Close a session\n- `list_sessions` - Show active sessions\n- `get_file_info` - Get file metadata\n\n### Data Access\n- `list_channels` - List available channels\n- `mdf_get` - Extract single channel data\n- `mdf_select` - Extract multiple channels\n- `mdf_get_master` - Get time channel data\n\n### Analysis\n- `calculate_statistics` - Compute signal statistics\n- `plot_signals` - Create visualizations\n- `mdf_to_dataframe` - Convert to pandas DataFrame\n\n### Data Manipulation\n- `mdf_cut` - Extract time slice\n- `mdf_filter` - Filter specific channels\n- `mdf_resample` - Change sampling rate\n\n### Export\n- `mdf_export` - Export to various formats\n- `mdf_convert` - Convert between MDF versions\n- `mdf_save` - Save modified file\n\n## \ud83d\udc33 Docker Deployment (Alternative)\n\n### Build Image\n\n```bash\ndocker build -t mcp-server-mdf .\n```\n\n### Run Container\n\n```bash\n# Basic run\ndocker run -it --rm mcp-server-mdf\n\n# With volume mount for data\ndocker run -it --rm -v /path/to/mdf/files:/data mcp-server-mdf\n\n# With custom environment\ndocker run -it --rm -e MAX_SESSIONS=20 mcp-server-mdf\n```\n\n### MCP Configuration for Docker\n\n```json\n{\n \"mcpServers\": {\n \"mdf\": {\n \"command\": \"docker\",\n \"args\": [\"run\", \"--rm\", \"-i\", \"-v\", \"/path/to/data:/data\", \"mcp-server-mdf\"]\n }\n }\n}\n```\n\n## \ud83e\uddea Testing\n\n```bash\n# Run tests\npytest tests/\n\n# Test server manually\npython tests/manual_test.py\n```\n\n## \ud83d\udcc1 Project Structure\n\n```\nmdfmcp/\n\u251c\u2500\u2500 src/mdfmcp/\n\u2502 \u251c\u2500\u2500 __init__.py\n\u2502 \u2514\u2500\u2500 server.py # Main MCP server\n\u251c\u2500\u2500 tests/\n\u2502 \u251c\u2500\u2500 conftest.py\n\u2502 \u251c\u2500\u2500 manual_test.py\n\u2502 \u2514\u2500\u2500 test_server.py\n\u251c\u2500\u2500 examples/\n\u2502 \u251c\u2500\u2500 basic_usage.py\n\u2502 \u2514\u2500\u2500 test_data_generator.py\n\u251c\u2500\u2500 Dockerfile\n\u251c\u2500\u2500 requirements.txt\n\u251c\u2500\u2500 pyproject.toml\n\u2514\u2500\u2500 README.md\n```\n\n## \ud83d\udd27 Development\n\n### Setup Development Environment\n\n```bash\n# Create virtual environment\npython -m venv venv\nsource venv/bin/activate # On Windows: venv\\Scripts\\activate\n\n# Install dependencies\npip install -r requirements.txt\n\n# Install in development mode\npip install -e .\n```\n\n### Code Quality\n\n```bash\n# Format code\nblack src/\n\n# Lint\nruff src/\n\n# Type checking\nmypy src/\n```\n\n## \ud83d\udea8 Troubleshooting\n\n### Common Issues\n\n1. **Memory errors with large files**\n - Use `memory=\"low\"` when opening files\n - Reduce concurrent sessions\n\n2. **Cannot find channels**\n - Channel names are case-sensitive\n - Use regex patterns for flexible searching\n\n3. **Docker build fails**\n - Ensure Docker is running\n - Check Dockerfile syntax\n\n## \ud83d\ude4f Acknowledgments\n\n- Built on [asammdf](https://github.com/danielhrisca/asammdf) by Daniel Hrisca (LGPL v3+)\n- Uses the [Model Context Protocol](https://modelcontextprotocol.io) by Anthropic\n- Matplotlib for plotting capabilities\n- Pandas and NumPy for data processing\n\n## \ud83d\udcc4 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n**Dependencies**: This project uses asammdf which is licensed under LGPL v3+. The asammdf library remains a separate component and is not modified by this project.",
"bugtrack_url": null,
"license": "MIT",
"summary": "MCP Server for ASAM MDF file analysis",
"version": "0.1.3",
"project_urls": {
"Homepage": "https://github.com/Shanko-26",
"Issues": "https://github.com/Shanko-26/mdfmcp/issues",
"Repository": "https://github.com/Shanko-26/mdfmcp"
},
"split_keywords": [
"automotive",
" data-analysis",
" mcp",
" mdf",
" model-context-protocol"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "36e489e9a56deb5b9c31d6d1b96711604519997a5eeb0f101120c7fb65a2c7cf",
"md5": "e7884cb9c940dc0e44471322807f9768",
"sha256": "5c3ed8c1924d77365755987fb86da4c5c529ca33e808663d16d10889593fce77"
},
"downloads": -1,
"filename": "mcp_server_mdf-0.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e7884cb9c940dc0e44471322807f9768",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 14763,
"upload_time": "2025-07-25T06:06:37",
"upload_time_iso_8601": "2025-07-25T06:06:37.505993Z",
"url": "https://files.pythonhosted.org/packages/36/e4/89e9a56deb5b9c31d6d1b96711604519997a5eeb0f101120c7fb65a2c7cf/mcp_server_mdf-0.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "7b132f71a541919fa403289080aaa92421d57f0dca00c00d75febfdcaafd1213",
"md5": "496b6381ce39fb7cb1902171e252018f",
"sha256": "17d25eac9ac841599b65d97e020c9a114bc1c4f62f8d98862f93cab8e2f80ba0"
},
"downloads": -1,
"filename": "mcp_server_mdf-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "496b6381ce39fb7cb1902171e252018f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 29746,
"upload_time": "2025-07-25T06:06:38",
"upload_time_iso_8601": "2025-07-25T06:06:38.596390Z",
"url": "https://files.pythonhosted.org/packages/7b/13/2f71a541919fa403289080aaa92421d57f0dca00c00d75febfdcaafd1213/mcp_server_mdf-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-25 06:06:38",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Shanko-26",
"github_project": "mdfmcp",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "mcp",
"specs": [
[
">=",
"1.4.0"
]
]
},
{
"name": "asammdf",
"specs": [
[
">=",
"8.0.0"
]
]
},
{
"name": "numpy",
"specs": [
[
">=",
"1.24.0"
]
]
},
{
"name": "pandas",
"specs": [
[
">=",
"2.0.0"
]
]
},
{
"name": "matplotlib",
"specs": [
[
">=",
"3.6.0"
]
]
}
],
"lcname": "mcp-server-mdf"
}