
Store and retrieve entities, relations and observations in a persistent local knowledge graph.

A Model Context Protocol server that manages hierarchical conversation context so LLM agents can retain goals, constraints and recent turns across long sessions.
CC-MCP (Context Consistent MCP Server) is cataloged as an MCP server attributed to beginnersguide138. A Model Context Protocol server that manages hierarchical conversation context so LLM agents can retain goals, constraints and recent turns across long sessions. It is categorized under ai agents-models. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.
Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.
Catalog license label: MIT License. Check the source repository's current license and terms before using, modifying or distributing this software.
Capability definitions are not reviewed. Unreviewed imports are not exposed as trusted interfaces.
No reviewed records to display. This does not establish that upstream lacks this capability.
No reviewed records to display. This does not establish that upstream lacks this capability.
No reviewed records to display. This does not establish that upstream lacks this capability.
Email delivery is not connected. This page does not collect email addresses or create subscriptions.
Browse the registry for current listings instead.
Reviews for CC-MCP (Context Consistent MCP Server) are not available yet
Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.
Yes. It supports Ollama as a local LLM for intent classification by pointing the classifier API URL to the Ollama endpoint.
README.md · bf2b3fb71489 · Fetched 2026-11-13 13:23:40 UTC
Original upstream text, without AI rewriting. Scripts, forms and unsafe links are filtered for safety.
Showing the last retrieved documentation snapshot; check the source for current changes.
🌟 Revolutionary AI Context Management: Solving LLM Memory Loss in Long Conversations
Long-term conversational consistency management system for LLM-powered AI agents
Traditional LLMs suffer from "intent forgetting" in long conversations:
CC-MCP provides intelligent context management tools to help LLM maintain consistency.
Add this to your MCP client settings (e.g., Cline's cline_mcp_settings.json):
{
"mcpServers": {
"cc-mcp": {
"autoApprove": [
"process_user_message",
"start_session",
"get_debug_info",
"list_sessions",
"get_session_stats",
"export_context",
"import_context"
],
"disabled": false,
"timeout": 60,
"type": "stdio",
"command": "uv",
"args": [
"run",
"--directory",
"/path/to/your/cc-mcp",
"main.py"
],
"env": {
"CLASSIFIER_API_URL": "https://api.openai.com/v1/chat/completions",
"CLASSIFIER_API_KEY": "your_openai_api_key_here",
"CLASSIFIER_MODEL": "gpt-4o-mini"
}
}
}
}
/path/to/your/cc-mcp with your actual repository path.For Ollama users: When using Ollama instead of OpenAI, modify the environment variables as follows:
CLASSIFIER_API_URL to your Ollama server URL (e.g., http://localhost:11434/v1/chat/completions)CLASSIFIER_MODEL to your preferred Ollama model (e.g., llama3.2)CLASSIFIER_API_KEY as it's not required for OllamaExample configuration for Ollama:
"env": {
"CLASSIFIER_API_URL": "http://localhost:11434/v1/chat/completions",
"CLASSIFIER_MODEL": "llama3.2"
}
Prerequisites:
Core Context (Long-term) ──► Problem definitions & core objectives
↓
Evolving Context (Mid-term) ──► Constraints, decisions & refinements
↓
Turn Context (Short-term) ──► Recent conversation flow
PROBLEM_DEFINITION, CONSTRAINT_ADDITION, REFINEMENT, QUESTION, UNCLEARintent_classifier.py):The classification logic is based on a prompt that instructs the LLM to analyze the user's message and assign one or more of the following labels:
PROBLEM_DEFINITION: The user is defining the central problem they want to solve.
CONSTRAINT_ADDITION: The user is adding constraints or conditions, such as budget or timeline.
REFINEMENT: The user is making an existing requirement more specific or is modifying it.
QUESTION: The user is asking a simple question.
UNCLEAR: The message cannot be clearly classified into any of the above categories.
The "Intelligent context pruning and optimization" is achieved through a multi-faceted approach within the HierarchicalContextStore (context_store.py):
Hierarchical Context Storage: The system categorizes information into three tiers, preventing context degradation:
Automatic Turn Context Pruning: To prevent memory bloat, the turn_context is automatically trimmed. The _trim_turn_context() method ensures that only the most recent messages (default: 6) are kept, discarding older, less relevant turns.
Keyword-Based Optimization: Instead of relying on full-text history, the system extracts and stores weighted keywords for Core and Evolving contexts. The get_context_summary() method then provides a condensed, keyword-driven summary to the LLM, which is far more efficient to process than raw conversational history.
This structured, rule-based approach ensures that memory is managed efficiently and intelligently, keeping the most critical information accessible without overwhelming the LLM.
keyword_extraction.py):The statistical keyword extraction uses a sophisticated TF-IDF implementation with several optimizations:
Term Frequency (TF) Calculation: The _calculate_tf() method computes how frequently each word appears in a specific message relative to the total word count in that message. This identifies words that are emphasized within the current context.
Inverse Document Frequency (IDF) Calculation: The _calculate_idf() method determines how rare a word is across all conversations in the corpus. The formula used is IDF = log(total_documents / documents_containing_term), making rare words more valuable.
TF-IDF Scoring: The extract_keywords() method combines TF and IDF scores (TF-IDF = TF × IDF) to identify words that are both frequent in the current message and rare across all conversations, indicating topic-specific importance.
Multilingual Tokenization: The _tokenize() method uses regex patterns to extract Japanese (hiragana, katakana, kanji) and English words while filtering out common stop words in both languages.
Corpus Management: The system maintains a growing document corpus that improves IDF accuracy over time. Each new message updates the _document_frequency dictionary and _total_documents count, making future extractions more precise.
This approach ensures that extracted keywords represent the most contextually relevant terms while filtering out common, less meaningful words.
gpt-3.5-tubo, gpt-4o-mini or gemma3:4bpersistence/ directory, ensuring no data is lost between server restarts.User: "I want to build an AI assistant app"
AI: "Sure! Here are some general approaches..."
[10 messages later]
User: "Remember, budget is 500K yen, 3 months timeline"
AI: "What project are we talking about?" ❌
User: "I want to build an AI assistant app"
AI: "Great! Let me help you design this system..."
[10 messages later]
User: "What about deployment options?"
AI: "For your AI assistant app (budget: 500K yen, 3-month timeline, security priority), here are deployment strategies that fit your constraints..." ✅
graph TD
subgraph CC-MCP Server
direction LR
C[Intent Classifier]
D[Context Store]
E[Keyword Extractor]
end
A[MCP Client Application] -- MCP Tools --> B((main.py))
B -- Manages --> C
B -- Manages --> D
B -- Manages --> E
C -- Calls --> G[External LLM API]
This server is built on three core components that work together to provide context-aware responses:
Intent Classifier (intent_classifier.py):
PROBLEM_DEFINITION, CONSTRAINT_ADDITION, REFINEMENT, QUESTION, or UNCLEAR.Context Store (context_store.py):
core_context for the main problem, an evolving_context for constraints and refinements, and a turn_context for the most recent messages. It automatically prunes the short-term turn_context to manage memory efficiently.Keyword Extractor (keyword_extraction.py):
core and evolving contexts.process_user_message - Core message processing with context managementexport_context - Export conversation state as JSONimport_context - Restore conversation stateclear_context - Reset all context dataget_debug_info - Detailed debugging informationstart_session / end_session - Session lifecycle managementlist_sessions - Active session monitoringget_session_stats - Performance analyticsThe default transport protocol is stdio. SSE (Server-Sent Events) is also supported for direct HTTP communication, using the endpoint http://127.0.0.1:8001/sse/.
# Clone the repository
git clone https://github.com/Beginnersguide138/cc-mcp.git
cd cc-mcp
# Install dependencies
uv sync
# Configure environment
cp .env.example .env
# Edit .env with your API credentials
To receive the latest updates after cloning the repository, use the following Git commands:
# Fetch the latest changes from the remote repository
git fetch origin
# Pull the latest changes from the main branch
git pull origin main
# Update dependencies (if they have changed)
uv sync
It's recommended to regularly update your local repository to:
# .env file example - Only 3 variables needed!
CLASSIFIER_API_URL=https://api.openai.com/v1/chat/completions
CLASSIFIER_API_KEY=sk-your_openai_api_key_here
CLASSIFIER_MODEL=gpt-3.5-turbo
# Alternative providers (see .env.example for full list):
# Azure OpenAI, Anthropic Claude, Google Gemini, Ollama supported
# For Ollama (Local LLM):
# CLASSIFIER_API_URL=http://localhost:11434/v1/chat/completions
# CLASSIFIER_API_KEY=not_required # Ollama doesn't need auth; leave empty with the latest version
# CLASSIFIER_MODEL=llama3
# Start CC-MCP server with stdio transport (default for clients like Cline)
uv run main.py
CC-MCP now supports Ollama for local LLM usage without API costs. This feature was added in a recent commit.
# Install Ollama from https://ollama.com/
# Download and run a model
ollama run llama3
.env:CLASSIFIER_API_URL=http://localhost:11434/v1/chat/completions
CLASSIFIER_API_KEY=not_required # Ollama doesn't need auth; leave empty
CLASSIFIER_MODEL=llama3 # Or: mistral, gemma, phi, qwen, etc.
env section in your existing cc-mcp configuration:"env": {
"CLASSIFIER_API_URL": "http://localhost:11434/v1/chat/completions",
"CLASSIFIER_API_KEY": "not_required",
"CLASSIFIER_MODEL": "llama3"
}
That's it! CC-MCP will now use your local Ollama model for intent classification.
import asyncio
from cc_mcp import process_user_message
async def demo():
# Define core problem
result = await process_user_message(
"I want to build an AI assistant for customer support"
)
print("Intent:", result["metadata"]["intent_classification"]["intent"])
# Expected: ["PROBLEM_DEFINITION"]
# Add constraints
result = await process_user_message(
"Budget is $50,000 and must be completed in 2 months"
)
print("Intent:", result["metadata"]["intent_classification"]["intent"])
# Expected: ["CONSTRAINT_ADDITION"]
# Ask unrelated question - context still preserved!
result = await process_user_message(
"What's the weather like today?"
)
# AI response will still maintain awareness of the support system project!
asyncio.run(demo())
# Export current conversation state
context_data = await export_context(session_id="my-session")
print(f"Core Problem: {context_data['core_problem']}")
print(f"Active Constraints: {len(context_data['constraints'])}")
# Clear context for fresh start
await clear_context(session_id="my-session")
# Import previously saved context
await import_context(json_state=context_data, session_id="my-session")
# Start new session
session_info = await start_session()
session_id = session_info["session_id"]
# Process messages in specific session
await process_user_message(
message="Design a mobile app",
session_id=session_id
)
# Check session statistics
stats = await get_session_stats(session_id=session_id)
print(f"Messages: {stats['total_messages']}")
print(f"Active Constraints: {stats['active_constraints']}")
# Extend intent classification in intent_classifier.py
CUSTOM_INTENTS = {
"TECHNICAL_SPEC": "User is providing technical specifications",
"BUDGET_CHANGE": "User is modifying budget constraints",
"TIMELINE_UPDATE": "User is adjusting project timeline"
}
# Configure in context_store.py
CONTEXT_CONFIG = {
"max_core_contexts": 3, # Maximum core problems per session
"max_evolving_items": 10, # Maximum constraints/refinements
"turn_history_limit": 5, # Recent conversation turns to keep
"auto_cleanup": True # Automatic memory optimization
}
# Optimize for your use case
CLASSIFIER_PARAMS = {
"temperature": 0.1, # Lower for consistency
"max_tokens": 150, # Sufficient for classification
"top_p": 0.9 # Focus on high-probability responses
}
MAIN_LLM_PARAMS = {
"temperature": 0.7, # Higher for creativity
"max_tokens": 2000, # Generous for detailed responses
"presence_penalty": 0.1 # Encourage diverse vocabulary
}
CC-MCP is designed with internationalization in mind:
We welcome contributions from the global community!
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)# Clone your fork
git clone https://github.com/YOUR-USERNAME/cc-mcp.git
cd cc-mcp
# Install development dependencies
uv sync --group dev
# Run pre-commit hooks
pre-commit install
# Run the full test suite
uv run pytest
CC-MCP represents a breakthrough in AI conversation management:
This project is licensed under the MIT License - see the LICENSE file for details.
Built with ❤️ by the CC-MCP Team
Empowering consistent AI conversations worldwide
Claim this server with your GitHub account to request manual ownership verification.
Link to the catalog listing for CC-MCP (Context Consistent MCP Server) from your README. This badge does not certify ownership, compatibility or security.
[](https://awesome-mcp.com/servers/cc-mcp)Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.
Separate sources, scopes and periods. Never combined or treated as installations, active users or security reviews.
No reviewed package or image identity; download statistics are not listed yet.
Alternative and complementary servers in the same category

Store and retrieve entities, relations and observations in a persistent local knowledge graph.

Organize problem solving into revisable, branching thought steps through an MCP tool.

Query-aware context compression with an MCP plugin for coding agents, plus Python and HTTP interfaces for reducing the context sent to a language model.