Package Exports
- regen-koi-mcp
- regen-koi-mcp/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (regen-koi-mcp) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
π± Regen KOI MCP Server
Access Regen Network's Knowledge Organization Infrastructure (KOI) through Model Context Protocol (MCP) tools in Claude Desktop, VSCode, and other MCP-compatible clients.
π Quick Start
One-Line Install (Easiest!)
curl -fsSL https://raw.githubusercontent.com/gaiaaiagent/regen-koi-mcp/main/install.sh | bashThis automatically configures Claude Desktop and Claude Code CLI. Just restart and you're done! π
Option 1: NPM (Recommended - Auto-Updates)
No installation needed! Just configure Claude Desktop with:
{
"mcpServers": {
"regen-koi": {
"command": "npx",
"args": ["-y", "regen-koi-mcp@latest"],
"env": {
"KOI_API_ENDPOINT": "https://regen.gaiaai.xyz/api/koi"
}
}
}
}Benefits:
- β Automatic updates - get new features without doing anything
- β No git clone, no build, no maintenance
- β Always uses the latest version
- β Works immediately
Config file locations:
- Mac:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
Then restart Claude Desktop and you're done! π
For existing git users: See the migration section below for a simple one-line script to switch to npx.
π Migrating from Git Installation
If you previously installed via git clone, switch to npx for automatic updates:
curl -fsSL https://raw.githubusercontent.com/gaiaaiagent/regen-koi-mcp/main/migrate.sh | bashWhat this does:
- β Backs up your existing config
- β
Updates
command: "node"βcommand: "npx" - β
Updates
argsto useregen-koi-mcp@latest - β Configures Claude Code CLI too
- β You get automatic updates forever!
After migration, you can safely delete your old git clone directory.
Option 2: Local Development (Git Clone)
For contributors or local development only:
git clone https://github.com/gaiaaiagent/regen-koi-mcp
cd regen-koi-mcp
npm install
npm run buildThen manually configure your MCP client to point to the local dist/index.js.
Requirements:
- Node.js 16+: Download here
- Python 3.8+: Download here - Optional (only for advanced local digest generation)
π Deployment Options
π Option 1: Hosted API (Default - Recommended)
By default, the MCP client connects to the hosted KOI API at https://regen.gaiaai.xyz/api/koi. This works out of the box - no additional setup required!
π₯οΈ Option 2: Self-Hosted API Server
Want to run your own API server with direct database access? See ARCHITECTURE.md for setup instructions.
ποΈ Option 3: Full Self-Hosted Pipeline
Want complete control including data collection? You'll need:
- This repo (MCP client + API server)
- koi-sensors - Data collection from Discourse, Ledger, etc.
- koi-processor - Batch processing pipeline
See ARCHITECTURE.md for detailed setup instructions and architecture overview.
π― What This Does
This MCP server gives AI assistants access to Regen Network's comprehensive knowledge base with 15,000+ documents about:
- Carbon credits and ecological assets
- Regenerative agriculture practices
- Blockchain and Web3 sustainability
- Climate action and environmental data
- Regen Registry credit classes
Note: This MCP server connects to our hosted KOI API at https://regen.gaiaai.xyz/api/koi (behind HTTPS via Nginx), so you don't need to run any infrastructure locally.
π¦ Available Tools
| Tool | Description | Key Inputs |
|---|---|---|
search_knowledge |
Hybrid search (vectors + graph with RRF) | query (string), limit (1β20, default 5), published_from (YYYYβMMβDD), published_to (YYYYβMMβDD), include_undated (bool, default false) |
get_stats |
Knowledge base statistics | detailed (boolean) |
generate_weekly_digest |
Generate weekly digest of Regen Network activity | start_date (YYYY-MM-DD, default: 7 days ago), end_date (YYYY-MM-DD, default: today), save_to_file (bool, default false), output_path (string), format ('markdown' or 'json', default: 'markdown') |
ποΈ Architecture
This repo contains everything you need to run a complete KOI MCP setup:
regen-koi-mcp/
βββ src/ # MCP client (connects to API)
βββ server/ # KOI API server (FastAPI)
β βββ src/ # API endpoints
β βββ setup.sh # Server setup
β βββ start.sh # Start server
β βββ stop.sh # Stop server
βββ python/ # Weekly digest generator
βββ src/ # Digest logic
βββ config/ # Configuration
βββ setup.sh # Python setupTwo modes:
- Client-only (default): MCP client β Hosted API
- Self-hosted: MCP client β Your local API β Your database
π» Supported Clients
Claude Desktop β
The setup script automatically configures Claude Desktop. After running npm run setup, just restart Claude Desktop and you'll see the tools available.
Claude Code CLI β
The setup script automatically configures Claude Code CLI. After running npm run setup, just restart Claude Code and you'll see the tools available.
VSCode Extensions
Cline (Claude Dev) β
Install from: VSCode Marketplace
Continue β
Install from: VSCode Marketplace
The setup script configures both extensions automatically.
Other Clients
Any MCP-compatible client can use this server. Configure with:
{
"command": "node",
"args": ["/path/to/regen-koi-mcp/dist/index.js"],
"env": {
"KOI_API_ENDPOINT": "https://regen.gaiaai.xyz/api/koi"
}
}π§ Manual Setup
Claude Desktop
Find your config file:
- Mac:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
- Mac:
Add the server configuration:
{
"mcpServers": {
"regen-koi": {
"command": "node",
"args": ["/absolute/path/to/regen-koi-mcp/dist/index.js"],
"env": {
"KOI_API_ENDPOINT": "https://regen.gaiaai.xyz/api/koi"
}
}
}
}- Restart Claude Desktop
Claude Code CLI
Run the following command to configure the MCP server:
claude mcp add-json regen-koi '{"command":"node","args":["/absolute/path/to/regen-koi-mcp/dist/index.js"],"env":{"KOI_API_ENDPOINT":"https://regen.gaiaai.xyz/api/koi"}}'Replace /absolute/path/to/regen-koi-mcp with the actual path to your installation.
NPX Usage (No Installation)
You can also run directly from npm:
{
"mcpServers": {
"regen-koi": {
"command": "npx",
"args": ["-y", "regen-koi-mcp"],
"env": {
"KOI_API_ENDPOINT": "https://regen.gaiaai.xyz/api/koi"
}
}
}
}π Environment Configuration
Create a .env file in the project root:
# Required: KOI API endpoint
KOI_API_ENDPOINT=https://regen.gaiaai.xyz/api/koi
# Optional: API key if your KOI server requires authentication
# KOI_API_KEY=your_api_key_here
# Graph + NLβSPARQL configuration (used internally by hybrid search)
JENA_ENDPOINT=http://localhost:3030/koi/sparql
CONSOLIDATION_PATH=/opt/projects/koi-processor/src/core/final_consolidation_all_t0.25.json
PATTERNS_PATH=/opt/projects/koi-processor/src/core/predicate_patterns.json
COMMUNITY_PATH=/opt/projects/koi-processor/src/core/predicate_communities.json
EMBEDDING_SERVICE_URL=http://localhost:8095
# OPENAI_API_KEY=your_key # Optional; template queries used when absentποΈ Development
# Run in development mode
npm run dev
# Build TypeScript
npm run build
# Clean build files
npm run cleanπ How Hybrid Graph Search Works
- Adaptive dualβbranch execution (internally via MCP):
- Focused: topβK predicates via embeddings + usage + community expansion
- Broad: entity/topic regex over all predicates
- Canonicalβaware filtering (keywords β
regx:canonicalPredicate) by default - Smart fallback: if canonical returns 0 results, retry broad without canonical to recover recall
- Results fused with Reciprocal Rank Fusion (RRF) for precision + recall
- Date filter support: when
published_from/published_toare provided, the vector and keyword branches are filtered serverβside. Ifinclude_undatedis true, undated docs are also included. The graph branch adds a date filter only when RDF statements includeregx:publishedAt(optional enrichment). - Naturalβlanguage recency detection: phrases like βpast weekβ, βlast monthβ, βlast 30 daysβ, βyesterdayβ, βtodayβ automatically set a date range when no explicit
published_from/published_toare provided.
Examples
Direct KOI API examples (useful for testing filters):
# Natural-language recency ("past week") β MCP parses this automatically,
# but you can also hit the KOI API directly for verification
curl -s http://localhost:8301/api/koi/query \
-H 'Content-Type: application/json' \
-d '{
"question": "what discussions about token design happened in the past week?",
"limit": 10
}' | jq '.results[0:3]'
# Explicit date range with include_undated=true
curl -s http://localhost:8301/api/koi/query \
-H 'Content-Type: application/json' \
-d '{
"question": "token design",
"limit": 10,
"filters": {
"date_range": { "start": "2025-10-09", "end": "2025-10-16" },
"include_undated": true
}
}' | jq '.results[0:3]'Within MCP, the search_knowledge tool accepts:
published_from/published_to(YYYY-MM-DD)include_undated(boolean) If you omit dates but include phrases like βpast weekβ, the MCP infers the date range automatically.
π Evaluation
Run the builtβin harness and inspect results:
node scripts/eval-nl2sparql.js- Persists JSON to
results/eval_*.jsonwith focused/broad sizes, union/overlap, latency, noise rate. - Current baseline: 100% queries answered, 0% noise, ~1.5 s average latency.
π Prerequisites
- Node.js 18 or higher
- Claude Desktop or compatible MCP client
- Internet connection (connects to hosted KOI API)
π οΈ Troubleshooting
"KOI API not accessible"
The setup connects to our hosted KOI API at https://regen.gaiaai.xyz/api/koi. If you see connection errors, check your internet connection or firewall settings.
"Tools not showing in Claude"
- Restart Claude Desktop after configuration
- Check the config file syntax is valid JSON
- Ensure the path to
index.jsis absolute
"Command not found"
Make sure Node.js is installed and in your PATH. The setup script uses node command.
π Example Usage
Once configured, you can ask Claude:
- "Search the KOI knowledge base for information about carbon credits"
- "Get statistics about the knowledge base"
- "List active Regen Registry credit classes"
- "Find recent activity on the Regen Network"
- "Generate a weekly digest of Regen Network activity from the past week"
- "Create a digest of discussions from January 1 to January 7, 2025"
Weekly Digest Tool
The generate_weekly_digest tool creates comprehensive markdown summaries of Regen Network activity:
Features:
- Automatically aggregates content from the past 7 days (or custom date range)
- Returns markdown content that can be used directly in Claude Desktop as an artifact
- Optionally saves to a file for use with NotebookLM or other tools
- Includes proper source citations and statistics
Examples:
// In Claude Desktop or Claude Code CLI:
"Generate a weekly digest of Regen Network activity"
// With custom date range:
"Create a digest from December 1 to December 8, 2024"
// Save to file:
"Generate a weekly digest and save it to weekly_summary.md"Note: The digest content is returned in the response, so in Claude Desktop it will be displayed inline (and may be created as an artifact). The save_to_file option is useful when you want a persistent copy on disk.
π€ Contributing
Contributions welcome! Please feel free to submit issues and pull requests.
π License
MIT License - see LICENSE file for details
π Links
π Credits
Built by the Regen Network community to make ecological knowledge accessible to AI assistants everywhere.
ποΈ Related Repositories
This MCP client is part of the larger KOI ecosystem:
- koi-sensors - Real-time data collection from Discourse, Regen Ledger, websites, etc.
- koi-processor - Batch processing pipeline for chunking, embedding, and graph construction
See ARCHITECTURE.md for how these components work together.