vecgrep 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,56 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+
15
+ - name: Install uv
16
+ uses: astral-sh/setup-uv@v4
17
+
18
+ - name: Set up Python
19
+ run: uv python install 3.12
20
+
21
+ - name: Install dependencies (with dev extras)
22
+ run: uv sync --extra dev
23
+
24
+ - name: Cache sentence-transformers model
25
+ uses: actions/cache@v4
26
+ with:
27
+ path: |
28
+ ~/.cache/huggingface
29
+ ~/.cache/torch
30
+ key: ${{ runner.os }}-st-model-all-MiniLM-L6-v2
31
+
32
+ - name: Check imports & server loads
33
+ run: |
34
+ uv run python -c "
35
+ from vecgrep.server import mcp
36
+ tools = [t.name for t in mcp._tool_manager.list_tools()]
37
+ assert 'index_codebase' in tools
38
+ assert 'search_code' in tools
39
+ assert 'get_index_status' in tools
40
+ print('All tools registered:', tools)
41
+ "
42
+
43
+ - name: Lint
44
+ run: uv run ruff check src/ tests/
45
+
46
+ - name: Run tests
47
+ run: uv run pytest tests/ -v --tb=short --cov=src/vecgrep --cov-report=xml
48
+
49
+ - name: Upload coverage to Codecov
50
+ uses: codecov/codecov-action@v4
51
+ with:
52
+ files: coverage.xml
53
+ fail_ci_if_error: false
54
+
55
+ - name: Type check (non-blocking)
56
+ run: uv run pyright src/ || true
@@ -0,0 +1,32 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.pyo
5
+ *.pyd
6
+ *.egg
7
+ *.egg-info/
8
+ dist/
9
+ build/
10
+ .eggs/
11
+ .pytest_cache/
12
+ .mypy_cache/
13
+ .ruff_cache/
14
+ .tox/
15
+ htmlcov/
16
+ .coverage
17
+ *.cover
18
+
19
+ # Virtual environments
20
+ .venv/
21
+ venv/
22
+ env/
23
+
24
+ # Distribution
25
+ *.whl
26
+
27
+ # IDE
28
+ .idea/
29
+ .vscode/
30
+ *.swp
31
+ *.swo
32
+ .DS_Store
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,2 @@
1
+ # Global owner — reviews required on all PRs
2
+ * @iamvirul
@@ -0,0 +1,31 @@
1
+ # Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as contributors and maintainers pledge to make participation in VecGrep a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ ## Our Standards
8
+
9
+ Examples of behavior that contributes to a positive environment:
10
+
11
+ - Using welcoming and inclusive language
12
+ - Being respectful of differing viewpoints and experiences
13
+ - Gracefully accepting constructive criticism
14
+ - Focusing on what is best for the community
15
+ - Showing empathy towards other community members
16
+
17
+ Examples of unacceptable behavior:
18
+
19
+ - The use of sexualized language or imagery and unwelcome sexual attention or advances
20
+ - Trolling, insulting/derogatory comments, and personal or political attacks
21
+ - Public or private harassment
22
+ - Publishing others' private information without explicit permission
23
+ - Other conduct which could reasonably be considered inappropriate in a professional setting
24
+
25
+ ## Enforcement
26
+
27
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting the maintainers directly. All complaints will be reviewed and investigated promptly and fairly.
28
+
29
+ ## Attribution
30
+
31
+ This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1.
@@ -0,0 +1,45 @@
1
+ # Contributing to VecGrep
2
+
3
+ Thanks for your interest in contributing!
4
+
5
+ ## Getting Started
6
+
7
+ ```bash
8
+ git clone https://github.com/iamvirul/vecgrep
9
+ cd vecgrep
10
+ uv sync
11
+ ```
12
+
13
+ ## Development
14
+
15
+ Run the server locally:
16
+ ```bash
17
+ uv run vecgrep
18
+ ```
19
+
20
+ Test against a codebase:
21
+ ```bash
22
+ uv run python -c "
23
+ from vecgrep.server import _do_index, search_code
24
+ print(_do_index('/path/to/project'))
25
+ print(search_code('your query here', '/path/to/project'))
26
+ "
27
+ ```
28
+
29
+ ## Submitting Changes
30
+
31
+ 1. Fork the repository
32
+ 2. Create a feature branch (`git checkout -b feat/my-feature`)
33
+ 3. Make your changes
34
+ 4. Open a pull request against `main`
35
+
36
+ ## Guidelines
37
+
38
+ - Keep PRs focused — one feature or fix per PR
39
+ - Add tests for new functionality where practical
40
+ - Follow existing code style (ruff for formatting/linting)
41
+ - All `unsafe` usage (if any) must have a comment explaining why
42
+
43
+ ## Reporting Bugs
44
+
45
+ Open a GitHub issue with steps to reproduce and your Python/OS version.
vecgrep-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 iamvirul
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
vecgrep-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,131 @@
1
+ Metadata-Version: 2.4
2
+ Name: vecgrep
3
+ Version: 0.1.0
4
+ Summary: Cursor-style vector search MCP plugin for Claude Code
5
+ Project-URL: Homepage, https://github.com/iamvirul/VecGrep
6
+ Project-URL: Repository, https://github.com/iamvirul/VecGrep
7
+ Project-URL: Issues, https://github.com/iamvirul/VecGrep/issues
8
+ Author: iamvirul
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Keywords: claude,code-search,embeddings,mcp,semantic-search
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
17
+ Requires-Python: >=3.12
18
+ Requires-Dist: mcp[cli]<2.0,>=1.0
19
+ Requires-Dist: numpy>=1.26
20
+ Requires-Dist: sentence-transformers<4.0,>=3.0
21
+ Requires-Dist: tree-sitter-languages<2.0,>=1.10
22
+ Provides-Extra: dev
23
+ Requires-Dist: pyright>=1.1.360; extra == 'dev'
24
+ Requires-Dist: pytest-cov>=5.0; extra == 'dev'
25
+ Requires-Dist: pytest>=8.0; extra == 'dev'
26
+ Requires-Dist: ruff>=0.4.0; extra == 'dev'
27
+ Description-Content-Type: text/markdown
28
+
29
+ # VecGrep
30
+
31
+ [![CI](https://github.com/iamvirul/VecGrep/actions/workflows/ci.yml/badge.svg)](https://github.com/iamvirul/VecGrep/actions/workflows/ci.yml)
32
+ [![codecov](https://codecov.io/gh/iamvirul/VecGrep/branch/main/graph/badge.svg)](https://codecov.io/gh/iamvirul/VecGrep)
33
+
34
+ Cursor-style semantic code search as an MCP plugin for Claude Code.
35
+
36
+ Instead of grepping 50 files and sending 30,000 tokens to Claude, VecGrep returns the top 8 semantically relevant code chunks (~1,600 tokens). That's a **~95% token reduction** for codebase queries.
37
+
38
+ ## How it works
39
+
40
+ 1. **Chunk** — Parses source files with tree-sitter to extract semantic units (functions, classes, methods)
41
+ 2. **Embed** — Encodes each chunk locally using `all-MiniLM-L6-v2` (384-dim, ~80MB one-time download)
42
+ 3. **Store** — Saves embeddings + metadata in SQLite under `~/.vecgrep/<project_hash>/`
43
+ 4. **Search** — Cosine similarity over all embeddings returns the most relevant snippets
44
+
45
+ Incremental re-indexing via SHA256 file hashing skips unchanged files.
46
+
47
+ ## Installation
48
+
49
+ Requires Python 3.12+ and [uv](https://docs.astral.sh/uv/).
50
+
51
+ ```bash
52
+ pip install vecgrep # standard pip
53
+ uv tool install vecgrep # uv tool (isolated, recommended)
54
+ ```
55
+
56
+ ## Claude Code integration
57
+
58
+ Add to your Claude Code MCP settings (`~/.claude/claude_desktop_config.json` or via `claude mcp add`):
59
+
60
+ ```json
61
+ {
62
+ "mcpServers": {
63
+ "vecgrep": {
64
+ "command": "uvx",
65
+ "args": ["vecgrep"]
66
+ }
67
+ }
68
+ }
69
+ ```
70
+
71
+ Or with the CLI:
72
+
73
+ ```bash
74
+ claude mcp add vecgrep -- uvx vecgrep
75
+ ```
76
+
77
+ `uvx` downloads and runs VecGrep in an isolated environment on first use — no cloning or manual setup required.
78
+
79
+ ## Tools
80
+
81
+ ### `index_codebase(path, force=False)`
82
+
83
+ Index a project directory. Skips unchanged files on subsequent calls.
84
+
85
+ ```
86
+ index_codebase("/path/to/myproject")
87
+ # → "Indexed 142 file(s), 1847 chunk(s) added (0 file(s) skipped, unchanged)"
88
+ ```
89
+
90
+ ### `search_code(query, path, top_k=8)`
91
+
92
+ Semantic search. Auto-indexes if no index exists.
93
+
94
+ ```
95
+ search_code("how does user authentication work", "/path/to/myproject")
96
+ ```
97
+
98
+ Returns formatted snippets with file paths, line numbers, and similarity scores:
99
+
100
+ ```
101
+ [1] src/auth.py:45-72 (score: 0.87)
102
+ def authenticate_user(token: str) -> User:
103
+ ...
104
+
105
+ [2] src/middleware.py:12-28 (score: 0.81)
106
+ ...
107
+ ```
108
+
109
+ ### `get_index_status(path)`
110
+
111
+ Check index statistics.
112
+
113
+ ```
114
+ Index status for: /path/to/myproject
115
+ Files indexed: 142
116
+ Total chunks: 1847
117
+ Last indexed: 2026-02-22T07:20:31+00:00
118
+ Index size: 28.4 MB
119
+ ```
120
+
121
+ ## Supported languages
122
+
123
+ Python, JavaScript/TypeScript, Rust, Go, Java, C/C++, Ruby, Swift, Kotlin, C#
124
+
125
+ All other text files fall back to sliding-window line chunks.
126
+
127
+ ## Index location
128
+
129
+ `~/.vecgrep/<sha256-of-project-path>/index.db`
130
+
131
+ Each project gets its own isolated index. Delete the directory to wipe the index.
@@ -0,0 +1,103 @@
1
+ # VecGrep
2
+
3
+ [![CI](https://github.com/iamvirul/VecGrep/actions/workflows/ci.yml/badge.svg)](https://github.com/iamvirul/VecGrep/actions/workflows/ci.yml)
4
+ [![codecov](https://codecov.io/gh/iamvirul/VecGrep/branch/main/graph/badge.svg)](https://codecov.io/gh/iamvirul/VecGrep)
5
+
6
+ Cursor-style semantic code search as an MCP plugin for Claude Code.
7
+
8
+ Instead of grepping 50 files and sending 30,000 tokens to Claude, VecGrep returns the top 8 semantically relevant code chunks (~1,600 tokens). That's a **~95% token reduction** for codebase queries.
9
+
10
+ ## How it works
11
+
12
+ 1. **Chunk** — Parses source files with tree-sitter to extract semantic units (functions, classes, methods)
13
+ 2. **Embed** — Encodes each chunk locally using `all-MiniLM-L6-v2` (384-dim, ~80MB one-time download)
14
+ 3. **Store** — Saves embeddings + metadata in SQLite under `~/.vecgrep/<project_hash>/`
15
+ 4. **Search** — Cosine similarity over all embeddings returns the most relevant snippets
16
+
17
+ Incremental re-indexing via SHA256 file hashing skips unchanged files.
18
+
19
+ ## Installation
20
+
21
+ Requires Python 3.12+ and [uv](https://docs.astral.sh/uv/).
22
+
23
+ ```bash
24
+ pip install vecgrep # standard pip
25
+ uv tool install vecgrep # uv tool (isolated, recommended)
26
+ ```
27
+
28
+ ## Claude Code integration
29
+
30
+ Add to your Claude Code MCP settings (`~/.claude/claude_desktop_config.json` or via `claude mcp add`):
31
+
32
+ ```json
33
+ {
34
+ "mcpServers": {
35
+ "vecgrep": {
36
+ "command": "uvx",
37
+ "args": ["vecgrep"]
38
+ }
39
+ }
40
+ }
41
+ ```
42
+
43
+ Or with the CLI:
44
+
45
+ ```bash
46
+ claude mcp add vecgrep -- uvx vecgrep
47
+ ```
48
+
49
+ `uvx` downloads and runs VecGrep in an isolated environment on first use — no cloning or manual setup required.
50
+
51
+ ## Tools
52
+
53
+ ### `index_codebase(path, force=False)`
54
+
55
+ Index a project directory. Skips unchanged files on subsequent calls.
56
+
57
+ ```
58
+ index_codebase("/path/to/myproject")
59
+ # → "Indexed 142 file(s), 1847 chunk(s) added (0 file(s) skipped, unchanged)"
60
+ ```
61
+
62
+ ### `search_code(query, path, top_k=8)`
63
+
64
+ Semantic search. Auto-indexes if no index exists.
65
+
66
+ ```
67
+ search_code("how does user authentication work", "/path/to/myproject")
68
+ ```
69
+
70
+ Returns formatted snippets with file paths, line numbers, and similarity scores:
71
+
72
+ ```
73
+ [1] src/auth.py:45-72 (score: 0.87)
74
+ def authenticate_user(token: str) -> User:
75
+ ...
76
+
77
+ [2] src/middleware.py:12-28 (score: 0.81)
78
+ ...
79
+ ```
80
+
81
+ ### `get_index_status(path)`
82
+
83
+ Check index statistics.
84
+
85
+ ```
86
+ Index status for: /path/to/myproject
87
+ Files indexed: 142
88
+ Total chunks: 1847
89
+ Last indexed: 2026-02-22T07:20:31+00:00
90
+ Index size: 28.4 MB
91
+ ```
92
+
93
+ ## Supported languages
94
+
95
+ Python, JavaScript/TypeScript, Rust, Go, Java, C/C++, Ruby, Swift, Kotlin, C#
96
+
97
+ All other text files fall back to sliding-window line chunks.
98
+
99
+ ## Index location
100
+
101
+ `~/.vecgrep/<sha256-of-project-path>/index.db`
102
+
103
+ Each project gets its own isolated index. Delete the directory to wipe the index.
@@ -0,0 +1,21 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ | Version | Supported |
6
+ |---------|-----------|
7
+ | latest | yes |
8
+
9
+ ## Reporting a Vulnerability
10
+
11
+ Please **do not** report security vulnerabilities through public GitHub issues.
12
+
13
+ Instead, open a [GitHub Security Advisory](https://github.com/iamvirul/vecgrep/security/advisories/new) or email the maintainer directly.
14
+
15
+ Include as much detail as possible:
16
+ - Description of the vulnerability
17
+ - Steps to reproduce
18
+ - Potential impact
19
+ - Suggested fix (if any)
20
+
21
+ You can expect a response within 48 hours. If the issue is confirmed, a patch will be released as quickly as possible.
@@ -0,0 +1,57 @@
1
+ [project]
2
+ name = "vecgrep"
3
+ version = "0.1.0"
4
+ description = "Cursor-style vector search MCP plugin for Claude Code"
5
+ readme = "README.md"
6
+ license = { text = "MIT" }
7
+ authors = [{ name = "iamvirul" }]
8
+ keywords = ["mcp", "semantic-search", "embeddings", "claude", "code-search"]
9
+ classifiers = [
10
+ "Development Status :: 4 - Beta",
11
+ "Intended Audience :: Developers",
12
+ "License :: OSI Approved :: MIT License",
13
+ "Programming Language :: Python :: 3.12",
14
+ "Topic :: Software Development :: Libraries :: Python Modules",
15
+ ]
16
+ requires-python = ">=3.12"
17
+ dependencies = [
18
+ "mcp[cli]>=1.0,<2.0",
19
+ "sentence-transformers>=3.0,<4.0",
20
+ "tree-sitter-languages>=1.10,<2.0",
21
+ "numpy>=1.26",
22
+ ]
23
+
24
+ [project.urls]
25
+ Homepage = "https://github.com/iamvirul/VecGrep"
26
+ Repository = "https://github.com/iamvirul/VecGrep"
27
+ Issues = "https://github.com/iamvirul/VecGrep/issues"
28
+
29
+ [project.scripts]
30
+ vecgrep = "vecgrep.server:main"
31
+
32
+ [project.optional-dependencies]
33
+ dev = [
34
+ "pytest>=8.0",
35
+ "pytest-cov>=5.0",
36
+ "ruff>=0.4.0",
37
+ "pyright>=1.1.360",
38
+ ]
39
+
40
+ [build-system]
41
+ requires = ["hatchling"]
42
+ build-backend = "hatchling.build"
43
+
44
+ [tool.hatch.build.targets.wheel]
45
+ packages = ["src/vecgrep"]
46
+
47
+ [tool.ruff]
48
+ line-length = 100
49
+ target-version = "py312"
50
+
51
+ [tool.ruff.lint]
52
+ select = ["E", "F", "W", "I", "UP"]
53
+
54
+ [tool.pyright]
55
+ pythonVersion = "3.12"
56
+ include = ["src"]
57
+ typeCheckingMode = "basic"
@@ -0,0 +1,3 @@
1
+ """VecGrep: Cursor-style vector search MCP plugin for Claude Code."""
2
+
3
+ __version__ = "0.1.0"