Navigation
MCP Context Manager: Persistent Context & Project Mastery - MCP Implementation

MCP Context Manager: Persistent Context & Project Mastery

MCP Context Manager: Finally, let your AI keep its socks on between sessions—persistent context, project management frameworks, and zero mid-task meltdowns. 🧦🚀

Research And Data
4.2(29 reviews)
43 saves
20 comments

Users create an average of 20 projects per month with this tool

About MCP Context Manager

What is MCP Context Manager: Persistent Context & Project Mastery?

MCP Context Manager is a centralized framework designed to orchestrate persistent contextual data across multiple domains and projects. Built on the Model Context Protocol, it enables developers and teams to maintain, organize, and interlink entities like projects, components, and tasks while ensuring cross-domain relationships. This system provides a scalable solution for managing complex workflows and long-term project dependencies through modular entity structures and relational mapping.

How to use MCP Context Manager: Persistent Context & Project Mastery?

To utilize the framework, users initiate the server via CLI commands, configure domain-specific modules, and execute context-building operations. Key actions include defining entities (e.g., projects, components), establishing cross-domain relationships, and querying stored data. Integration with tools like Claude Desktop requires server configuration through API endpoints, allowing seamless access to persistent contextual information during development and task management.

MCP Context Manager Features

Key Features of MCP Context Manager: Persistent Context & Project Mastery?

  • Persistent Entity Storage: Maintains project, component, and task metadata across sessions
  • Cross-Domain Relational Graph: Maps interdependencies between developer workflows and project management layers
  • Modular Domain Architecture: Independent domain servers (Developer, Project, Student) with unified orchestration
  • CLI & API Accessibility: Command-line interfaces and RESTful endpoints for programmatic interaction
  • Debugging Infrastructure: Built-in logging systems with adjustable verbosity levels

Use cases of MCP Context Manager: Persistent Context & Project Mastery?

Typical applications include:

  • Software development lifecycle tracking with component dependency mapping
  • Agile project management through task-entity relationship visualization
  • Academic project repositories linking student work to curricula frameworks
  • Multi-team collaboration via shared contextual databases
  • AI tool integration for persistent context preservation in generative workflows

MCP Context Manager FAQ

FAQ from MCP Context Manager: Persistent Context & Project Mastery?

Q: How do I resolve port conflicts?
Use the --port flag to assign alternative ports when initializing the server.

Q: Why do entity relationships fail to save?
Verify domain server synchronization and check JSON schema compliance of entity definitions.

Q: Can I extend custom domains?
Yes, through the modular framework architecture by implementing the IDomain interface.

Q: What data persistence options exist?
Supports in-memory storage for development and optional PostgreSQL integration for production use.

Content

MCP Context Manager

A collection of Model Context Protocol (MCP) servers to enhance AI models with persistent context across work sessions throughout the project lifecycle.

Context for each project is stored in a domain-specific knowledge graph handled by the domain's server. All domain servers can be managed through a central Context Manager that provides unified access.

Each domain server is also a standalone MCP Server that you can use on its own without the Context Manager.

Features

  • Persistent Context : Easily buildcontext, loadcontext, and deletecontext as you progress from idea to production/publication/completion
  • Efficienct Access : Let AI models grab the exact context they need when they need it
  • Session Management :
    1. startsession tool to get an overview of what you've been working on in past sessions
    2. endsession tool to analyze the entire session and update knowledge graph for future sessions
  • Cross-Domain Support : Work with multiple knowledge domains through a single interface, including creating relationships between entities in different domains

Why knowledge graphs?

To free up the context window (performance), and minimize token cost (efficiency).

Available Servers

The contextmanager orchestrates several domain-specific MCP servers:

  1. Developer MCP Server : software development context with entities like projects, components, and tasks.

  2. Project MCP Server : project management context with entities like projects, tasks, and resources.

  3. Student MCP Server : educational context with entities like courses, assignments, and exams.

  4. Qualitative Research MCP Server : qualitative research context with entities like studies, participants, and interviews.

  5. Quantitative Research MCP Server : quantitative research context with entities like datasets, variables, and analyses.

For detailed documentation on each domain server, see the README files in their respective directories:

Context Manager Benefits

The Context Manager provides:

  • Unified Interface : Access all domain servers through a single interface.
  • Smart Routing : Automatically routes requests to the appropriate domain server.
  • Cross-Domain Context : Maintains references across different domains.

Implementation

The Context Manager uses the MCP Client SDK to communicate with domain-specific MCP servers. It:

  1. Maintains a registry of domain servers with their connection information
  2. Creates MCP clients to connect to each domain server
  3. Routes requests to the appropriate domain server based on the active domain
  4. Provides cross-domain functionality for relating entities across domains

Path Resolution

The Context Manager uses absolute paths constructed at runtime to locate domain servers. If you need to modify paths to domain servers, update the domains array in main/index.ts.

Installation & Usage

You can use the MCP Context Manager in several ways:

Using npx (Recommended)

Run directly with npx:

npx github:tejpalvirk/contextmanager

Global Installation

Install globally to make all servers available as commands:

npm install -g github:tejpalvirk/contextmanager

Then run:

mcp-server-contextmanager

Or run a specific domain server directly:

contextmanager-developer
contextmanager-project
contextmanager-student
contextmanager-qualitativeresearch
contextmanager-quantitativeresearch

Clone and Build from Source

For development or customization:

git clone https://github.com/tejpalvirk/contextmanager.git
cd contextmanager
npm install
npm run build

Then run:

node main/index.js

Command-Line Arguments

The Context Manager and domain servers accept the following command-line arguments:

# Run on a specific port (default: 3000)
npx github:tejpalvirk/contextmanager --port 3001

# Enable debug logging
npx github:tejpalvirk/contextmanager --debug

# Specify a config file
npx github:tejpalvirk/contextmanager --config ./my-config.json

# Run only specific domain servers
npx github:tejpalvirk/contextmanager --domains developer,project

Environment Variables

Each domain server supports the following environment variables to customize where data is stored:

  • MEMORY_FILE_PATH : Path where the knowledge graph data will be stored

    • Can be absolute or relative (relative paths use current working directory)
    • Default: <domain_directory>/memory.json
  • SESSIONS_FILE_PATH : Path where session data will be stored

    • Can be absolute or relative (relative paths use current working directory)
    • Default: <domain_directory>/sessions.json

Example usage:

# Store data in the current directory
MEMORY_FILE_PATH="./my-dev-memory.json" SESSIONS_FILE_PATH="./my-dev-sessions.json" npx github:tejpalvirk/contextmanager

# Store data in a specific location (absolute path)
MEMORY_FILE_PATH="/path/to/data/developer-memory.json" npx github:tejpalvirk/contextmanager

# Store data in user's home directory
MEMORY_FILE_PATH="$HOME/contextmanager/memory.json" npx github:tejpalvirk/contextmanager

Interacting with Domain Servers

Domain Management

Use the setActiveDomain tool to select which domain you want to work with:

setActiveDomain(domain="developer")

Session Management

Start a new session for the active domain:

startsession(domain="developer")

End a session when you're done:

endsession(sessionId="session_id_here", stage="assembly", stageNumber=6, totalStages=6, nextStageNeeded=false)

Context Operations

Build context for the active domain:

buildcontext(type="entities", data={...})

Load context for a specific entity:

loadcontext(entityName="MyProject", entityType="project")

Delete context:

deletecontext(type="entities", data={...})

Example: Working with the Developer Domain

// Set the active domain to developer
setActiveDomain(domain="developer")

// Start a new session
startsession(domain="developer")

// Create a new project entity
buildcontext(type="entities", data={
  "entityType": "project",
  "name": "MyProject",
  "description": "A sample project",
  "language": "TypeScript",
  "framework": "React"
})

// Load context for the project
loadcontext(entityName="MyProject", entityType="project")

// Create a component for the project
buildcontext(type="entities", data={
  "entityType": "component",
  "name": "AuthService",
  "project": "MyProject",
  "description": "Authentication service component",
  "dependencies": ["UserService"]
})

Cross-Domain Operations

Create relationships between entities in different domains:

relateCrossDomain(fromDomain="developer", fromEntity="ProjectX", toDomain="project", toEntity="ProjectX", relationType="manages")

Example: Cross-Domain Integration

// Create relationship between developer project and project management task
relateCrossDomain(
  fromDomain="developer", 
  fromEntity="MyProject", 
  toDomain="project", 
  toEntity="ProjectX", 
  relationType="manages"
)

Integration with Claude

In Claude Desktop, configure the Context Manager in settings:

{
  "mcpServers": {
    "contextmanager": {
      "command": "npx",
      "args": [
        "-y",
        "github:tejpalvirk/contextmanager"
      ],
      "options": {
        "port": 3000,
        "domains": ["developer", "project", "student"]
      }
    }
  }
}

Troubleshooting

Common Issues

  1. Port Already in Use :

    Error: listen EADDRINUSE: address already in use :::3000

Solution: Use the --port option to specify a different port.

  1. Connection Refused :

    Error: connect ECONNREFUSED 127.0.0.1:3000

Solution: Ensure the server is running and accessible at the specified address.

  1. Domain Server Not Found :

    Error: Domain server 'developer' not found

Solution: Check that the domain name is correct and the server is registered in the Context Manager.

  1. Path Resolution Errors :

    Error: Cannot find module '...'

Solution: Ensure all paths in the domains array in main/index.ts are correctly specified.

  1. Method Not Found :

    Error: Method 'buildcontext' not found in domain 'developer'

Solution: Verify the method name and ensure it is supported by the domain server.

Debugging

For detailed logging, use the --debug flag:

npx github:tejpalvirk/contextmanager --debug

Versioning

This package follows Semantic Versioning:

  • MAJOR : Incompatible API changes
  • MINOR : Backwards-compatible functionality additions
  • PATCH : Backwards-compatible bug fixes

Current version: 1.0.0

Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Coding Standards

  • Use TypeScript for all new code
  • Follow the existing code style
  • Add tests for new functionality
  • Update documentation as needed

Development

Prerequisites

  • Node.js v16 or higher
  • npm v7 or higher

Building

npm install
npm run build

Testing

npm test

License

MIT

Acknowledgments

This project builds on the Model Context Protocol created by Anthropic for Claude.

Related MCP Servers & Clients