ContextISO brings context into clarity for LLMs by targeting and isolating relevant knowledge through an intelligent knowledge graph system.
ContextISO is an MCP (Model Context Protocol) server that provides intelligent context management and optimization for AI coding assistants. By leveraging a graph-based architecture powered by Neo4j, it delivers precisely targeted contextual information to LLMs while reducing token usage by up to 85%.
- 🎯 Targeted Context - Isolate and deliver only the most relevant contextual information
- 📊 Knowledge Graphs - Graph-based storage and retrieval for complex relationships
- ⚡ Performance - Optimized queries with bulk operations (50 entities in 150ms)
- 🔍 Full-text Search - Advanced search capabilities with ranking
- ☁️ Cloud Native - Built on Neo4j Aura for scalability and reliability
- 🔄 Rule Management - Dynamic rule creation and context detection
ContextISO consists of several core components:
┌─────────────────────────────────────┐
│ ContextISO MCP Server │
├─────────────────────────────────────┤
│ Memory Layer Rule Layer │
│ (Context Storage) (Optimization) │
├─────────────────────────────────────┤
│ Neo4j Connection Manager │
├─────────────────────────────────────┤
│ Neo4j Aura (Cloud) │
└─────────────────────────────────────┘
- Memory Manager - Handles entity storage, relationships, and context search
- Rule Manager - Manages rules and context detection for optimization
- Neo4j Connection - Manages database connections and lifecycle
- Tools - MCP tool definitions for context operations
- Node.js >= 18.0.0
- Neo4j Aura instance (free tier available at https://aura.neo4j.io)
# Clone the repository
git clone <repository-url>
cd ca-kgm-mcp
# Install dependencies
npm install
# Build the project
npm run buildSet up environment variables for Neo4j connection:
# .env or system environment variables
NEO4J_URI=neo4j+s://your-instance.databases.neo4j.io
NEO4J_USERNAME=neo4j
NEO4J_PASSWORD=your-password# Development mode
npm run dev
# Production mode
npm start
# Watch mode
npm run build:watchContextISO exposes MCP tools for context management:
store_memory- Store contextual entitiesrecall_memory- Retrieve stored contextupdate_memory- Modify existing contextdelete_memory- Remove outdated contextsearch_memory- Full-text search context
ingest_rules- Add rules to the knowledge graphretrieve_rules- Get applicable rules for contextdetect_context- Identify relevant contextual patternsupdate_rules- Modify existing rules
// Store an entity (context item)
await memoryManager.createEntity({
name: 'Architecture Pattern',
entityType: 'Pattern',
observations: ['Microservices', 'Event-driven']
});
// Create relationships between entities
await memoryManager.createRelation({
from: 'Architecture Pattern',
to: 'Deployment',
relationType: 'USES'
});
// Search for context
const results = await memoryManager.searchNodes({
query: 'microservices architecture',
limit: 10
});# Run all tests
npm test
# Run unit tests
npm run test:unit
# Run integration tests (requires Neo4j)
npm run test:integration
# Watch mode
npm run test:watchAll 21 integration tests passing ✅
- Connectivity & Schema: 3/3 ✓
- Entity Management: 4/4 ✓
- Relationship Management: 3/3 ✓
- Search Functionality: 3/3 ✓
- Graph Analytics: 3/3 ✓
- Error Handling: 3/3 ✓
- Performance & Scale: 2/2 ✓
src/
├── index.ts # Main server entry point
├── memory/
│ ├── memory-manager.ts # Context storage and retrieval
│ └── memory-tools.ts # MCP tool definitions
├── rules/
│ ├── rule-manager.ts # Rule management
│ └── rule-tools.ts # Rule MCP tools
├── storage/
│ └── neo4j-connection.ts # Database connection
└── config/
├── neo4j-config.ts # Configuration loader
└── neo4j-types.ts # Type definitions
npm run build # Build once
npm run build:watch # Watch modenpm run lint # Check for issues
npm run lint:fix # Auto-fix issuesContextISO is optimized for production use:
- Bulk Operations - 150ms for 50 entities
- Search - 80ms for full-text search with 20 results
- Connection Pool - 50 concurrent connections
- Query Timeout - 30 second timeout with reconnection
npm run devnpm run build
npm startCreate a Dockerfile and customize for your deployment:
FROM node:18-alpine
WORKDIR /app
COPY . .
RUN npm install && npm run build
CMD ["npm", "start"]| Variable | Description | Required |
|---|---|---|
NEO4J_URI |
Neo4j Aura connection URI | Yes |
NEO4J_USERNAME |
Database username | Yes |
NEO4J_PASSWORD |
Database password | Yes |
Contributions are welcome! Please ensure:
- All tests pass:
npm test - Code is linted:
npm run lint:fix - Documentation is updated
- Commit messages are clear
MIT
For issues and questions:
- Check the documentation
- Review test files for examples
- File an issue on the repository
- Multi-database support (PostgreSQL, MongoDB)
- Advanced visualization tools
- Performance profiling dashboard
- Context versioning and history
- Collaborative rule management
- Custom similarity algorithms
ContextISO: Bringing clarity to LLM context through targeted knowledge graphs.