Kontxt MCP Server
@ReyNeill
About Kontxt MCP Server
Codebase indexing MCP server
Config
Add this server to your MCP-compatible client using the configuration below.
{
"mcpServers": {
"Kontxt": {
"command": "python",
"args": [
"-m",
"venv",
"venv"
]
}
}
}Tools
No tools detected
We auto-extract tools from the README. The maintainer can list them under a ## Tools heading to populate this section.
Overview
What is Kontxt MCP Server?
Kontxt MCP Server is a Model Context Protocol server that indexes a user-specified local code repository and provides the get_codebase_context tool for AI clients like Cursor or Claude Desktop. It uses Google Gemini (default: gemini-2.5-flash-preview-04-17) internally to analyze the codebase and generate contextual responses based on the user’s query.
How to use Kontxt MCP Server?
Clone the repository, create a Python virtual environment, install dependencies from requirements.txt, and ensure the tree command is available on your system. Configure a Gemini API key in a .env file or via the --gemini-api-key argument. Run the server with python kontxt_server.py --repo-path /path/to/your/codebase. It starts in SSE mode on http://127.0.0.1:8080/sse by default; clients connect to this endpoint.
Key features of Kontxt MCP Server
- Connects to a local code repository for analysis.
- Provides the
get_codebase_contexttool for AI clients. - Uses Gemini 2.0 Flash (or custom model) with 1M input window.
- Supports SSE (recommended) and stdio transport protocols.
- Tracks token usage and allows configurable token limits (500k, 800k, 1M).
- Accepts user-attached files and additional context from queries.
Use cases of Kontxt MCP Server
- Ask an AI client “What’s this codebase about?” using the MCP tool.
- “How does the authentication system work?” – context-aware explanation.
- “Explain the data flow in the application” – targeted analysis.
- Compare implementations across files by referencing them in queries.
FAQ from Kontxt MCP Server
What transport protocols does Kontxt MCP Server support?
It supports SSE (Server‑Sent Events, recommended) and stdio transport. Use --transport sse or --transport stdio.
What are the runtime requirements?
Python 3, the tree command, and a Google Gemini API key. The server uses the google/gemma-7b tokenizer for token estimation (gated on Hugging Face; free access requires accepting terms).
How do I configure CORS?
By default only loopback origins are allowed. Use --cors-origins with a comma‑separated list of origins, or set the KONTXT_CORS_ORIGINS environment variable. Credentials are off unless --cors-credentials is set.
How do I stop the server?
Press Ctrl+C in the terminal. The server attempts a graceful shutdown with a 3‑second timeout.
Can I change the Gemini model or token limit?
Yes. Use --gemini-model NAME to specify a different model (default: models/gemini-2.5-flash-preview-04-17) and --token-threshold NUM to set the token limit to 500000, 800000 (default), or 1000000.
Frequently asked questions
What transport protocols does Kontxt MCP Server support?
It supports SSE (Server‑Sent Events, recommended) and stdio transport. Use `--transport sse` or `--transport stdio`.
What are the runtime requirements?
Python 3, the `tree` command, and a Google Gemini API key. The server uses the `google/gemma-7b` tokenizer for token estimation (gated on Hugging Face; free access requires accepting terms).
How do I configure CORS?
By default only loopback origins are allowed. Use `--cors-origins` with a comma‑separated list of origins, or set the `KONTXT_CORS_ORIGINS` environment variable. Credentials are off unless `--cors-credentials` is set.
How do I stop the server?
Press `Ctrl+C` in the terminal. The server attempts a graceful shutdown with a 3‑second timeout.
Can I change the Gemini model or token limit?
Yes. Use `--gemini-model NAME` to specify a different model (default: `models/gemini-2.5-flash-preview-04-17`) and `--token-threshold NUM` to set the token limit to 500000, 800000 (default), or 1000000.
Basic information
More Other MCP servers
🚀 Model Context Protocol (MCP) Curriculum for Beginners
microsoftThis open-source curriculum introduces the fundamentals of Model Context Protocol (MCP) through real-world, cross-language examples in .NET, Java, TypeScript, JavaScript, Rust and Python. Designed for developers, it focuses on practical techniques for building modular, scalable,

EverArt
modelcontextprotocolModel Context Protocol Servers
MaxKB
1Panel-dev🔥 MaxKB is an open-source platform for building enterprise-grade agents. 强大易用的开源企业级智能体平台。
Maestro
mobile-dev-incPainless E2E Automation for Mobile and Web

Lemon.io
lemon-ioRequest dedicated senior developers to work on your project, write job descriptions, and prep technical interviews — all without leaving your Claude chat. Just describe what you need, and Lemon.io MCP does the rest. 1–3
Comments