|
| 1 | +# IPFS Datasets MCP Server Integration |
| 2 | + |
| 3 | +This document outlines the Model Context Protocol (MCP) server implementation for IPFS Datasets Python. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +The IPFS Datasets MCP server provides a standardized interface for AI models to interact with IPFS datasets. It implements the Model Context Protocol, allowing AI assistants to perform operations like: |
| 8 | + |
| 9 | +- Loading datasets from various sources |
| 10 | +- Saving datasets to IPFS |
| 11 | +- Converting dataset formats |
| 12 | +- Processing datasets with transformations |
| 13 | +- Querying dataset content |
| 14 | +- Managing IPFS interactions |
| 15 | +- Vector search operations |
| 16 | +- Knowledge graph interactions |
| 17 | +- Audit logging |
| 18 | +- Security operations |
| 19 | +- Provenance tracking |
| 20 | + |
| 21 | +## Architecture |
| 22 | + |
| 23 | +The MCP server implementation consists of: |
| 24 | + |
| 25 | +1. **Core Server**: Implements the MCP protocol using either the `modelcontextprotocol` package or a simplified Flask-based implementation. |
| 26 | + |
| 27 | +2. **Tool Categories**: |
| 28 | + - `dataset_tools`: Tools for dataset operations |
| 29 | + - `ipfs_tools`: Tools for IPFS interactions |
| 30 | + - `vector_tools`: Tools for vector operations and similarity search |
| 31 | + - `graph_tools`: Tools for knowledge graph operations |
| 32 | + - `audit_tools`: Tools for audit logging |
| 33 | + - `security_tools`: Tools for security operations |
| 34 | + - `provenance_tools`: Tools for tracking provenance |
| 35 | + - `cli`: Command-line interface tools |
| 36 | + - `functions`: Function execution tools |
| 37 | + |
| 38 | +3. **Configuration System**: Flexible configuration via YAML files |
| 39 | + |
| 40 | +4. **IPFS Kit Integration**: Built-in integration with `ipfs_kit_py` |
| 41 | + |
| 42 | +## Getting Started |
| 43 | + |
| 44 | +### Installation |
| 45 | + |
| 46 | +The MCP server is included in the IPFS Datasets Python package. |
| 47 | + |
| 48 | +```bash |
| 49 | +pip install ipfs-datasets-py |
| 50 | +``` |
| 51 | + |
| 52 | +### Running the Server |
| 53 | + |
| 54 | +You can start the server using: |
| 55 | + |
| 56 | +```bash |
| 57 | +cd /path/to/ipfs_datasets_py |
| 58 | +./ipfs_datasets_py/mcp_server/start_server.sh |
| 59 | +``` |
| 60 | + |
| 61 | +Or for the simplified implementation: |
| 62 | + |
| 63 | +```bash |
| 64 | +cd /path/to/ipfs_datasets_py |
| 65 | +./ipfs_datasets_py/mcp_server/start_simple_server.sh |
| 66 | +``` |
| 67 | + |
| 68 | +### Demo Script |
| 69 | + |
| 70 | +We provide a demo script that starts the server and tests its functionality: |
| 71 | + |
| 72 | +```bash |
| 73 | +./demo_mcp_server.py |
| 74 | +``` |
| 75 | + |
| 76 | +## Available Tools |
| 77 | + |
| 78 | +The server provides tools in the following categories: |
| 79 | + |
| 80 | +1. **Dataset Tools**: |
| 81 | + - `load_dataset`: Load a dataset from a source |
| 82 | + - `save_dataset`: Save a dataset to a destination |
| 83 | + - `convert_dataset_format`: Convert a dataset between formats |
| 84 | + - `process_dataset`: Apply transformations to a dataset |
| 85 | + |
| 86 | +2. **IPFS Tools**: |
| 87 | + - `get_from_ipfs`: Get content from IPFS |
| 88 | + - `pin_to_ipfs`: Pin content to IPFS |
| 89 | + |
| 90 | +3. **Vector Tools**: |
| 91 | + - `create_vector_index`: Create a vector index from dataset |
| 92 | + - `search_vector_index`: Search a vector index |
| 93 | + |
| 94 | +4. **Graph Tools**: |
| 95 | + - `query_knowledge_graph`: Query a knowledge graph |
| 96 | + |
| 97 | +5. **Audit Tools**: |
| 98 | + - `record_audit_event`: Record an audit event |
| 99 | + - `generate_audit_report`: Generate an audit report |
| 100 | + |
| 101 | +6. **Security Tools**: |
| 102 | + - `check_access_permission`: Check access permissions |
| 103 | + |
| 104 | +7. **Provenance Tools**: |
| 105 | + - `record_provenance`: Record provenance information |
| 106 | + |
| 107 | +8. **CLI Tools**: |
| 108 | + - `execute_command`: Execute a command |
| 109 | + |
| 110 | +9. **Function Tools**: |
| 111 | + - `execute_python_snippet`: Execute a Python code snippet |
| 112 | + |
| 113 | +## Integration Tests |
| 114 | + |
| 115 | +To run the integration tests: |
| 116 | + |
| 117 | +```bash |
| 118 | +python test_mcp_integration.py |
| 119 | +``` |
| 120 | + |
| 121 | +This will verify: |
| 122 | +- The server component structure |
| 123 | +- Core functionality |
| 124 | +- Tool availability |
| 125 | +- IPFS Kit integration |
| 126 | + |
| 127 | +## Integration with AI Assistants |
| 128 | + |
| 129 | +AI assistants like Claude can interact with datasets through this MCP server implementation, enabling capabilities like: |
| 130 | + |
| 131 | +- Loading and analyzing data from IPFS |
| 132 | +- Processing datasets with specified transformations |
| 133 | +- Performing similarity searches using vector indices |
| 134 | +- Querying knowledge graphs |
| 135 | +- Generating data visualizations |
| 136 | +- Recording audit events and provenance information |
0 commit comments