{"id":31882626,"url":"https://github.com/ronantakizawa/risc0mcp","last_synced_at":"2025-10-13T02:54:51.828Z","repository":{"id":307290106,"uuid":"1028390938","full_name":"ronantakizawa/risc0mcp","owner":"ronantakizawa","description":"An MCP server to make ZK proofs using Risc Zero","archived":false,"fork":false,"pushed_at":"2025-08-06T14:44:32.000Z","size":229,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-06T15:22:24.538Z","etag":null,"topics":["risc-zero","zero-knowledge","zero-knowledge-proofs"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ronantakizawa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-29T13:11:02.000Z","updated_at":"2025-08-06T14:44:35.000Z","dependencies_parsed_at":"2025-07-30T14:19:22.789Z","dependency_job_id":null,"html_url":"https://github.com/ronantakizawa/risc0mcp","commit_stats":null,"previous_names":["ronantakizawa/risc0mcp"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ronantakizawa/risc0mcp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ronantakizawa%2Frisc0mcp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ronantakizawa%2Frisc0mcp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ronantakizawa%2Frisc0mcp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ronantakizawa%2Frisc0mcp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ronantakizawa","download_url":"https://codeload.github.com/ronantakizawa/risc0mcp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ronantakizawa%2Frisc0mcp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279014027,"owners_count":26085347,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["risc-zero","zero-knowledge","zero-knowledge-proofs"],"created_at":"2025-10-13T02:54:46.434Z","updated_at":"2025-10-13T02:54:51.821Z","avatar_url":"https://github.com/ronantakizawa.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RISC Zero MCP Server\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nA Model Context Protocol (MCP) server that allows trustless and verifiable agentic workflows using ZK proofs from Risc Zero. \n\nDisclaimer: This MCP server is not an official release from the Risc Zero Team.\n\nhttps://github.com/user-attachments/assets/9a970034-442c-4ff9-972d-ad7c6d1a5079\n\n\n## Features\n- **K-Means Clustering**: Classify data points without revealing training data\n- **Linear Regression**: Make predictions while keeping datasets private  \n- **Neural Networks**: Basic neural network runs while hiding model weights\n- **Mathematical Operations**: Addition, multiplication, square root, modular exponentiation\n\n## Architecture\n\nThe project consists of:\n- **MCP Server** (`src/index.ts`): Node.js server implementing MCP protocol\n- **LLM Agent System**: AI-driven proof generation and verification\n  - ProverAgent: Generates ZK proofs for mathematical claims\n  - VerifierAgent: Independently verifies received proofs\n  - HTTP File Upload System: Distributed proof transmission\n- **RISC Zero Guest Programs**: \n  - **Mathematical Operations**: Addition, multiplication, square root, modular exponentiation, range proofs\n  - **Machine Learning**: K-means clustering, linear regression, neural networks\n  - **Authenticated Operations**: Ed25519-signed computations\n  - **Dynamic Execution**: Runtime Rust code compilation and execution\n \nMore on [Risc Zero](https://risczero.com/)\n\n## Prerequisites\n\n- **Node.js 18+** with npm\n- **Rust toolchain** (1.70+) with cargo\n- **RISC Zero toolkit** for zero-knowledge proof generation\n- **Docker** (for dynamic Rust compilation)\n- **Git** (for cloning the repository)\n\n## Installation\n\n### Step 1: Clone the Repository\n```bash\ngit clone https://github.com/ronantakizawa/risc0mcp.git\ncd risc0mcp\n```\n\n### Step 2: Install Rust and RISC Zero Toolkit\n```bash\n# Install Rust (if not already installed)\ncurl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh\nsource $HOME/.cargo/env\n\n# Install RISC Zero toolkit\ncargo install cargo-risczero --version ^2.3.1\ncargo risczero install\n```\n\n### Step 3: Install Node.js Dependencies\n```bash\nnpm install\n```\n\n### Step 4: Build the Project\n```bash\n# Build TypeScript MCP server\nnpm run build\n\n# Build RISC Zero host and verification binaries\ncd risc0code\ncargo build --release\ncd ..\n```\n\n### Step 4: Environment Configuration\n\nSet your OpenAI API key for LLM agent communication:\n\n```bash\n# In your environment or directly in code\nexport OPENAI_API_KEY=\"your-openai-api-key-here\"\n\n# Or update src/llm-agents/main.ts with your key\nconst OPENAI_API_KEY = 'your-openai-api-key-here';\n```\n\n## LLM Agent Workflow\n\n### Running LLM Agent Demonstrations\n\n#### Build the LLM agent system\n```bash\nnpm run build\n```\n#### Run MCP server on Terminal 1\n```bash\nnpm run mcp-server\n```\n\n#### Run a Verifying AI Agent on Terminal 2\n```bash\nnpm run verifier-server \n```\n#### Run a Proving AI Agent on Terminal 3\n```bash\n# Example functions\nnpm run comprehensive-test # Run all proofs\nnpm run test:k-means\nnpm run test:linear-regression\nnpm run test:logistic-regression\n```\n\n\n## Setup with Claude Desktop\n\n### Step 1: Configure Claude Desktop\nAdd the RISC Zero MCP server to your Claude Desktop configuration file:\n\n**On macOS:**\n```bash\n# Edit Claude Desktop config\ncode ~/Library/Application\\ Support/Claude/claude_desktop_config.json\n```\n\n**On Windows:**\n```bash\n# Edit Claude Desktop config\nnotepad %APPDATA%\\Claude\\claude_desktop_config.json\n```\n\n**On Linux:**\n```bash\n# Edit Claude Desktop config\ncode ~/.config/Claude/claude_desktop_config.json\n```\n\n### Step 2: Add MCP Server Configuration\nAdd the following configuration to your `claude_desktop_config.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"risc0-zkvm\": {\n      \"command\": \"node\",\n      \"args\": [\"/Users/ronantakizawa/Documents/projects/risc0mcp/dist/index.js\"],\n      \"env\": {\n        \"RISC0_DEV_MODE\": \"0\",\n        \"PATH\": \"/Users/ronantakizawa/.cargo/bin:/Users/ronantakizawa/.risc0/bin:/usr/local/bin:/usr/bin:/bin\",\n        \"CARGO_HOME\": \"/Users/ronantakizawa/.cargo\",\n        \"RUSTUP_HOME\": \"/Users/ronantakizawa/.rustup\"\n      },\n      \"toolCallTimeoutMillis\": 600000\n    }\n  }\n}\n```\n\n**Important:** Replace `/absolute/path/to/risc0mcp` with the full path to your cloned repository.\n\n**Example paths:**\n- macOS: `/Users/yourname/risc0mcp/dist/index.js`\n- Windows: `C:\\\\Users\\\\yourname\\\\risc0mcp\\\\dist\\\\index.js`\n- Linux: `/home/yourname/risc0mcp/dist/index.js`\n\n### Step 3: Restart Claude Desktop\nAfter updating the configuration:\n1. **Quit Claude Desktop completely**\n2. **Restart Claude Desktop**\n3. **Wait for initialization** (may take 10-15 seconds)\n\n### Step 4: Verify Installation\nIn Claude Desktop, try asking:\n\u003e \"Can you add 3.5 and 2.1 using the RISC Zero zkVM?\"\n\nClaude should respond with a zero-knowledge proof of the computation!\n\n## Usage\n\nThe MCP server runs automatically when Claude Desktop starts. You can interact with it through natural language in Claude Desktop.\n\n### Example Prompts\n\n**Private Machine Learning Computations:**\n- \"Create a Perform K-means clustering on these data points: [[1,2], [2,1], [8,9], [9,8]] with k=2\"\n- \"Do linear regression on x=[1,2,3,4,5] and y=[2,4,6,8,10], predict y for x=6\"  \n- \"Run a neural network with inputs [0.5, 0.3, 0.8] for private AI computation\"\n\n**Mathematical Operations:**\n- \"Add 15.7 and 23.4 using zero-knowledge proofs\"\n- \"Calculate the square root of 144 with cryptographic verification\"\n- \"Multiply 2.5 by 8.3 and generate a ZK proof\"\n\n**Cryptographic Operations:**\n- \"Compute 2^10 mod 1000 using modular exponentiation\"\n- \"Prove that my secret number is between 18 and 65 (range proof)\"\n- \"Generate an authenticated addition proof using my private key\"\n\n**Dynamic Rust Execution:**\n- \"Execute this Rust code in the zkVM: [paste your Rust code]\"\n- \"Compile and run a Fibonacci function for n=10\"\n\n\n### Available Tools\n\n#### `zkvm_run_rust_file`\n**NEW**: Compiles and executes a Rust file in RISC Zero zkVM with zero-knowledge proof generation.\n\n**Parameters:**\n- `filepath` (string): Path to the Rust source file to compile and execute\n- `inputs` (object): JSON inputs to pass to the guest program\n\n#### `zkvm_run_rust_code`\n**NEW**: Compiles and executes Rust code provided as text in RISC Zero zkVM with zero-knowledge proof generation.\n\n**Parameters:**\n- `code` (string): Rust source code to compile and execute\n- `inputs` (object): JSON inputs to pass to the guest program\n\n**Example Rust Code:**\n```rust\nuse risc0_zkvm::guest::env;\n\nfn main() {\n    let inputs_json: String = env::read();\n    let inputs: Vec\u003ci64\u003e = serde_json::from_str(\u0026inputs_json).unwrap();\n    let n = inputs[0];\n    let result = fibonacci(n);\n    env::commit(\u0026result);\n}\n\nfn fibonacci(n: i64) -\u003e i64 {\n    if n \u003c= 1 { n } else { fibonacci(n-1) + fibonacci(n-2) }\n}\n```\n\n#### `zkvm_add`\nPerforms addition of two decimal numbers using RISC Zero zkVM and returns the result with ZK proof receipt.\n\n**Parameters:**\n- `a` (number): First number to add (supports decimal values)\n- `b` (number): Second number to add (supports decimal values)\n\n#### `zkvm_multiply`\nPerforms multiplication of two decimal numbers using RISC Zero zkVM and returns the result with ZK proof receipt.\n\n**Parameters:**\n- `a` (number): First number to multiply (supports decimal values)\n- `b` (number): Second number to multiply (supports decimal values)\n\n#### `zkvm_sqrt`\nComputes the square root of a decimal number using RISC Zero zkVM and returns the result with ZK proof receipt.\n\n**Parameters:**\n- `n` (number): Number to compute square root for (must be non-negative, supports decimal values)\n\n#### `zkvm_modexp`\nPerforms modular exponentiation (a^b mod n) using RISC Zero zkVM and returns the result with ZK proof receipt. Ideal for cryptographic applications.\n\n**Parameters:**\n- `base` (number): Base number (a) - must be a non-negative integer\n- `exponent` (number): Exponent (b) - must be a non-negative integer\n- `modulus` (number): Modulus (n) - must be a positive integer\n\n#### `zkvm_range`\nProves that a secret number is within a specified range using RISC Zero zkVM without revealing the secret number. This is a zero-knowledge range proof ideal for privacy-preserving applications.\n\n**Parameters:**\n- `secretNumber` (number): Secret number to prove is in range (will remain private) - must be a non-negative integer\n- `minValue` (number): Minimum value of the range (inclusive) - must be a non-negative integer\n- `maxValue` (number): Maximum value of the range (inclusive) - must be a non-negative integer\n\n#### `zkvm_k_means`\nPerforms K-means clustering algorithm with zero-knowledge proof for private machine learning. Clusters data points without revealing the training data.\n\n**Parameters:**\n- `dataPoints` (array): Array of data points, each as [x, y] coordinates\n- `k` (integer): Number of clusters (minimum 1)\n- `maxIterations` (integer, optional): Maximum iterations for convergence (default: 10)\n- `queryPoint` (array): Query point to classify as [x, y] coordinates\n\n\n#### `zkvm_linear_regression`\nPerforms linear regression analysis with zero-knowledge proof for private statistical modeling. Computes predictions while keeping datasets private.\n\n**Parameters:**\n- `xValues` (array): Array of x (independent) values\n- `yValues` (array): Array of y (dependent) values  \n- `predictX` (number): X value to predict Y for\n\n#### `zkvm_neural_network`\nExecutes neural network computation with zero-knowledge proof for private AI inference. Performs inference without revealing model weights.\n\n**Parameters:**\n- `inputs` (array): Input values for the neural network\n- `learningRate` (number, optional): Learning rate for training (default: 0.1)\n- `epochs` (integer, optional): Number of training epochs (default: 100)\n\n\n#### `verify_proof`\nVerifies a RISC Zero proof from a .bin or .hex file and extracts the computation result. Automatically detects the operation type from the filename.\n\n**Parameters:**\n- `proofFilePath` (string): Path to the .bin or .hex proof file to verify\n\n## License\n\nMIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fronantakizawa%2Frisc0mcp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fronantakizawa%2Frisc0mcp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fronantakizawa%2Frisc0mcp/lists"}