PyContextify
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@PyContextifyfind functions related to user authentication in the codebase"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
PyContextify

One-line: Semantic search server with relationship-aware discovery across codebases and documents.
PyContextify is a Python-based MCP (Model Context Protocol) server that provides intelligent semantic search capabilities over diverse knowledge sources. It combines vector similarity search with basic relationship tracking to help developers, researchers, and technical writers discover contextually relevant information across codebases and documentation.
Main Features:
๐ Semantic Search: Vector similarity with FAISS + hybrid keyword search
๐ Multi-Source: Index code and documents (PDF/MD/TXT)
๐ง Smart Chunking: Content-aware processing (code boundaries, document hierarchy)
โก Pre-loaded Models: Embedders initialize at startup for fast first requests
๐ Relationship Tracking: Basic relationship extraction (tags, references, code symbols)
๐ ๏ธ MCP Protocol: 5 essential functions for seamless AI assistant integration
Quickstart
# Install UV and dependencies
curl -LsSf https://astral.sh/uv/install.sh | sh
uv sync
# Run MCP server
uv run pycontextify --verboseRun with uvx
If you want to execute the published CLI without modifying your current
environment, uvx can resolve pycontextify from PyPI and run its console
entry point directly:
uvx pycontextify -- --helpThe double dash (--) ensures any following arguments are forwarded to
PyContextify itself. This requires a released version of the package to be
available on PyPI, which the manual publishing workflow now provides.
Related MCP server: RAG MCP Server
System Requirements
Python: Python 3.10 or newer for the MCP server core (full test suite currently targets Python 3.13+).
Package management: Ability to install dependencies via UV and resolve all runtime libraries, including FAISS, sentence-transformers, PDF processors, and supporting utilities.
CPU: 64-bit multi-core processor (4+ cores recommended) so FAISS vector search and sentence-transformers embedding generation can run locally without bottlenecks.
Memory: 8 GB RAM minimum (16 GB recommended for larger corpora) because embeddings and FAISS indexes reside in-process and scale with corpus size; switch to the lighter
all-MiniLM-L6-v2model if constrained.Network access: Internet connectivity on first run to download sentence-transformers models and other remote assets.
Storage & filesystem: At least 5 GB of free disk space to install Python dependencies, download embedding models, and persist FAISS indexes in
PYCONTEXTIFY_INDEX_DIR, along with write access for temporary working folders during indexing and testing.Optional acceleration: CUDA-capable GPU support is available by installing the optional
gpudependency group (faiss-gpu) alongside the default CPU build.
Table of Contents
Installation
PyPI (recommended)
pip install pycontextifyExtras are available for specific workflows:
pip install "pycontextify[dev]"โ testing, linting, and packaging helperspip install "pycontextify[nlp]"โ optional spaCy language modelpip install "pycontextify[ollama]"/[openai]โ alternative embedding providers
From Source with UV
Requirements: Python 3.10+ and the UV package manager
# Install UV package manager
curl -LsSf https://astral.sh/uv/install.sh | sh
# Clone and install dependencies
git clone https://github.com/pycontextify/pycontextify.git
cd pycontextify
uv sync
# Optional: Install development + release tooling
uv sync --extra devTo update dependencies from scratch use uv sync --reinstall.
Usage
Minimal example:
# Start the MCP server
uv run pycontextify
# Index content (via MCP client/AI assistant)
# The server exposes 5 MCP functions:
# - index_filebase(path, tags) - Unified indexing for code & docs
# - discover() - List indexed tags
# - search(query, top_k=5) - Semantic search
# - reset_index(remove_files=True, confirm=False) - Clear index data
# - status() - Get system status and statisticsExpected output:
Starting PyContextify MCP Server...
Server provides 5 essential MCP functions:
- index_filebase(path, tags): Unified filebase indexing
- discover(): List indexed tags
- search(query, top_k): Basic semantic search
- reset_index(confirm=True): Clear all indexed content
- status(): Get system status and statistics
MCP server ready and listening for requests...Chunking Techniques
PyContextify employs a hierarchical chunking system with specialized processors for different content types, optimizing semantic search while preserving structural integrity.
Content-Aware Chunking Strategies
Code Chunking (CodeChunker)
Primary Strategy: Structure-aware splitting by function/class boundaries
Language Support: Python, JavaScript, TypeScript, Java, C/C++, Rust, Go, and more
Boundary Detection:
def,class,function,const,var,let,public,private,protectedRelationship Extraction: Functions, classes, imports, variable assignments
Fallback: Token-based splitting when code blocks exceed size limits
Document Chunking (DocumentChunker)
Primary Strategy: Markdown header hierarchy preservation (
#,##,###)Section Tracking: Maintains parent-section relationships for context
Content Filtering: Requires minimum 50 characters per meaningful chunk
Relationship Extraction: Links
[text](url), citations[1],(Smith 2020), emphasized termsFallback: Token-based splitting when no structure is detected
Simple Chunking (SimpleChunker)
Fallback Strategy: Pure token-based chunking for unstructured content
Basic Relationships: Capitalized word extraction for entity hints
Universal Compatibility: Handles any text format as last resort
Technical Configuration
chunk_size: int = 512 # Target tokens per chunk (configurable)
chunk_overlap: int = 64 # Overlap between adjacent chunks
enable_relationships: bool # Extract lightweight knowledge graph data
max_relationships_per_chunk: int # Limit relationships to avoid noiseKey Features
Smart Selection: Automatic chunker selection via
ChunkerFactorybased on content typeToken Estimation:
words ร 1.3heuristic for English text with automatic oversized chunk splittingPosition Tracking: Maintains precise character start/end positions for all chunks
Metadata Preservation: Source path, embedding info, creation timestamps, and custom metadata
Relationship Graph: Lightweight knowledge extraction (imports, references, citations, links)
Bottom Line: PyContextify's chunking system intelligently adapts to content structureโrespecting code boundaries and document hierarchyโwhile maintaining configurable token limits and extracting contextual relationships for enhanced semantic search.
Configuration
Required environment variables / config:
PYCONTEXTIFY_EMBEDDING_MODELโ string โ default:all-MiniLM-L6-v2โ Embedding model for semantic searchPYCONTEXTIFY_EMBEDDING_PROVIDERโ string โ default:sentence_transformersโ Embedding provider (sentence_transformers, ollama, openai)PYCONTEXTIFY_INDEX_DIRโ string โ default:./index_dataโ Directory for storing search indicesPYCONTEXTIFY_AUTO_PERSISTโ boolean โ default:trueโ Automatically save after indexingPYCONTEXTIFY_AUTO_LOADโ boolean โ default:trueโ Automatically load index on startupPYCONTEXTIFY_CHUNK_SIZEโ integer โ default:512โ Text chunk size for processingPYCONTEXTIFY_USE_HYBRID_SEARCHโ boolean โ default:falseโ Enable hybrid vector + keyword search
Priority: CLI arguments > Environment variables > Defaults
Copy .env.example to .env and customize as needed.
API Reference
PyContextify exposes 5 MCP (Model Context Protocol) functions for semantic search and indexing:
index_filebase(path, tags)- Unified indexing for codebases and documents with relationship extractiondiscover()- List indexed tags for browsing and filteringsearch(query, top_k=5)- Hybrid semantic + keyword searchreset_index(remove_files=True, confirm=False)- Clear index datastatus()- Get system statistics and health
Full docs: See WARP.md for development guidance and architecture details
Tests & CI
Run tests:
# Run all tests with coverage (requires uv >= 0.4.20 for dependency groups)
uv run --extra dev --group dev pytest --cov=pycontextify
# Run MCP-specific tests
uv run python scripts/run_mcp_tests.py
# Quick smoke test
uv run python scripts/run_mcp_tests.py --smokeCI: Manual testing
Publishing to PyPI
Use the dedicated release checklist in RELEASING.md when preparing a public build.
Quick reference:
Bump
versioninpyproject.toml(usepython scripts/bump_version.py [major|minor|patch]for automation and ensure changelog coverage)Run the full test suite or
uv run python scripts/run_mcp_tests.py --smokeBuild distributables and run metadata checks:
python scripts/build_package.pyUpload to TestPyPI or PyPI with Twine once validation passes:
twine upload dist/*
Changelog
Detailed release history lives in CHANGELOG.md. Update the changelog alongside any version bump so users can track notable changes between releases.
Contributing
Please read CONTRIBUTING.md (or follow the short flow below):
Fork the project
Create a branch
feature/your-featureAdd tests and documentation
Open a pull request
Security
Please report security issues to: Create an issue in this repository (or see SECURITY.md)
License
This project is licensed under the MIT License โ see the LICENSE file for details.
Maintainers
PyContextify Project โ contact: Create an issue for questions or support
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceAn intelligent codebase processing server that provides agentic RAG capabilities for code repositories, enabling semantic search and contextual understanding through self-evaluating retrieval loops.2MIT
- FlicenseCqualityDmaintenanceCombines a knowledge graph with RAG (Retrieval-Augmented Generation) capabilities for semantic code indexing and search. Enables creating entity relationships, managing observations, and performing semantic searches across indexed codebases.13
- Alicense-qualityDmaintenanceEnables semantic code search across multiple repositories using AST-aware chunking and relationship tracking. Supports local LLM embeddings, real-time indexing, and cross-codebase dependency analysis through vector and graph databases.3MIT
- Alicense-qualityCmaintenanceSemantic search server for code and documentation using Qdrant vector database. Supports multi-language indexing, live updates, and natural language queries.1Apache 2.0
Related MCP Connectors
Enterprise code intelligence for M&A, security audits, and tech debt. Hosted server with 200k free.
Software component catalog: search your org's services, docs, APIs, dependencies, and ownership.
Search a billion+ documents โ papers, books, code, legal cases, forums, Wikipedia, and more.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/tbrandenburg/pycontextify'
If you have feedback or need assistance with the MCP directory API, please join our Discord server