MCP ExplorerExplorer

Mcp Contracts

@z1labson 10 months ago
2 MIT
FreeCommunity
AI Systems
MCP ContextStore is a smart contract for storing hashed AI agent contexts on-chain.

Overview

What is Mcp Contracts

mcp-contracts is a smart contract repository for the Model Context Protocol (MCP), specifically designed to serve as a minimal on-chain registry for hashed model contexts used by AI agents.

Use cases

Use cases include creating contextual GPT agents that maintain memory of conversations, enabling proof-of-memory, replayable agent states, auditable inference flows, and incentivized memory registries with on-chain royalties.

How to use

Users can interact with the ContextStore by calling the ‘putContext’ function to store a 32-byte hash of their context, which is timestamped and associated with their user address.

Key features

Key features include the ability to store 64-byte content identifiers, immutable and timestamped entries, zk-friendly hash-only payloads, gas efficiency at approximately 35k gas per write, and chain-agnostic compatibility across EVM chains.

Where to use

mcp-contracts can be utilized in various fields where AI agents operate, particularly in applications requiring memory persistence and auditability, such as conversational AI and decentralized applications.

Content

🧠 ContextStore – MCP Context Hash Registry

This repository contains the ContextStore smart contract, a minimal on-chain registry that anchors hashed model contexts (weights, prompts, memory logs) for AI agents.

Built for the Model Context Protocol (MCP), ContextStore provides a cheap, auditable, and chain-agnostic way to persist the “what” and “when” of AI agent memory—without storing any raw data on-chain.


✨ Features

  • 💾 Store 64-byte content identifiers (e.g. SHA-256, Blake3, or IPFS CID)
  • 🔏 Immutable + timestamped entries per user address
  • 🔐 zk-friendly format: hash-only payloads
  • 🪙 Gas-efficient: ~35k gas per write
  • 🌍 Chain-agnostic: designed for any EVM chain with basic precompiles

🛠 Use Case: Contextual GPT Agent with Wallet Memory

Every time a user sends a message to the AI agent, a hashed summary of the conversation (CID) is uploaded to IPFS and recorded on-chain via ContextStore.

This enables:

  • Proof-of-memory (“I really said this”)
  • Replayable agent state
  • Auditable, composable inference flows
  • Incentivized memory registries (on-chain royalties)

🚀 Contract Overview

contract ContextStore {
    event ContextPut(address indexed user, bytes32 indexed contextHash, uint256 timestamp);

    function putContext(bytes32 contextHash) external;
}


Function: putContext(bytes32 contextHash)
- Stores the 32-byte hash for msg.sender with current block.timestamp.
- Emits ContextPut(user, hash, ts) event.
- Can be called multiple times—each put represents a new context snapshot.


🧩 Integrations
✅ MCP-compliant tooling
✅ IPFS and Filecoin gateways
✅ zk circuits (Poseidon-friendly)

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers