Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
C

context-portal

> 编程语言
Open source

Context Portal (ConPort): A memory bank MCP server building a project-specific knowledge graph to supercharge AI assistants. Enables powerful Retrieval Augmente

764 stars0 likes1 views
WebsiteGitHub

About

Context Portal (ConPort): A memory bank MCP server building a project-specific knowledge graph to supercharge AI assistants. Enables powerful Retrieval Augmente

What is Context Portal MCP server (ConPort)?

Context Portal (ConPort) is your project's memory bank. It's a tool that helps AI assistants understand your specific software project better by storing important information like decisions, tasks, and architectural patterns in a structured way. Think of it as building a project-specific knowledge base that the AI can easily access and use to give you more accurate and helpful responses.

What it does:

  • Keeps track of project decisions, progress, and system designs.
  • Stores custom project data (like glossaries or specs).
  • Helps AI find relevant project information quickly (like a smart search).
  • Enables AI to use project context for better responses (RAG).
  • More efficient for managing, searching, and updating context compared to simple text file-based memory banks.

ConPort provides a robust and structured way for AI assistants to store, retrieve, and manage various types of project context. It effectively builds a project-specific knowledge graph, capturing entities like decisions, progress, and architecture, along with their relationships. This structured knowledge base, enhanced by vector embeddings for semantic search, then serves as a powerful backend for Retrieval Augmented Generation (RAG), enabling AI assistants to access precise, up-to-date information for more context-aware and accurate responses.

It replaces older file-based context management systems by offering a more reliable and queryable database backend (SQLite per workspace). ConPort is designed to be a generic context backend, compatible with various IDEs and client interfaces that support MCP.

Key features include:

  • Structured context storage using SQLite (one DB per workspace, automatically created).
  • MCP server (context_portal_mcp) built with Python/FastAPI.
  • A comprehensive suite of defined MCP tools for interaction (see "Available ConPort Tools" below).
  • Multi-workspace support via workspace_id.
  • Primary deployment mode: STDIO for tight IDE integration.
  • Enables building a dynamic project knowledge graph with explicit relationships between context items.
  • Includes vector data storage and semantic search capabilities to power advanced RAG.
  • Serves as an ideal backend for Retrieval Augmented Generation (RAG), providing AI with precise, queryable project memory.
  • Provides structured context that AI assistants can leverage for prompt caching with compatible LLM providers.
  • Manages database schema evolution using Alembic migrations, ensuring seamless updates and data integrity.

Prerequisites

Before you begin, ensure you have the following installed:

  • Python: Version 3.8 or higher is recommended.
    • Download Python
    • Ensure Python is added to your system's PATH during installation (especially on Windows).
  • uv: (Highly Recommended) A fast Python environment and package manager. Using uv significantly simplifies virtual environment creation and dependency installation.
    • Install uv

Installation and Configuration (Recommended)

The recommended way to install and run ConPort is by using uvx to execute the package directly from PyPI. This method avoids the need to manually create and manage virtual environments.

uvx Configuration (Recommended for most IDEs)

In your MCP client settings (e.g., mcp_settings.json), use the following configuration:

json
{
  "mcpServers": {
    "conport": {
      "command": "uvx",
      "args": [
        "--from",
        "context-portal-mcp",
        "conport-mcp",
        "--mode",
        "stdio",
        "--workspace_id",
        "${workspaceFolder}",
        "--log-file",
        "./logs/conport.log",
        "--log-level",
        "INFO"
      ]
    }
  }
}
  • command: uvx handles the environment for you.
  • args: Contains the arguments to run the ConPort server.
  • ${workspaceFolder}: This IDE variable is used to automatically provide the absolute path of the current project workspace.
  • --log-file: Optional: Path to a file where server logs will be written. If not provided, logs are directed to stderr (console). Useful for persistent logging and debugging server behavior.
  • --log-level: Optional: Sets the minimum logging level for the server. Valid choices are DEBUG, INFO, WARNING, ERROR, CRITICAL. Defaults to INFO. Set to DEBUG for verbose output during development or troubleshooting.

Important: Many IDEs do not expand ${workspaceFolder} when launching MCP servers. Use one of these safe options:

  1. Provide an absolute path for --workspace_id.
  2. Omit --workspace_id at launch and rely on per-call workspace_id (recommended if your client provides it on every call).

Alternative configuration (no --workspace_id at launch):

json
{
  "mcpServers": {
    "conport": {
      "command": "uvx",
      "args": [
        "--from",
        "context-portal-mcp",
        "conport-mcp",
        "--mode",
        "stdio",
        "--log-file",
        "./logs/conport.log",
        "--log-level",
        "INFO"
      ]
    }
  }
}

If you omit --workspace_id, the server will skip pre-initialization and initialize the database on the first tool call using the workspace_id provided in that call.

Installation for Developers (from Git Repository)

The most appropriate way to develop and test ConPort is to run it in your IDE as an MCP server using the configuration above. This exercises STDIO mode and real client behavior.

If you need to run against a local checkout and virtualenv, you can configure your MCP client to launch the dev server via uv run and your .venv/bin/python:

json
{
  "mcpServers": {
    "conport": {
      "command": "uv",
      "args": [
        "run",
        "--python",
        ".venv/bin/python",
        "--directory",
        " ",
        "conport-mcp",
        "--mode",
        "stdio",
        "--log-file",
        "./logs/conport-dev.log",
        "--log-level",
        "DEBUG"
      ],
      "disabled": false
    }
  }
}

Notes:

  • Set --directory to your repo path; this uses your local checkout and venv interpreter.
  • Logs go to ./logs/conport-dev.log with DEBUG verbosity.

Local environment setup

Set up for development or contribution via the Git repo.

  1. Clone the repository

    bash
    git clone https://github.com/GreatScottyMac/context-portal.git
    cd context-portal
  2. Create a virtual environment

    bash
    uv venv

    Activate it using your shell’s standard activation (e.g., source .venv/bin/activate on macOS/Linux).

  3. Install dependencies

    bash
    uv pip install -r requirements.txt
  4. Run in your IDE (recommended) Configure your IDE’s MCP settings using the "uvx Configuration" or the dev uv run configuration shown above. This is the most representative test of ConPort in STDIO mode.

  5. Optional: CLI help

    bash
    uv run python src/context_portal_mcp/main.py --help

Notes:

  • For --workspace_id behavior and IDE path handling, see the guidance under the "uvx Configuration" section above. Many IDEs do not expand ${workspaceFolder}.

For pre-upgrade cleanup, including clearing Python bytecode cache, please refer to the v0.2.4_UPDATE_GUIDE.md.

Usage with LLM Agents (Custom Instructions)

ConPort's effectiveness with LLM agents is significantly enhanced by providing specific custom instructions or system prompts to the LLM. This repository includes tailored strategy files for different environments:

  • For Roo Code:

    • roo_code_conport_strategy: Contains detailed instructions for LLMs operating within the Roo Code VS Code extension, guiding them on how to use ConPort tools for context management.
  • For CLine:

    • cline_conport_strategy: Contains detailed instructions for LLMs operating within the Cline VS Code extension, guiding them on how to use ConPort tools for context management.
  • For Windsurf Cascade:

    • cascade_conport_strategy: Specific guidance for LLMs integrated with the Windsurf Cascade environment. Important: When initiating a session in Cascade, it is necessary to explicity tell the LLM:
    Initialize according to custom instructions
  • For General/Platform-Agnostic Use:

    • generic_conport_strategy: Provides a platform-agnostic set of instructions for any MCP-capable LLM. It emphasizes using ConPort's get_conport_schema operation to dynamically discover the exact ConPort tool names and their parameters, guiding the LLM on when and why to perform conceptual interactions (like logging a decision or updating product context) rather than hardcoding specific tool invocation details.

How to Use These Strategy Files:

  1. Identify the strategy file relevant to your LLM agent's environment.
  2. Copy the entire content of that file.
  3. Paste it into your LLM's custom instructions or system prompt area. The method varies by LLM platform (IDE extension settings, web UI, API configuration).

These instructions equip the LLM with the knowledge to:

  • Initialize and load context from ConPort.
  • Update ConPort with new information (decisions, progress, etc.).
  • Manage custom data and relationships.
  • Understand the importance of workspace_id. Important Tip for Starting Sessions: To ensure the LLM agent correctly initializes and loads context, especially in interfaces that might not always strictly adhere to custom instructions on the first message, it's a good practice to start your interaction with a clear directive like: Initialize according to custom instructions. This can help prompt the agent to perform its ConPort initialization sequence as defined in its strategy file.

New Strategy Set: mem4sprint (What’s new)

The repository includes a new strategy/documentation set focused on sprint planning and operational flows:

  • conport-custom-instructions/mem4sprint.md — concise guidance and patterns for using flat categories and valid FTS prefixes.
  • conport-custom-instructions/mem4sprint.schema_and_templates.md — meta schema, compact starters, FTS query rules, and minimal operational call recipes.

Key highlights:

  • Flat category model (e.g., artifacts, rfc_doc, retrospective, ProjectGlossary, critical_settings).
  • Valid FTS5 prefixes only: category:, key:, value_text: for custom data; summary:, rationale:, implementation_details:, tags: for decisions.
  • Handler-layer query normalization; database layer remains unchanged.

Release note summary:

  • Added mem4sprint strategy/docs with flattened categories and explicit FTS rules.
  • Simplified examples and included minimal operational call recipes.
  • Documentation clarifies IDE workspace path handling for MCP.

Initial ConPort Usage in a Workspace

When you first start using ConPort in a new or existing project workspace, the ConPort database (context_portal/context.db) will be automatically created by the server if it doesn't exist. To help bootstrap the initial project context, especially the Product Context, consider the following:

Using a projectBrief.md File (Recommended)

  1. Create projectBrief.md: In the root directory of your project workspace, create a file named projectBrief.md.
  2. Add Content: Populate this file with a high-level overview of your pr

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Python

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言