MCP3 SDK & Developer Guide
The MCP3 SDK provides utilities to generate, sign, verify, and consume Machine Context Objects (MCOs), enabling seamless integration of contextual identity into AI agents and Web3 applications.
π¦ Installation
Node.js / TypeScript:
npm install @mcp3/sdkor
yarn add @mcp3/sdkWorks in browser and server environments.
π Architecture: SDK Module Overview
graph TD;
UserWallet -->|signs| MCOBuilder;
MCOBuilder --> MCO;
MCO -->|sent to| AIClient;
AIClient -->|formats prompt| LLM;
Verifier -->|validates| MCO;
Agent -->|context-aware| Interaction;
subgraph SDK
MCOBuilder
AIClient
Verifier
endποΈ 1. Constructing an MCO (Client Side)
import { buildMCO } from '@mcp3/sdk/client'
const context = {
scopes: ['read.dao', 'read.tokens'],
subject: '0xabc...',
dao: {
memberships: ['metadao.eth'],
recentVotes: ['proposal_45', 'proposal_46']
},
wallet: {
tokenBalances: [
{ symbol: 'ETH', amount: 1.34 },
{ symbol: 'USDC', amount: 430.0 }
]
}
}
const mco = await buildMCO(context, signer) // signer = ethers.Wallet or window.ethereumβ
2. Verifying an MCO (Server Side)
import { verifyMCO } from '@mcp3/sdk/server'
const result = verifyMCO(mco)
if (result.valid) {
console.log("MCO is authentic:", result.payload)
} else {
throw new Error("Invalid or expired MCO")
}π§ 3. Integrating with LLM Agents
import { generatePrompt } from '@mcp3/sdk/agent'
const prompt = generatePrompt({
basePrompt: "You are a DAO governance advisor.",
context: mco
})
const llmResponse = await callLLM(prompt)π§ͺ 4. Handling ZK Proofs
import { generateZKClaim } from '@mcp3/sdk/zk'
const claim = await generateZKClaim({
type: 'age_over_18',
identity: userSemaphoreIdentity
})
// Embed in MCO
context.zk = claimβοΈ 5. Using Delegated Signing Keys
import { createDelegatedSigner } from '@mcp3/sdk/crypto'
const delegated = createDelegatedSigner({
parentKey: userWallet.privateKey,
scopes: ['read.profile'],
expiresIn: 3600
})π‘ 6. Uploading to IPFS
import { uploadToIPFS } from '@mcp3/sdk/storage'
const ipfsUrl = await uploadToIPFS(mco)
console.log("Persistent MCO at:", ipfsUrl)π§© 7. Prompt Engineering Helpers
import { createSystemPrompt } from '@mcp3/sdk/llm'
const systemPrompt = createSystemPrompt({
role: "investment advisor",
context: mco,
includeZK: true
})π Example: Full Flow
import {
buildMCO, verifyMCO,
generatePrompt, callLLM
} from '@mcp3/sdk'
const mco = await buildMCO(context, signer)
const prompt = generatePrompt({ basePrompt, context: mco })
const answer = await callLLM(prompt)π Developer Dashboard (Planned)
Coming soon:
π MCO Explorer (decode/view signed objects)
π Delegation UI
π§ͺ Proof Playground
βοΈ Prompt Builder with context injection
π SDK Reference
Module
Description
@mcp3/sdk/client
Build & sign context objects
@mcp3/sdk/server
Verify and decode MCOs
@mcp3/sdk/zk
Generate ZK proofs
@mcp3/sdk/llm
Format LLM-compatible prompts
@mcp3/sdk/crypto
Signer tools and delegation
@mcp3/sdk/storage
Upload MCO to IPFS or Arweave
Last updated