Skip to main content

code-context

License: MIT Python 3.10+ PyPI version

MCP (Model Context Protocol) server for managing API endpoints and code context for AI coding assistants.

Problem

When using AI coding assistants like Claude Code, you often need to reference API endpoints while writing code. This requires:

  • Repeatedly searching through codebases
  • High token consumption from context switching
  • Risk of using outdated API information
  • Manual tracking of endpoint specifications

Solution

code-context automatically scans and stores your API endpoints in a vector database, enabling:

  • ✅ Instant lookup by endpoint name or route
  • ✅ Semantic search by describing what the endpoint does
  • ✅ Complete specifications (headers, parameters, responses)
  • ✅ Always up-to-date with your codebase

Features

  • 🔍 Automatic scanning of Python FastAPI/Flask projects
  • 💾 Vector storage with Qdrant (embedded mode)
  • 🔧 MCP integration with Claude Code/Desktop
  • 📝 CRUD operations for endpoint management
  • 🚀 Zero-config setup with pipx install
  • 🎯 Extensible architecture for more languages

Installation

# Step 1: Install code-context
pipx install mcp-code-context

# Step 2: Initialize configuration (run once)
code-context init

# Step 3: Install MCP client integration
code-context install-mcp

The install-mcp wizard will guide you through:

  • Selecting your AI coding assistant platform
  • Automatically configuring the MCP integration
  • Testing the connection

Manual Installation (Development)

# Clone repository
git clone https://github.com/jieyefriic/code-context
cd code-context

# Install in development mode
pip install -e .

# Initialize configuration
code-context init

# Install MCP client
code-context install-mcp

MCP Client Installation

code-context works with 12+ AI coding assistants through the Model Context Protocol (MCP):

Supported Platforms: Claude Code • Cursor • Antigravity • Windsurf • Warp • Cline • VS Code Copilot • Copilot CLI • Amp • Gemini CLI • Codex • Factory CLI

Quick Install

code-context install-mcp

This interactive wizard will automatically configure your AI assistant.

Manual Installation

For detailed platform-specific instructions, see INSTALLATION.md

Quick Links:

Usage

1. Initialize (Run Once)

code-context init

This wizard will:

  • Guide you through selecting LLM provider (OpenAI, Gemini, DeepSeek, etc.)
  • Configure API keys securely
  • Set up embedding configuration
  • Create data directory at ~/.code-context/
  • Initialize embedded Qdrant database

Important: This step must be completed before using the MCP server.

2. Scan Your Codebase

In Claude Code, ask:

Scan my project directory for API endpoints

Or manually:

# In Python REPL
from code_context import tools
tools.scan_codebase("/path/to/your/project", language="python")

3. Query Endpoints

In Claude Code, you can now ask:

What's the user login endpoint specification?
Show me all endpoints related to authentication
What parameters does the /api/users/:id endpoint accept?

MCP Tools

The following tools are available to Claude Code:

search_endpoint

Search for endpoints by name or route

{
  "name": "get_user",      // Optional: exact name match
  "route": "/api/users"    // Optional: exact route match
}

add_endpoint

Manually add an endpoint

{
  "name": "create_user",
  "route": "/api/users",
  "method": "POST",
  "file_path": "/path/to/api.py",
  "description": "Create a new user",
  "parameters": {...},
  "response_format": {...}
}

scan_codebase

Scan a directory for endpoints

{
  "directory": "/path/to/project",
  "language": "python"
}

update_endpoint

Update an existing endpoint

{
  "endpoint_id": "uuid-here",
  "updates": {
    "description": "Updated description"
  }
}

delete_endpoint

Delete an endpoint

{
  "endpoint_id": "uuid-here"
}

list_endpoints

List all stored endpoints

{
  "limit": 100
}

Supported Frameworks

Current

  • ✅ Python: FastAPI, Flask

Planned

  • 🔜 Node.js: Express, NestJS
  • 🔜 Go: Gin, Echo, Chi
  • 🔜 Rust: Axum, Actix

Architecture

code-context/
├── src/code_context/
│   ├── server.py           # MCP server core
│   ├── config.py           # Configuration management
│   ├── tools/              # MCP tool implementations
│   ├── scanner/            # Code scanners (extensible)
│   │   ├── python.py       # Python scanner
│   │   └── [future: go.py, rust.py, etc.]
│   └── database/           # Qdrant client wrapper
└── tests/

Configuration

Environment Variables

# Custom data directory
export CODE_CONTEXT_DATA_DIR=~/.my-code-context

# Use remote Qdrant
export CODE_CONTEXT_QDRANT_URL=http://localhost:6333
export CODE_CONTEXT_QDRANT_API_KEY=your-key

# Collection settings
export CODE_CONTEXT_COLLECTION_NAME=my_endpoints
export CODE_CONTEXT_VECTOR_SIZE=1536

View Current Config

code-context info

Development

Setup

# Clone and install with dev dependencies
git clone https://github.com/jieyefriic/code-context
cd code-context
pip install -e ".[dev]"

Run Tests

pytest tests/

Code Formatting

black src/
ruff check src/

Extending

Add a New Language Scanner

Create src/code_context/scanner/golang.py:

from . import BaseScanner
from ..database import Endpoint

class GoScanner(BaseScanner):
    def can_handle(self, file_path):
        return file_path.suffix == ".go"

    def scan_file(self, file_path):
        # Implement Go-specific scanning
        endpoints = []
        # ... parse Go code ...
        return endpoints

Register in scanner/python.py:

def get_scanner(language: str):
    scanners = {
        "python": PythonScanner,
        "go": GoScanner,  # Add here
    }
    # ...

Roadmap

  • Basic MCP server
  • Python FastAPI/Flask scanner
  • Embedded Qdrant storage
  • LLM integration for semantic search
  • Support for more languages (Go, Rust, Node.js)
  • Web UI for endpoint management
  • VS Code extension
  • Automatic re-scanning on file changes
  • Cloud-hosted version for teams

Contributing

Contributions welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

License

MIT License - see LICENSE file for details

FAQ

Q: Does this work with Claude Desktop?

A: Yes! It works with both Claude Code and Claude Desktop.

Q: Can I use a remote Qdrant server?

A: Yes, set CODE_CONTEXT_QDRANT_URL environment variable.

Q: How do I update endpoints when code changes?

A: Re-run scan_codebase on the directory. Future versions will support auto-refresh.

Q: Can I use this with non-Python projects?

A: Not yet, but Go/Rust/Node.js support is planned. You can manually add endpoints with add_endpoint.

Q: Does this send my code to external services?

A: No. Everything runs locally unless you configure a remote Qdrant server. LLM integration (optional) will use your API keys.

Support


Made with ❤️ for the AI coding community

Metadata

Release files for mcp-code-context 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-code-context 0.1.0
File Size Uploaded Provenance
mcp_code_context-0.1.0.tar.gz 83.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mcp-code-context 0.1.0
File Interpreter ABI Platform
mcp_code_context-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 186.0 kB

Release files / mcp_code_context-0.1.0.tar.gz

Download URL mcp_code_context-0.1.0.tar.gz
Size 83.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d6a8cb3bd654bfd54fddeae914b857003cc6d78c223b090b20a26231f45eddd9
BLAKE2b-256 checksum
How to use checksums
b77fa446ae50c890cb6c960b8a613b201d7942de11891ee833ecc808f46ee0cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.1

Release files / mcp_code_context-0.1.0-py3-none-any.whl

Download URL mcp_code_context-0.1.0-py3-none-any.whl
Size 102.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f39b014a6850cbb0bb64b6defeb2ca0270bd3da18077c2610340e47e5368084f
BLAKE2b-256 checksum
How to use checksums
b30a4824979eb0b88c41c69baea604a9ebbb83c78b7f193eaf147de521436616
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.1

Security for mcp-code-context 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page