Skip to main content
Glama
Replicant-Partners

Congo River Compositional Intelligence

Congo River Compositional Intelligence MCP Server

Status: βœ… Phase 1 Complete - Production Ready with Enhanced Architecture

A production-grade MCP (Model Context Protocol) server that embodies compositional intelligence principles, providing tools for semantic decomposition, proof search, knowledge graphs, and neuro-symbolic reasoning.

🌊 The Congo River Philosophy

This project implements "Congo River Compositional Intelligence" - the idea that powerful understanding emerges from thousands of tributaries (simple reasoning operations) composing into one massive flow (deep intelligence). Key principles:

  • Compositional Structure: Complex reasoning built from simple, composable operations

  • Polyglot Architecture: Each component implemented in its optimal language

  • Semantic Foundations: Grounded in RDF triples, lambda calculus, and proof theory

  • Neuro-Symbolic Integration: Bridges neural (LLMs) and symbolic (knowledge graphs) AI

πŸš€ Quick Start

Prerequisites

  • Node.js 18+

  • Python 3.10+

  • Supabase account (or local PostgreSQL with pgvector)

  • Anthropic and/or OpenAI API keys

Installation

# Clone or navigate to directory
cd /home/mdz-axolotl/ClaudeCode/congo-river-mcp

# Install Node dependencies
npm install

# Install Python dependencies
pip install -r requirements.txt
python -m spacy download en_core_web_sm

# Configure environment
cp .env.example .env
# Edit .env with your Supabase URL and API keys

# Build TypeScript
npm run build

# Initialize database
npm start -- --setup

# Start server
npm start

Configuration

Edit .env with your settings:

# Use Supabase
DB_TYPE=cloud
CLOUD_DB_URL=postgresql://postgres:[PASSWORD]@[PROJECT-REF].supabase.co:5432/postgres

# Add your API keys
ANTHROPIC_API_KEY=sk-ant-...
OPENAI_API_KEY=sk-...

Add to Claude Code

Add to your .mcp.json:

{
  "mcpServers": {
    "congo-river": {
      "command": "node",
      "args": ["dist/server.js"],
      "cwd": "/home/mdz-axolotl/ClaudeCode/congo-river-mcp",
      "type": "stdio",
      "env": {
        "TRANSPORT": "stdio",
        "DB_TYPE": "cloud",
        "CLOUD_DB_URL": "postgresql://...",
        "ANTHROPIC_API_KEY": "sk-ant-...",
        "OPENAI_API_KEY": "sk-..."
      }
    }
  }
}

πŸ› οΈ Available Tools

Core Reasoning Tools

1.

  • Decomposes concepts into RDF subject-predicate-object triples

  • Implements Stanley Fish's 3-word sentence principle

  • Stores in knowledge graph for later querying

2.

  • Converts processes/code into lambda calculus

  • Shows compositional structure with type signatures

  • Applies beta reduction for simplification

3.

  • Searches for proofs given goals and premises

  • Multiple strategies: forward/backward chaining, resolution

  • Returns proof trees (Curry-Howard correspondence)

4.

  • Queries knowledge graph with SPARQL-like patterns

  • Natural language or structured queries

  • Returns matching triples and relationships

5. ⭐ Showcase Feature

  • Hybrid reasoning: LLM + knowledge graph

  • Parses natural language β†’ logical form

  • Queries graph symbolically

  • Synthesizes grounded answers with proof traces

Meta Tools

6.

  • Analyzes requirements and recommends optimal programming language

  • Shows scoring rationale and trade-offs

  • Demonstrates meta-level compositional intelligence

7.

  • Database management: status, health, migrations, stats

  • Switches between local/cloud configurations

8.

  • Exports knowledge graph to RDF or JSON

  • Backup and portability

9.

  • Imports triples into knowledge graph

  • Bulk loading from external sources

10.

  • Comprehensive system health check

  • Database stats, service status, tool inventory

πŸ“ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚           Claude Code (User)                     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                 β”‚ MCP Protocol (STDIO/SSE)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚     Congo River MCP Server (TypeScript)          β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚ Language Selection Scoring (Meta-Layer)   β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  Core    β”‚ Advanced β”‚  Meta Tools      β”‚   β”‚
β”‚  β”‚  Tools   β”‚ Tools    β”‚  (DB, Language)  β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
        β”‚          β”‚              β”‚
  β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”  β”Œβ”€β”€β”€β–Όβ”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”
  β”‚Python  β”‚  β”‚TypeScr.β”‚    β”‚ Database β”‚
  β”‚Servicesβ”‚  β”‚Servicesβ”‚    β”‚  Manager β”‚
  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”˜  β””β”€β”€β”€β”¬β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜
       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
              β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚  Supabase PostgreSQL+pgvector β”‚
    β”‚  β€’ RDF Triples β€’ Proofs       β”‚
    β”‚  β€’ Embeddings  β€’ Patterns     β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ—„οΈ Database Schema

The PostgreSQL schema includes:

  • triples - RDF knowledge graph storage

  • proofs - Proof trees and inference traces

  • reasoning_sessions - Tool invocation history

  • embeddings - Vector embeddings (pgvector)

  • patterns - Learned compositional patterns

  • lambda_abstractions - Lambda calculus representations

  • concept_nodes & concept_edges - Meta-level concept graph

🧠 Language Selection System

The server includes an automatic language recommendation engine that scores programming languages based on task requirements:

// Example: What language for semantic web operations?
recommend_language({
  task_profile: "graphQuery"
})

// Result: Python (92.3/100)
// Strong fit for: semantic web, graph operations
// Excellent rdflib ecosystem

Supported Languages: TypeScript, Python, Prolog, Rust, Go

Scoring Dimensions:

  • Logic programming capabilities

  • Graph/RDF operations

  • Type system strength

  • Performance characteristics

  • ML/AI ecosystem

  • Semantic web support

  • Concurrency model

  • Web integration

πŸ“š Conceptual Foundation

This system is grounded in deep theoretical connections:

  1. J.D. Atlas - Semantic generality and presupposition

  2. Richard Montague - Compositional semantics and type theory

  3. Curry-Howard - Proofs as programs isomorphism

  4. Tim Berners-Lee - RDF and semantic web

  5. Modern LLMs - Neural learning of compositional structure

See: /home/mdz-axolotl/Documents/congo-river-compositional-intelligence.md for the complete theoretical framework.

🎯 Roadmap

βœ… Phase 1 Complete - Enhanced Architecture

  • Project structure and configuration

  • Database schema (PostgreSQL + pgvector)

  • Database manager (local/cloud support)

  • Language selection scoring system

  • Main MCP server with 10 tools

  • Python services implementation

  • TypeScript lambda service

  • Neuro-symbolic integration

  • End-to-end testing

  • Security improvements (SQL injection fixes, SSL configuration)

  • Type safety enhancements (strong typing, proper interfaces)

  • Structured error handling (comprehensive error system)

  • Architectural consistency (compositional intelligence principles)

Phase 2: Enhanced Reasoning

  • Tree of Thoughts orchestrator

  • Chain of Thought tracer

Phase 3: Meta-Cognitive Layer

  • Compositional analyzer (multi-lens analysis)

  • Loop discovery engine

Phase 4-7: Learning, Production, Knowledge Management, Advanced Neuro-Symbolic

(See full roadmap in /home/mdz-axolotl/.claude/plans/serialized-meandering-starlight.md)

πŸ§ͺ Development

# Run in watch mode
npm run dev

# Run tests
npm test

# Lint
npm run lint

# Format
npm run format

# Start with SSE transport (remote access)
npm run start:sse

πŸ“– Example Usage

// In Claude Code, you can call:

// Decompose a concept
triple_decomposition({
  concept: "Consciousness is awareness of internal and external stimuli",
  store_in_db: true
})

// Get language recommendation
recommend_language({
  task_profile: "neuroSymbolic",
  show_all: true
})

// Query knowledge graph
graph_query({
  query: "Find all properties of consciousness"
})

// Neuro-symbolic reasoning
neuro_symbolic_query({
  query: "What is the relationship between consciousness and qualia?",
  include_proof: true
})

// System health
system_status({ detailed: true })

🀝 Contributing

This is a research/educational project exploring compositional intelligence. Contributions welcome!

πŸ“„ License

MIT


**🌊 The Congo River flows with unstoppable force from thousands of tributaries composing into one.**Human: can we save this session?

-
security - not tested
A
license - permissive license
-
quality - not tested

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Replicant-Partners/Congo'

If you have feedback or need assistance with the MCP directory API, please join our Discord server