cocoindex-code 0.1.9__tar.gz → 0.1.11__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cocoindex-code
3
- Version: 0.1.9
3
+ Version: 0.1.11
4
4
  Summary: MCP server for indexing and querying codebases using CocoIndex
5
5
  Project-URL: Homepage, https://github.com/cocoindex-io/cocoindex-code
6
6
  Project-URL: Repository, https://github.com/cocoindex-io/cocoindex-code
@@ -17,7 +17,7 @@ Classifier: Programming Language :: Python :: 3.12
17
17
  Classifier: Programming Language :: Python :: 3.13
18
18
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
19
  Requires-Python: >=3.11
20
- Requires-Dist: cocoindex[litellm]==1.0.0a24
20
+ Requires-Dist: cocoindex[litellm]==1.0.0a26
21
21
  Requires-Dist: einops>=0.8.2
22
22
  Requires-Dist: mcp>=1.0.0
23
23
  Requires-Dist: numpy>=1.24.0
@@ -79,10 +79,15 @@ A super light-weight, effective embedded MCP **(AST-based)** that understand and
79
79
 
80
80
  ## Get Started - zero config, let's go!!
81
81
 
82
- Requires Python 3 (`pip3` comes pre-installed with Python).
82
+ Using [pipx](https://pipx.pypa.io/stable/installation/):
83
+ ```bash
84
+ pipx install cocoindex-code # first install
85
+ pipx upgrade cocoindex-code # upgrade
86
+ ```
83
87
 
88
+ Using [uv](https://docs.astral.sh/uv/getting-started/installation/):
84
89
  ```bash
85
- pip3 install -U cocoindex-code
90
+ uv tool install --upgrade cocoindex-code --prerelease explicit --with "cocoindex>=1.0.0a24"
86
91
  ```
87
92
 
88
93
  ### Claude
@@ -118,7 +123,17 @@ Or use opencode.json:
118
123
  }
119
124
  ```
120
125
 
121
- Optionally, you can run `cocoindex-code index` to create or update the index. Without running it, the MCP server will automatically build and keep the index up-to-date in the background.
126
+ ### Build the Index
127
+
128
+ For large codebases, we recommend running the indexer once before using the MCP so you can see the progress:
129
+
130
+ ```bash
131
+ cocoindex-code index
132
+ ```
133
+
134
+ This lets you monitor the indexing process and ensure everything is ready. After the initial build, the MCP server will automatically keep the index up-to-date in the background as files change.
135
+
136
+ For small projects you can skip this step — the MCP server will build the index automatically on first use.
122
137
 
123
138
  ## When Is the MCP Triggered?
124
139
 
@@ -293,7 +308,7 @@ claude mcp add cocoindex-code \
293
308
  -- cocoindex-code
294
309
  ```
295
310
 
296
- > **Note:** Switching models requires re-indexing your codebase (the vector dimensions differ).
311
+ **Note:** Switching models requires re-indexing your codebase (the vector dimensions differ).
297
312
 
298
313
  ## MCP Tools
299
314
 
@@ -377,10 +392,17 @@ Some Python installations (e.g. the one pre-installed on macOS) ship with a SQLi
377
392
  brew install python3
378
393
  ```
379
394
 
380
- Then re-install cocoindex-code with the Homebrew Python:
395
+ Then re-install cocoindex-code (see [Get Started](#get-started---zero-config-lets-go) for install options):
396
+
397
+ Using pipx:
398
+ ```bash
399
+ pipx install cocoindex-code # first install
400
+ pipx upgrade cocoindex-code # upgrade
401
+ ```
381
402
 
403
+ Using uv (install or upgrade):
382
404
  ```bash
383
- pip3 install -U cocoindex-code
405
+ uv tool install --upgrade cocoindex-code --prerelease explicit --with "cocoindex>=1.0.0a24"
384
406
  ```
385
407
 
386
408
  ## Large codebase / Enterprise
@@ -44,10 +44,15 @@ A super light-weight, effective embedded MCP **(AST-based)** that understand and
44
44
 
45
45
  ## Get Started - zero config, let's go!!
46
46
 
47
- Requires Python 3 (`pip3` comes pre-installed with Python).
47
+ Using [pipx](https://pipx.pypa.io/stable/installation/):
48
+ ```bash
49
+ pipx install cocoindex-code # first install
50
+ pipx upgrade cocoindex-code # upgrade
51
+ ```
48
52
 
53
+ Using [uv](https://docs.astral.sh/uv/getting-started/installation/):
49
54
  ```bash
50
- pip3 install -U cocoindex-code
55
+ uv tool install --upgrade cocoindex-code --prerelease explicit --with "cocoindex>=1.0.0a24"
51
56
  ```
52
57
 
53
58
  ### Claude
@@ -83,7 +88,17 @@ Or use opencode.json:
83
88
  }
84
89
  ```
85
90
 
86
- Optionally, you can run `cocoindex-code index` to create or update the index. Without running it, the MCP server will automatically build and keep the index up-to-date in the background.
91
+ ### Build the Index
92
+
93
+ For large codebases, we recommend running the indexer once before using the MCP so you can see the progress:
94
+
95
+ ```bash
96
+ cocoindex-code index
97
+ ```
98
+
99
+ This lets you monitor the indexing process and ensure everything is ready. After the initial build, the MCP server will automatically keep the index up-to-date in the background as files change.
100
+
101
+ For small projects you can skip this step — the MCP server will build the index automatically on first use.
87
102
 
88
103
  ## When Is the MCP Triggered?
89
104
 
@@ -258,7 +273,7 @@ claude mcp add cocoindex-code \
258
273
  -- cocoindex-code
259
274
  ```
260
275
 
261
- > **Note:** Switching models requires re-indexing your codebase (the vector dimensions differ).
276
+ **Note:** Switching models requires re-indexing your codebase (the vector dimensions differ).
262
277
 
263
278
  ## MCP Tools
264
279
 
@@ -342,10 +357,17 @@ Some Python installations (e.g. the one pre-installed on macOS) ship with a SQLi
342
357
  brew install python3
343
358
  ```
344
359
 
345
- Then re-install cocoindex-code with the Homebrew Python:
360
+ Then re-install cocoindex-code (see [Get Started](#get-started---zero-config-lets-go) for install options):
361
+
362
+ Using pipx:
363
+ ```bash
364
+ pipx install cocoindex-code # first install
365
+ pipx upgrade cocoindex-code # upgrade
366
+ ```
346
367
 
368
+ Using uv (install or upgrade):
347
369
  ```bash
348
- pip3 install -U cocoindex-code
370
+ uv tool install --upgrade cocoindex-code --prerelease explicit --with "cocoindex>=1.0.0a24"
349
371
  ```
350
372
 
351
373
  ## Large codebase / Enterprise
@@ -23,7 +23,7 @@ classifiers = [
23
23
 
24
24
  dependencies = [
25
25
  "mcp>=1.0.0",
26
- "cocoindex[litellm]==1.0.0a24",
26
+ "cocoindex[litellm]==1.0.0a26",
27
27
  "sentence-transformers>=2.2.0",
28
28
  "sqlite-vec>=0.1.0",
29
29
  "pydantic>=2.0.0",
@@ -0,0 +1,11 @@
1
+ """CocoIndex Code - MCP server for indexing and querying codebases."""
2
+
3
+ import logging
4
+
5
+ logging.basicConfig(level=logging.WARNING)
6
+
7
+ from .config import Config # noqa: E402
8
+ from .server import main, mcp # noqa: E402
9
+
10
+ __version__ = "0.1.0"
11
+ __all__ = ["Config", "main", "mcp"]
@@ -30,6 +30,9 @@ mcp = FastMCP(
30
30
  # Lock to prevent concurrent index updates
31
31
  _index_lock = asyncio.Lock()
32
32
 
33
+ # Event set once the initial background index is ready
34
+ _initial_index_done = asyncio.Event()
35
+
33
36
 
34
37
  async def _refresh_index() -> None:
35
38
  """Refresh the index. Uses lock to prevent concurrent updates."""
@@ -123,6 +126,16 @@ async def search(
123
126
  ),
124
127
  ) -> SearchResultModel:
125
128
  """Query the codebase index."""
129
+ if not _initial_index_done.is_set():
130
+ return SearchResultModel(
131
+ success=False,
132
+ message=(
133
+ "The index is still being built — this may take a while"
134
+ " for a large codebase or after significant changes."
135
+ " Please try again shortly."
136
+ ),
137
+ )
138
+
126
139
  try:
127
140
  # Refresh index if requested
128
141
  if refresh_index:
@@ -167,8 +180,15 @@ async def search(
167
180
 
168
181
  async def _async_serve() -> None:
169
182
  """Async entry point for the MCP server."""
183
+
170
184
  # Refresh index in background so startup isn't blocked
171
- asyncio.create_task(_refresh_index())
185
+ async def _initial_index() -> None:
186
+ try:
187
+ await _refresh_index()
188
+ finally:
189
+ _initial_index_done.set()
190
+
191
+ asyncio.create_task(_initial_index())
172
192
  await mcp.run_stdio_async()
173
193
 
174
194
 
@@ -1,7 +0,0 @@
1
- """CocoIndex Code - MCP server for indexing and querying codebases."""
2
-
3
- from .config import Config
4
- from .server import main, mcp
5
-
6
- __version__ = "0.1.0"
7
- __all__ = ["Config", "main", "mcp"]
File without changes