codeembed 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.
Files changed (58) hide show
  1. codeembed-0.1.0/.claude/settings.local.json +6 -0
  2. codeembed-0.1.0/.github/workflows/ci.yml +24 -0
  3. codeembed-0.1.0/.github/workflows/release.yml +29 -0
  4. codeembed-0.1.0/.gitignore +212 -0
  5. codeembed-0.1.0/.mcp.json +8 -0
  6. codeembed-0.1.0/.pre-commit-config.yaml +10 -0
  7. codeembed-0.1.0/.python-version +1 -0
  8. codeembed-0.1.0/.vscode/mcp.json +8 -0
  9. codeembed-0.1.0/AGENTS.md +18 -0
  10. codeembed-0.1.0/CHANGELOG.md +7 -0
  11. codeembed-0.1.0/LICENSE +21 -0
  12. codeembed-0.1.0/PKG-INFO +292 -0
  13. codeembed-0.1.0/README.md +241 -0
  14. codeembed-0.1.0/codeembed.toml +5 -0
  15. codeembed-0.1.0/pyproject.toml +74 -0
  16. codeembed-0.1.0/scripts/generate_init_files.py +69 -0
  17. codeembed-0.1.0/src/codeembed/__init__.py +59 -0
  18. codeembed-0.1.0/src/codeembed/bootstrap/__init__.py +17 -0
  19. codeembed-0.1.0/src/codeembed/bootstrap/services.py +220 -0
  20. codeembed-0.1.0/src/codeembed/cli.py +454 -0
  21. codeembed-0.1.0/src/codeembed/config/__init__.py +5 -0
  22. codeembed-0.1.0/src/codeembed/config/models.py +13 -0
  23. codeembed-0.1.0/src/codeembed/cost_tracking/__init__.py +7 -0
  24. codeembed-0.1.0/src/codeembed/cost_tracking/llm_wrapper.py +39 -0
  25. codeembed-0.1.0/src/codeembed/cost_tracking/models.py +52 -0
  26. codeembed-0.1.0/src/codeembed/delta_computer/__init__.py +5 -0
  27. codeembed-0.1.0/src/codeembed/delta_computer/delta_computer.py +75 -0
  28. codeembed-0.1.0/src/codeembed/doc_embedder/__init__.py +5 -0
  29. codeembed-0.1.0/src/codeembed/doc_embedder/doc_embedder.py +134 -0
  30. codeembed-0.1.0/src/codeembed/doc_provider/__init__.py +10 -0
  31. codeembed-0.1.0/src/codeembed/doc_provider/base.py +14 -0
  32. codeembed-0.1.0/src/codeembed/doc_provider/local_doc_provider.py +58 -0
  33. codeembed-0.1.0/src/codeembed/doc_provider/models.py +20 -0
  34. codeembed-0.1.0/src/codeembed/doc_search_service/__init__.py +5 -0
  35. codeembed-0.1.0/src/codeembed/doc_search_service/doc_search_service.py +48 -0
  36. codeembed-0.1.0/src/codeembed/doc_splitters/__init__.py +8 -0
  37. codeembed-0.1.0/src/codeembed/doc_splitters/generic_splitter.py +165 -0
  38. codeembed-0.1.0/src/codeembed/doc_splitters/models.py +14 -0
  39. codeembed-0.1.0/src/codeembed/llm/__init__.py +13 -0
  40. codeembed-0.1.0/src/codeembed/llm/base.py +31 -0
  41. codeembed-0.1.0/src/codeembed/llm/models.py +27 -0
  42. codeembed-0.1.0/src/codeembed/llm/ollama_adapter.py +64 -0
  43. codeembed-0.1.0/src/codeembed/llm/openai_adapter.py +96 -0
  44. codeembed-0.1.0/src/codeembed/mcp_server.py +45 -0
  45. codeembed-0.1.0/src/codeembed/setup_logger.py +34 -0
  46. codeembed-0.1.0/src/codeembed/utils/__init__.py +9 -0
  47. codeembed-0.1.0/src/codeembed/utils/checksum_utils.py +5 -0
  48. codeembed-0.1.0/src/codeembed/utils/string_utils.py +5 -0
  49. codeembed-0.1.0/src/codeembed/utils/time_utils.py +5 -0
  50. codeembed-0.1.0/src/codeembed/vector_db/__init__.py +9 -0
  51. codeembed-0.1.0/src/codeembed/vector_db/base.py +27 -0
  52. codeembed-0.1.0/src/codeembed/vector_db/chromadb_adapter.py +130 -0
  53. codeembed-0.1.0/src/codeembed/vector_db/models.py +16 -0
  54. codeembed-0.1.0/tests/test_cost_tracking.py +105 -0
  55. codeembed-0.1.0/tests/test_delta_computer.py +119 -0
  56. codeembed-0.1.0/tests/test_openai_adapter.py +85 -0
  57. codeembed-0.1.0/tests/test_splitter.py +283 -0
  58. codeembed-0.1.0/uv.lock +3196 -0
@@ -0,0 +1,6 @@
1
+ {
2
+ "enabledMcpjsonServers": ["codeembed"],
3
+ "permissions": {
4
+ "allow": ["mcp__codeembed__search"]
5
+ }
6
+ }
@@ -0,0 +1,24 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ branches: [main]
6
+
7
+ jobs:
8
+ lint:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
12
+ - uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
13
+ - run: uvx ruff check .
14
+ - run: uvx ruff format --check .
15
+
16
+ test:
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
20
+ - uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
21
+ - run: uv sync
22
+ - run: uv pip check
23
+ - run: uv run pip-audit
24
+ - run: uv run pytest
@@ -0,0 +1,29 @@
1
+ name: Release to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ permissions:
9
+ contents: read
10
+ id-token: write
11
+
12
+ jobs:
13
+ publish:
14
+ runs-on: ubuntu-latest
15
+ environment: pypi
16
+
17
+ steps:
18
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
19
+
20
+ - uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
21
+
22
+ - name: Build
23
+ run: uv build
24
+
25
+ - name: Validate
26
+ run: uvx twine check dist/*
27
+
28
+ - name: Publish
29
+ run: uv publish --trusted-publishing always
@@ -0,0 +1,212 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+ #poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ #pdm.lock
116
+ #pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ #pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # SageMath parsed files
135
+ *.sage.py
136
+
137
+ # Environments
138
+ .env
139
+ .envrc
140
+ .venv
141
+ env/
142
+ venv/
143
+ ENV/
144
+ env.bak/
145
+ venv.bak/
146
+
147
+ # Spyder project settings
148
+ .spyderproject
149
+ .spyproject
150
+
151
+ # Rope project settings
152
+ .ropeproject
153
+
154
+ # mkdocs documentation
155
+ /site
156
+
157
+ # mypy
158
+ .mypy_cache/
159
+ .dmypy.json
160
+ dmypy.json
161
+
162
+ # Pyre type checker
163
+ .pyre/
164
+
165
+ # pytype static type analyzer
166
+ .pytype/
167
+
168
+ # Cython debug symbols
169
+ cython_debug/
170
+
171
+ # PyCharm
172
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
173
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
174
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
175
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
176
+ #.idea/
177
+
178
+ # Abstra
179
+ # Abstra is an AI-powered process automation framework.
180
+ # Ignore directories containing user credentials, local state, and settings.
181
+ # Learn more at https://abstra.io/docs
182
+ .abstra/
183
+
184
+ # Visual Studio Code
185
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
188
+ # you could uncomment the following to ignore the entire vscode folder
189
+ # .vscode/
190
+
191
+ # Ruff stuff:
192
+ .ruff_cache/
193
+
194
+ # PyPI configuration file
195
+ .pypirc
196
+
197
+ # Cursor
198
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
199
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
200
+ # refer to https://docs.cursor.com/context/ignore-files
201
+ .cursorignore
202
+ .cursorindexingignore
203
+
204
+ # Marimo
205
+ marimo/_static/
206
+ marimo/_lsp/
207
+ __marimo__/
208
+
209
+ # App
210
+ .codeembed/
211
+
212
+ temp/
@@ -0,0 +1,8 @@
1
+ {
2
+ "mcpServers": {
3
+ "codeembed": {
4
+ "command": "uv",
5
+ "args": ["run", "codeembed", "serve"]
6
+ }
7
+ }
8
+ }
@@ -0,0 +1,10 @@
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ # Ruff version.
4
+ rev: v0.15.12
5
+ hooks:
6
+ # Run the linter.
7
+ - id: ruff-check
8
+ args: [--fix]
9
+ # Run the formatter.
10
+ - id: ruff-format
@@ -0,0 +1 @@
1
+ 3.14
@@ -0,0 +1,8 @@
1
+ {
2
+ "servers": {
3
+ "codeembed": {
4
+ "command": "uv",
5
+ "args": ["run", "codeembed", "serve"]
6
+ }
7
+ }
8
+ }
@@ -0,0 +1,18 @@
1
+ # Agent Instructions
2
+
3
+ ## Python Coding Standards
4
+
5
+ - Use `Union` (from `typing`) instead of `|`.
6
+ - Use `Optional[<type>]` instead of `<type> | None`.
7
+ - Strictly use type hints for all functions and methods.
8
+ - Run tests with `uv run --no-sync pytest` (`--no-sync` flag is important).
9
+
10
+ ## General
11
+
12
+ When asked for a PR review, do a simple git diff against the main branch.
13
+ Do not read PRs from GitHub.
14
+ Do not use PR skill.
15
+
16
+ ## Codebase search
17
+
18
+ Use the `mcp__codeembed__search` tool as the first step for any question about how this codebase works — how something is implemented, where something is defined, what calls what. Prefer it over grep or file reads for exploratory questions.
@@ -0,0 +1,7 @@
1
+ # Changelog
2
+
3
+ ## Unreleased
4
+
5
+ ## 0.1.0
6
+
7
+ Initial version.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 robino16/robinoms
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.
@@ -0,0 +1,292 @@
1
+ Metadata-Version: 2.4
2
+ Name: codeembed
3
+ Version: 0.1.0
4
+ Summary: Embeds your codebase and makes it available for quick LLM lookups via MCP.
5
+ Project-URL: Homepage, https://github.com/robino16/codeembed
6
+ Project-URL: Repository, https://github.com/robino16/codeembed
7
+ Project-URL: Issues, https://github.com/robino16/codeembed/issues
8
+ Author-email: robino16 <robinoms.dev@proton.me>
9
+ License: MIT License
10
+
11
+ Copyright (c) 2026 robino16/robinoms
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ of this software and associated documentation files (the "Software"), to deal
15
+ in the Software without restriction, including without limitation the rights
16
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ copies of the Software, and to permit persons to whom the Software is
18
+ furnished to do so, subject to the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be included in all
21
+ copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ SOFTWARE.
30
+ License-File: LICENSE
31
+ Keywords: codebase,embeddings,llm,mcp,rag,vector-search
32
+ Classifier: Development Status :: 4 - Beta
33
+ Classifier: Intended Audience :: Developers
34
+ Classifier: License :: OSI Approved :: MIT License
35
+ Classifier: Programming Language :: Python :: 3
36
+ Classifier: Programming Language :: Python :: 3.11
37
+ Classifier: Programming Language :: Python :: 3.12
38
+ Classifier: Programming Language :: Python :: 3.13
39
+ Classifier: Programming Language :: Python :: 3.14
40
+ Requires-Python: >=3.11
41
+ Requires-Dist: chromadb<2,>=1.5
42
+ Requires-Dist: mcp<2,>=1.26
43
+ Requires-Dist: ollama<1,>=0.6
44
+ Requires-Dist: pydantic<3,>=2.13
45
+ Requires-Dist: python-dotenv<2,>=1.2.2
46
+ Requires-Dist: tiktoken<1,>=0.12
47
+ Provides-Extra: openai
48
+ Requires-Dist: azure-identity<2,>=1.25; extra == 'openai'
49
+ Requires-Dist: openai<3,>=2.33; extra == 'openai'
50
+ Description-Content-Type: text/markdown
51
+
52
+ # CodeEmbed
53
+
54
+ Embeds your codebase into a local vector database and exposes it as an MCP tool, giving AI assistants like Claude Code fast semantic search over your code.
55
+
56
+ Particularly useful for questions like:
57
+
58
+ - How is X implemented in this repo?
59
+ - Where is X defined or used?
60
+ - Does this repo already have X?
61
+
62
+ For other questions, the agent will fall back to normal lookups.
63
+ CodeEmbed can improve lookup speed and accuracy, especially for finding existing implementations before writing new ones.
64
+ Note that the biggest bottleneck in coding agents is LLM thinking and token generation — solid prompts and follow-up questions still matter.
65
+
66
+ Uses [ChromaDB](https://github.com/chroma-core/chroma) for local vector storage and either [Ollama](https://github.com/ollama/ollama) or OpenAI (including OpenAI models via Azure AI Foundry) for LLM analysis.
67
+
68
+ ## Prerequisites
69
+
70
+ - [Python](https://python.org) 3.11+
71
+ - [uv](https://github.com/astral-sh/uv)
72
+ - One of:
73
+ - [Ollama](https://ollama.com) running locally, **or**
74
+ - An OpenAI API key or Azure OpenAI endpoint
75
+
76
+ ## Installation
77
+
78
+ **With Ollama:**
79
+
80
+ ```bash
81
+ uv tool install codeembed
82
+ ```
83
+
84
+ **With OpenAI / Azure OpenAI:**
85
+
86
+ ```bash
87
+ uv tool install 'codeembed[openai]'
88
+ ```
89
+
90
+ > **Supply chain safety:** To reduce the risk of newly-published malicious packages, consider adding `exclude-newer = "7 days"` to your global [`uv.toml`](https://docs.astral.sh/uv/reference/settings/#exclude-newer). This prevents `uv` from installing packages published in the last 7 days.
91
+
92
+ ### Manual installation (from source)
93
+
94
+ If CodeEmbed is not published to PyPI, install it directly from source:
95
+
96
+ ```bash
97
+ git clone https://github.com/robino16/codeembed
98
+ cd codeembed
99
+
100
+ # With Ollama
101
+ uv tool install .
102
+
103
+ # With OpenAI support
104
+ uv tool install '.[openai]'
105
+ ```
106
+
107
+ Then run `codeembed init` inside of your target repository.
108
+
109
+ ## Upgrading
110
+
111
+ ```bash
112
+ uv tool upgrade codeembed
113
+ ```
114
+
115
+ ## Usage
116
+
117
+ CodeEmbed is intended to be used within a single project — run all commands from your project root. Each project gets its own local vector database stored in `.codeembed/`.
118
+
119
+ Supported file types: `.py`, `.md`, `.ts`, `.tsx`, `.js`, `.jsx`.
120
+
121
+ **1. Initialize** (run once in your project root):
122
+
123
+ ```bash
124
+ codeembed init
125
+ ```
126
+
127
+ Creates a `codeembed.toml` config and configures your `.gitignore`. You'll be prompted to select a provider (Ollama or OpenAI) and a model. You'll also be offered the option to automatically configure Claude Code and/or GitHub Copilot.
128
+
129
+ **2. Pre-populate the index:**
130
+
131
+ ```bash
132
+ codeembed embed
133
+ ```
134
+
135
+ Run this before starting the server to pre-populate the index. Searches will return empty results until the first file has been embedded.
136
+
137
+ CodeEmbed respects your project's `.gitignore` and also excludes typical environment directories and files (`.env`, `venv`, `node_modules`, etc.) by default.
138
+
139
+ **3. Start the MCP server:**
140
+
141
+ ```bash
142
+ codeembed serve
143
+ ```
144
+
145
+ Starts the MCP server.
146
+ If the MCP server is added to Claude or GitHub Copilot, you do not need to do this.
147
+
148
+ The `serve` command will embed your codebase in the background - by default it will scan for changes every 60 seconds.
149
+
150
+ ## Configuring OpenAI
151
+
152
+ If you use the OpenAI provider, credentials are read from environment variables. The recommended approach is a `.env` file. `codeembed init` will ask for the path, and it will be stored in `codeembed.toml` so `codeembed serve` and `codeembed embed` loads the `.env` file automatically.
153
+
154
+ ### Standard OpenAI
155
+
156
+ ```env
157
+ OPENAI_API_KEY=...
158
+ ```
159
+
160
+ Optionally override the endpoint (for compatible APIs like vLLM, LM Studio, OpenRouter):
161
+
162
+ ```env
163
+ OPENAI_API_KEY=...
164
+ OPENAI_BASE_URL=...
165
+ ```
166
+
167
+ ### Azure OpenAI — API key
168
+
169
+ ```env
170
+ AZURE_OPENAI_ENDPOINT=https://<your-resource>.openai.azure.com/openai/v1/
171
+ AZURE_OPENAI_API_KEY=...
172
+ ```
173
+
174
+ ### Azure OpenAI — RBAC / Entra ID (keyless)
175
+
176
+ Set only the endpoint; CodeEmbed will use `DefaultAzureCredential`, which automatically tries multiple credential sources in order — service principals (via env vars), workload identity, managed identity, VS Code Azure sign-in, `az login`, Azure PowerShell, and `azd auth login` — falling back to an interactive browser window if none are found automatically:
177
+
178
+ ```env
179
+ AZURE_OPENAI_ENDPOINT=https://<your-resource>.openai.azure.com/openai/v1/
180
+ ```
181
+
182
+ ## Add to Claude Code or GitHub Copilot
183
+
184
+ `codeembed init` will offer to configure these automatically. If you prefer to do it manually:
185
+
186
+ **Claude Code** — add to `.mcp.json` in your project root:
187
+
188
+ ```json
189
+ {
190
+ "mcpServers": {
191
+ "codeembed": {
192
+ "command": "codeembed",
193
+ "args": ["serve"]
194
+ }
195
+ }
196
+ }
197
+ ```
198
+
199
+ And add to `.claude/settings.local.json` to enable and pre-approve the tool:
200
+
201
+ ```json
202
+ {
203
+ "enabledMcpjsonServers": ["codeembed"],
204
+ "permissions": {
205
+ "allow": ["mcp__codeembed__search"]
206
+ }
207
+ }
208
+ ```
209
+
210
+ **GitHub Copilot** — add to `.vscode/mcp.json`:
211
+
212
+ ```json
213
+ {
214
+ "servers": {
215
+ "codeembed": {
216
+ "command": "codeembed",
217
+ "args": ["serve"]
218
+ }
219
+ }
220
+ }
221
+ ```
222
+
223
+ The MCP server exposes a single `search(query)` tool for semantic search over your codebase.
224
+
225
+ ## Contributing
226
+
227
+ Clone this repo with:
228
+
229
+ ```bash
230
+ git clone git@github.com:robino16/codeembed.git
231
+ ```
232
+
233
+ ```bash
234
+ cd codeembed
235
+ uv sync
236
+ ```
237
+
238
+ Check for dependency conflicts with:
239
+
240
+ ```bash
241
+ uv pip check
242
+ ```
243
+
244
+ Check for package vulnerabilities with:
245
+
246
+ ```bash
247
+ uv run pip-audit
248
+ ```
249
+
250
+ (Optional) Add Ruff pre-commit with:
251
+
252
+ ```bash
253
+ pre-commit install
254
+ ```
255
+
256
+ Update init files:
257
+
258
+ ```bash
259
+ uv run --no-sync scripts/generate_init_files.py
260
+ ```
261
+
262
+ Run linter:
263
+
264
+ ```bash
265
+ ruff check . --fix
266
+ ```
267
+
268
+ Run formatter:
269
+
270
+ ```bash
271
+ ruff format .
272
+ ```
273
+
274
+ Run tests:
275
+
276
+ ```bash
277
+ uv run --no-sync pytest
278
+ ```
279
+
280
+ Build with:
281
+
282
+ ```bash
283
+ uv build
284
+ ```
285
+
286
+ Validate build with:
287
+
288
+ ```bash
289
+ uv run twine check dist/*
290
+ ```
291
+
292
+ > `--no-sync` is required for local dev commands when the MCP server is running, as uv holds a lock that blocks sync operations.