Skip to content

Commit e9144f5

Browse files
committed
DOC: Add MCP demo and content in main docs
1 parent c2d2a84 commit e9144f5

File tree

3 files changed

+101
-1
lines changed

3 files changed

+101
-1
lines changed

docs/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ A lean and kind
2525
- Writes OME-Zarr v0.4 to v0.5
2626
- [Sharded Zarr] stores
2727
- Optional writing via [tensorstore]
28+
- **Model Context Protocol (MCP) server** for AI agent integration
2829

2930
```{toctree}
3031
:maxdepth: 2
@@ -33,6 +34,7 @@ quick_start.md
3334
installation.md
3435
python.md
3536
cli.md
37+
mcp.md
3638
itk.md
3739
methods.md
3840
development.md

docs/mcp.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Model Context Protocol (MCP) Server
2+
3+
The [`ngff-zarr-mcp`] Python package provides a Model Context Protocol (MCP) server that enables seamless integration with AI agents and development tools. This server provides a standardized interface for AI agents to interact with ngff-zarr's capabilities for converting datasets to the OME-Zarr scientific imaging data format.
4+
5+
## What is MCP?
6+
7+
The Model Context Protocol (MCP) is an open standard that allows AI agents to securely access external data sources and tools. It creates a bridge between AI models and various applications, enabling them to work together more effectively.
8+
9+
## Integration with AI Agents
10+
11+
The [`ngff-zarr-mcp`] server can be integrated with various AI agents and development environments, including:
12+
13+
- **GitHub Copilot** in VS Code
14+
- **OpenCode**
15+
- **Cursor**
16+
- **Claude Code**
17+
- Any other agent that supports the MCP standard
18+
19+
This integration allows you to use natural language to:
20+
- Convert datasets to OME-Zarr format
21+
- Optimize compression codecs
22+
- Configure sharding to limit file count
23+
- Generate Python scripts for batch processing
24+
- Validate OME-Zarr stores
25+
- ... and more!
26+
27+
## Example Usage
28+
29+
Here's an example of how you might interact with the MCP server through an AI agent:
30+
31+
### OpenCode Demo
32+
33+
The `ngff-zarr-mcp` Model Context Protocol (MCP) server converts datasets to the OME-Zarr scientific imaging data format, optimizes the compression codec, ensures a limited number of files are generated, and creates a Python script for re-use.
34+
35+
<script src="https://asciinema.org/a/726628.js" id="asciicast-726628" async="true"></script>
36+
37+
#### Sample Prompts
38+
39+
> Convert LIDCFull.tif to OME-Zarr
40+
41+
> Find the optimal codec to use for this data.
42+
43+
> Use sharding to keep the number of files under 20.
44+
45+
> Create a Python script to convert all files in a provided input directory to a provided output directory. Use the codec we found to be optimal.
46+
47+
## Configuration
48+
49+
The MCP server can be configured for use with different AI agents. Here's an example configuration for OpenCode:
50+
51+
```json
52+
{
53+
"$schema": "https://opencode.ai/config.json",
54+
"mcp": {
55+
"ngff-zarr": {
56+
"type": "local",
57+
"command": ["uvx", "ngff-zarr-mcp"],
58+
"enabled": true
59+
}
60+
}
61+
}
62+
```
63+
64+
A similar configuration can be used for other agents like GitHub Copilot or Cursor, adjusting the command and environment as needed.
65+
The [`ngff-zarr-mcp`] provides guidance on how to set up the MCP server for different environments.
66+
67+
## Available Functions
68+
69+
The MCP server provides the following functions:
70+
71+
- **convert_images_to_ome_zarr**: Convert images to OME-Zarr format with customizable parameters
72+
- **get_ome_zarr_info**: Get detailed information about an OME-Zarr store
73+
- **validate_ome_zarr_store**: Validate OME-Zarr store structure and metadata
74+
- **optimize_ome_zarr_store**: Optimize existing stores with new compression/chunking
75+
76+
## Benefits
77+
78+
Using the MCP server provides several advantages:
79+
80+
1. **Natural Language Interface**: Interact with ngff-zarr using conversational prompts
81+
2. **Automated Workflows**: Let AI agents handle complex conversion tasks
82+
3. **Intelligent Optimization**: Get AI-driven recommendations for compression and chunking
83+
4. **Code Generation**: Automatically generate Python scripts for batch processing
84+
5. **Seamless Integration**: Works within your existing development environment
85+
86+
## Getting Started
87+
88+
To use the MCP server:
89+
90+
1. Install ngff-zarr with MCP support
91+
2. Configure your AI agent to use the [`ngff-zarr-mcp`] server
92+
3. Start interacting with natural language prompts
93+
94+
For detailed installation and setup instructions, the [MCP server README](https://github.com/thewtex/ngff-zarr/tree/main/mcp/README.md) for comprehensive setup instructions and examples.
95+
96+
[`ngff-zarr-mcp`]: https://pypi.org/project/ngff-zarr-mcp/

mcp/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# ngff-zarr MCP Server
22

3-
A Model Context Protocol (MCP) server that provides AI agents with the ability
3+
`ngff-zarr-mcp` is a Model Context Protocol (MCP) server that provides AI agents with the ability
44
to convert images to OME-Zarr format using the ngff-zarr library.
55

6+
[![asciicast](https://asciinema.org/a/726628.png)](https://asciinema.org/a/726628)
7+
68
## Features
79

810
### Tools

0 commit comments

Comments
 (0)