ContextManager MCP server

Provides a multi-domain context management system with specialized knowledge graph tools for tracking and analyzing work and learning activities across software development, academic, and professional contexts.
Back to servers
Setup instructions
Provider
Tejpal Virk
Release date
Mar 17, 2025
Language
TypeScript
Stats
7 stars

The MCP Context Manager is a collection of servers that implement the Model Context Protocol (MCP), enabling AI models to maintain persistent context across work sessions. It stores context in domain-specific knowledge graphs managed through a central interface or as standalone servers for different domains like development, project management, education, and research.

Installation Options

Using npx (Recommended)

Run directly with npx without installation:

npx github:tejpalvirk/contextmanager

Global Installation

Install globally to access all servers as commands:

npm install -g github:tejpalvirk/contextmanager

Then run either the main context manager:

mcp-server-contextmanager

Or run a specific domain server directly:

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

From Source

Clone and build the source code:

git clone https://github.com/tejpalvirk/contextmanager.git
cd contextmanager
npm install
npm run build
node main/index.js

Command-Line Options

Customize the server's behavior with command-line arguments:

# Run on a specific port (default is 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

Configure where data is stored using these environment variables:

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

# Use an absolute path
MEMORY_FILE_PATH="/path/to/data/developer-memory.json" npx github:tejpalvirk/contextmanager

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

Using the Context Manager

Domain Selection

Set which domain you want to work with:

setActiveDomain(domain="developer")

Session Management

Start a new work session:

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 new context information:

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

Load context for a specific entity:

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

Delete context:

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

Managing Status and Priority

Assign status to entities:

buildcontext(type="relations", data=[
  { from: "LoginFeature", to: "active", relationType: "has_status" }
])

Set entity priorities:

buildcontext(type="relations", data=[
  { from: "BugFix", to: "high", relationType: "has_priority" }
])

Define sequential relationships:

buildcontext(type="relations", data=[
  { from: "DataModel", to: "UserInterface", relationType: "precedes" }
])

Example Workflows

Developer Domain Example

// Set the active domain
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 and set its status
buildcontext(type="entities", data={
  "entityType": "component",
  "name": "AuthService",
  "project": "MyProject",
  "description": "Authentication service component",
  "dependencies": ["UserService"]
})

buildcontext(type="relations", data=[
  { from: "AuthService", to: "active", relationType: "has_status" },
  { from: "AuthService", to: "high", relationType: "has_priority" }
])

Cross-Domain Operations

Create relationships between entities in different domains:

// Link a developer project to a project management task
relateCrossDomain(
  fromDomain="developer", 
  fromEntity="MyProject", 
  toDomain="project", 
  toEntity="ProjectX", 
  relationType="manages"
)

Claude Integration

Configure the Context Manager in Claude Desktop settings:

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

Troubleshooting

Common Issues

  • Port Already in Use: Use --port to specify a different port
  • Connection Refused: Ensure the server is running at the specified address
  • Domain Server Not Found: Check that the domain name is correct
  • Path Resolution Errors: Verify paths in the domains array
  • Method Not Found: Ensure the method is supported by the domain server
  • Invalid Status/Priority: Use correct values for the specific domain

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "contextmanager" '{"command":"npx","args":["-y","github:tejpalvirk/contextmanager"],"options":{"port":3000,"domains":["developer","project","student"]}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

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

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

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

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later