Skip to main content

A Codebase MCP Tools

Project description

WindTools MCP Server

MCP Server for the WindTools code assistant, providing document embedding and retrieval capabilities using ChromaDB and sentence transformers.

Features

  • Semantic Code Search: Uses sentence transformers for embedding code snippets and retrieval
  • Code Repository Indexing: Automatically indexes code files from specified directories
  • Persistent Storage: Saves code embeddings in ChromaDB for persistent retrieval
  • Directory Exploration: Built-in tools for navigating and exploring codebases
  • Background Initialization: Loads resources asynchronously to minimize startup time
  • Environment Configuration: Configurable through environment variables

Tools

  1. list_dir

    • List the contents of a directory
    • Inputs:
      • directory_path (string): Path to list contents of, should be absolute path to a directory
    • Returns: JSON string containing directory information including file types and sizes
  2. get_initialization_status

    • Check the status of the background initialization process
    • Returns: JSON string with initialization status of ChromaDB and embedding model
  3. index_repository

    • Index code files from specified directories into ChromaDB
    • Inputs:
      • target_directories (array of strings): List of absolute paths to directories to index
      • force_reindex (boolean, optional): If true, reindex all files even if they already exist in the index
    • Returns: JSON string containing indexing statistics and results
  4. codebase_search

    • Find code snippets relevant to a search query
    • Inputs:
      • query (string): Search query describing what you're looking for
      • limit (integer, optional): Maximum number of results to return (default: 10)
      • min_relevance (float, optional): Minimum relevance score threshold (0.0 to 1.0)
    • Returns: JSON string containing search results with relevant code snippets

Technical Architecture

The WindTools MCP Server is built on these key components:

  • ChromaDB: Vector database for storing and retrieving code embeddings
  • Sentence Transformers: Deep learning models for creating embeddings from code
  • FastMCP: Framework for building MCP-compliant servers
  • Async Lifespan Management: Efficient resource initialization and cleanup

Initialization Process

The server initializes ChromaDB and the embedding model in the background, allowing it to start accepting requests immediately while resource loading continues in the background. The get_initialization_status tool can be used to check if the initialization is complete.

Setup

Environment Variables

The server can be configured with the following environment variables:

  • DATA_ROOT: Absolute directory where ChromaDB database and model cache will be stored (default: a 'data' directory inside the package)
  • CHROMA_DB_FOLDER_NAME: Name of the folder where ChromaDB stores data (default: "default")
  • SENTENCE_TRANSFORMER_PATH: Path to the sentence transformer model (default: "jinaai/jina-embeddings-v2-base-code")

Installation

Using pip

pip install windtools-mcp

From source

git clone https://github.com/ZahidGalea/windtools-mcp
cd windtools-mcp
pip install -e .

Usage with Claude Desktop

Add the following to your claude_desktop_config.json:

Direct Execution

Using Python 3.11 as ChromaDB has issues with newer Python versions.

{
  "mcpServers": {
    "windtools": {
      "command": "uvx",
      "args": [
        "-p",
        "3.11",
        "-U",
        "windtools-mcp"
      ],
      "env": {
        "DATA_ROOT": "/Users/<user>/windtools_data",
        "CHROMA_DB_FOLDER_NAME": "chromadb",
        "SENTENCE_TRANSFORMER_PATH": "jinaai/jina-embeddings-v2-base-code"
      }
    }
  }
}

Data (including ChromaDB database and model cache) will be saved in the /Users/<user>/windtools_data directory and persist between container executions.

Development

Requirements

  • Python 3.11
  • Dependencies listed in pyproject.toml

Development Setup

For developing:

# Install development dependencies
uv sync --dev

If you want to use locally:

pip install -e .

Configuration for local development:

{
  "mcpServers": {
    "windtools": {
      "command": "uv",
      "args": [
        "run",
        "windtools-mcp"
      ],
      "env": {
        "DATA_ROOT": "/Users/<user>/windtools_data",
        "CHROMA_DB_FOLDER_NAME": "chromadb",
        "SENTENCE_TRANSFORMER_PATH": "jinaai/jina-embeddings-v2-base-code"
      }
    }
  }
}

Inspector

npx @modelcontextprotocol/inspector uvx -p 3.11 windtools-mcp
npx @modelcontextprotocol/inspector uv run windtools-mcp

Running Tests

pytest tests/

The project includes both unit tests and integration tests using pytest and pytest-asyncio for testing asynchronous functionality.

Project Structure

src/
  windtools_mcp/
    __init__.py
    __main__.py
    server.py
tests/
  test_client.py
  test_unit.py
.github/
  workflows/
    publish.yml
    test.yml
.gitignore
.python-version
pyproject.toml
README.md
VERSION

Release Process

The project version is managed centrally in the VERSION file. The release process is automatic:

  1. Update the version number in the VERSION file
  2. Commit and push to the main branch
  3. The GitHub Actions workflow will automatically:
    • Detect the change in the VERSION file
    • Create a git tag with the format v{VERSION}
    • Generate a release on GitHub
    • Publish the package to PyPI

It is not necessary to manually create tags or publish to PyPI, everything is managed automatically when the VERSION file is updated.

License

This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

windtools_mcp-1.2.1.tar.gz (110.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

windtools_mcp-1.2.1-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file windtools_mcp-1.2.1.tar.gz.

File metadata

  • Download URL: windtools_mcp-1.2.1.tar.gz
  • Upload date:
  • Size: 110.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for windtools_mcp-1.2.1.tar.gz
Algorithm Hash digest
SHA256 d57eae325a04fd1acea71af2076e703dc4b699a8952c1c6081396e7165f66663
MD5 e2fa8fe5072585517a05c6c6c8a34623
BLAKE2b-256 80c42325e6b10b5d78cc69e3daaf8a1df92674a01f2f6b09f3517346958fed66

See more details on using hashes here.

File details

Details for the file windtools_mcp-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: windtools_mcp-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for windtools_mcp-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2695e9ad5ed4e1d5f842bb1332e8dc71177c40234e0ff4018d73845b3867d283
MD5 61b2c3ba1c43f2508fe7caee081e5abd
BLAKE2b-256 5077ec9fa6537be290f1718c5fd276dc3a883cfe0e9cbae8ba8c47a2ec79ac36

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page