Context Portal
greatscottymac/context-portal · 762 stars · Python · Apache-2.0
MCP server Context Portal (ConPort): A memory bank MCP server building a project-specific knowledge graph to supercharge AI assistants. Enables powerful Retrieval Augmented Generation (RAG) for context-aware development in your IDE.
Install
uv run python src/context_portal_mcp/main.py --helpThese repos do not share one command. When an entry shows a command, it was copied as published. Check the repo's README before you run it.
Files
Context Portal MCP (ConPort)
(It's a memory bank!)
A database-backed Model Context Protocol (MCP) server for managing structured project context, designed to be used by AI assistants and developer tools within IDEs and other interfaces.
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
uvsignificantly 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:
{
"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:uvxhandles 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 tostderr(console). Useful for persistent logging and debugging server behavior.--log-level: Optional: Sets the minimum logging level for the server. Valid choices areDEBUG,INFO,WARNING,ERROR,CRITICAL. Defaults toINFO. Set toDEBUGfor 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_idat launch and rely on per-callworkspace_id(recommended if your client provides it on every call).
Alternative configuration (no --workspace_id at launch):
{
"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:
{
"mcpServers": {
"conport": {
"command": "uv",
"args": [
"run",
"--python",
".venv/bin/python",
"--directory",
"<path to context-portal repo> ",
"conport-mcp",
"--mode",
"stdio",
"--log-file",
"./logs/conport-dev.log",
"--log-level",
"DEBUG"
],
"disabled": false
}
}
}
Notes:
- Set
--directoryto your repo path; this uses your local checkout and venv interpreter. - Logs go to
./logs/conport-dev.logwithDEBUGverbosity.
Local environment setup
Set up for development or contribution via the Git repo.
- Clone the repository
git clone https://github.com/GreatScottyMac/context-portal.git
cd context-portal
- Create a virtual environment
uv venv
Activate it using your shell’s standard activation (e.g., source .venv/bin/activate on macOS/Linux).
- Install dependencies
uv pip install -r requirements.txt
- 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.
- Optional: CLI help
uv run python src/context_portal_mcp/main.py --help
Notes:
- For
--workspace_idbehavior 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:
Facts
- Kind
- MCP server
- Repo
- greatscottymac/context-portal
- Group
- Uncategorized
- Stars
- 762
- License
- Apache-2.0
- Language
- Python
- Last push
- 2026-01-27
- Forks
- 78
- 1Everythingmodelcontextprotocol/serversThis MCP server attempts to exercise all the features of the MCP protocol. It is not intended to be a useful server, but rather a test server for builders of MCP clients. It implements prompts, tools, resources, sampling, and more to showcase MCP capabilities.85.8k
- 2Fetchmodelcontextprotocol/serversA Model Context Protocol server that provides web content fetching capabilities. This server enables LLMs to retrieve and process content from web pages, converting HTML to markdown for easier consumption.85.8k
- 3Gitmodelcontextprotocol/serversA Model Context Protocol server for Git repository interaction and automation. This server provides tools to read, search, and manipulate Git repositories via Large Language Models.85.8k
- 4Memorymodelcontextprotocol/serversA basic implementation of persistent memory using a local knowledge graph. This lets Claude remember information about the user across chats.85.8k
- 5Sequential Thinkingmodelcontextprotocol/serversAn MCP server implementation that provides a tool for dynamic and reflective problem-solving through a structured thinking process.85.8k
- 6Timemodelcontextprotocol/serversA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.85.8k