NOVA MCP Server

A Model Context Protocol (MCP) server for NOVA secure file-sharing on NEAR blockchain. Enables AI assistants like Claude to interact with encrypted, decentralized file storage through natural language, providing seamless group-based access control, IPFS persistence, and TEE-secured keys via Shade Agents.

Features

  • πŸ€– AI-Native Integration - Natural language interface for encrypted file operations

  • πŸ” AES-256-CBC Encryption - Client-side encryption exposed through MCP tools

  • 🌐 IPFS Storage - Decentralized file storage via Pinata

  • ⛓️ NEAR Blockchain - Immutable transaction records and access control

  • πŸ‘₯ Group Management - Fine-grained access control with member authorization

  • πŸ”‘ TEE-Secured Keys - Off-chain key storage in Shade Agents (Phala TEEs) with ed25519 token auth

  • πŸ”„ Key Rotation - Automatic key rotation on member revocation via Shade events

  • πŸš€ Composite Operations - High-level workflows for upload/retrieve

  • πŸ’¬ Conversational - Natural language commands for all NOVA operations

What is MCP?

The Model Context Protocol is an open standard that enables AI assistants to securely connect with external tools and data sources. MCP servers expose capabilities that AI models can use to perform actions on behalf of users.

NOVA's MCP server allows AI assistants to:

  • Encrypt and upload files to IPFS

  • Retrieve and decrypt files from IPFS

  • Manage blockchain-based access control groups

  • Record and query file transactions on NEAR

  • Fetch ephemeral keys from TEE-secured Shade Agents

Installation

Prerequisites

Install from PyPI (upcoming)

Install from Source

Configuration

Environment Variables

Create a .env file or set environment variables:

Claude Desktop Integration

Add to your Claude Desktop config file:

MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

After updating the config, restart Claude Desktop.

Quick Start

Once configured, interact with NOVA through natural language in Claude:

Available Tools

The MCP server exposes 11 tools for AI assistants:

File Operations

  • composite_upload - Encrypt file (using Shade key), upload to IPFS, record transaction

  • composite_retrieve - Fetch from IPFS and decrypt (using Shade key)

  • ipfs_upload - Upload encrypted data to IPFS

  • ipfs_retrieve - Retrieve data from IPFS

Encryption

  • encrypt_data - AES-256-CBC encryption

  • decrypt_data - AES-256-CBC decryption

Group Management

  • register_group - Create new access control group (auto-generates Shade key)

  • add_group_member - Grant member access

  • revoke_group_member - Revoke access and rotate Shade key

  • auth_status - Check user authorization

Key Management

  • get_shade_key - Retrieve ephemeral key from TEE-secured Shade Agent (token-gated)

Transaction Recording

  • record_near_transaction - Log file metadata on NEAR

Usage Examples

Example 1: Secure File Sharing

Example 2: Access Control

Example 3: File Retrieval

Example 4: High-Value Data Workflow

Core Concepts

Groups

Groups provide isolated access control domains. Each group has:

  • A unique identifier (group_id)

  • An owner (NEAR account) who manages membership

  • A TEE-secured encryption key (generated/rotated in Shade Agent)

  • A list of authorized members

Encryption Flow

  1. Upload: Fetch ephemeral Shade key (token-gated) β†’ Encrypt locally β†’ Upload to IPFS β†’ Record transaction

  2. Download: Fetch ephemeral Shade key β†’ Fetch from IPFS β†’ Decrypt locally

Access Control

  • Only group owners can add/revoke members

  • Keys retrieved via signed tokens (ed25519, nonce/timestamp-gated) from TEE

  • Member revocation triggers automatic TEE key rotation

  • All operations logged on NEAR blockchain; Shade attestations verified on-chain

Security Considerations

⚠️ Important Security Notes:

  1. Private Keys - Store NEAR private keys securely; never commit to version control

  2. TEE Keys - Encryption keys stored encrypted in Shade TEEsβ€”never on-chain; access via attested tokens only

  3. IPFS Privacy - IPFS content is public by CID; encryption + TEE gating essential

  4. Key Rotation - Revoked members cannot decrypt files uploaded after revocation (TEE swap)

  5. Local Decryption - Files are decrypted client-side; tokens expire post-use (replay-proof)

  6. Attestation - Shade checksums verified on-chainβ€”ensures TEE integrity

NEAR Token Deposits

Some operations require NEAR token deposits for storage:

  • register_group - ~0.1 NEAR (includes Shade init)

  • add_group_member - ~0.0005 NEAR

  • revoke_group_member - ~0.0005 NEAR (includes Shade rotate)

  • claim_token (internal) - ~0.001 NEAR

  • record_transaction - ~0.002 NEAR

Ensure your NEAR account has sufficient balance.

Development

Running Tests

Building from Source

MCP Inspector

Test the MCP server using the MCP Inspector:

Comparison with SDKs

Feature
MCP Server
JavaScript SDK
Rust SDK

Interface

Natural language

Programmatic API

Programmatic API

Use Case

AI assistants

Web/Node.js apps

System apps, smart contracts

Installation

pip install

npm install

cargo add

Encryption

Automatic

Manual control

Manual control

Integration

Claude Desktop

Any JS runtime

Any Rust project

Choose MCP for AI-assisted workflows, JS SDK for web applications, or Rust SDK for high-performance system integration.

Troubleshooting

MCP Server Not Connecting

  1. Check Claude Desktop config path is correct

  2. Verify all environment variables are set (incl. SHADE_API_URL)

  3. Restart Claude Desktop after config changes

  4. Check logs: ~/Library/Logs/Claude/mcp-*.log (MacOS)

NEAR Transaction Failures

  1. Verify account has sufficient balance: near state your-account.testnet

  2. Check private key format: ed25519:base58_encoded_key

  3. Ensure contract ID is correct for network (testnet/mainnet)

Shade/TEE Issues

  1. Verify SHADE_API_URL reachable (e.g., curl {SHADE_API_URL}/api/key-management/get_key)

  2. Check checksum mismatches: Ensure update_checksum called post-gen

  3. Token errors: Validate timestamp/nonce in payload; refresh if expired

IPFS Upload Failures

  1. Verify Pinata API credentials are correct

  2. Check file size limits (100MB default on free tier)

  3. Ensure stable internet connection

Resources

Support

Contributing

Contributions are welcome! Please:

  1. Fork the repository

  2. Create a feature branch

  3. Add tests for new functionality

  4. Ensure all tests pass (pytest)

  5. Submit a pull request

License

This project is licensed under the MIT License - see LICENSE file for details.

Last updated