revit-api-docs 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 (60) hide show
  1. revit_api_docs-0.1.0/.gitignore +21 -0
  2. revit_api_docs-0.1.0/CHANGELOG.md +32 -0
  3. revit_api_docs-0.1.0/LICENSE +21 -0
  4. revit_api_docs-0.1.0/PKG-INFO +139 -0
  5. revit_api_docs-0.1.0/README.md +105 -0
  6. revit_api_docs-0.1.0/pipeline/__init__.py +0 -0
  7. revit_api_docs-0.1.0/pipeline/api_parser/__init__.py +0 -0
  8. revit_api_docs-0.1.0/pipeline/api_parser/parse_chm.py +503 -0
  9. revit_api_docs-0.1.0/pipeline/api_parser/quality_agent.py +663 -0
  10. revit_api_docs-0.1.0/pipeline/demo_dual_store.py +122 -0
  11. revit_api_docs-0.1.0/pipeline/demo_production_real.py +336 -0
  12. revit_api_docs-0.1.0/pipeline/demo_real_golden.py +138 -0
  13. revit_api_docs-0.1.0/pipeline/demo_real_scoring.py +123 -0
  14. revit_api_docs-0.1.0/pipeline/demo_scoring.py +263 -0
  15. revit_api_docs-0.1.0/pipeline/demo_sdk_cleaning.py +274 -0
  16. revit_api_docs-0.1.0/pipeline/embedder/__init__.py +0 -0
  17. revit_api_docs-0.1.0/pipeline/embedder/embed.py +244 -0
  18. revit_api_docs-0.1.0/pipeline/knowledge_builder/__init__.py +0 -0
  19. revit_api_docs-0.1.0/pipeline/run_all.ipynb +2765 -0
  20. revit_api_docs-0.1.0/pipeline/sdk_parser/__init__.py +0 -0
  21. revit_api_docs-0.1.0/pipeline/sdk_parser/extract.py +715 -0
  22. revit_api_docs-0.1.0/pipeline/sdk_parser/quality_agent.py +443 -0
  23. revit_api_docs-0.1.0/pyproject.toml +73 -0
  24. revit_api_docs-0.1.0/revit_api_docs/__init__.py +18 -0
  25. revit_api_docs-0.1.0/revit_api_docs/__main__.py +8 -0
  26. revit_api_docs-0.1.0/revit_api_docs/config.py +115 -0
  27. revit_api_docs-0.1.0/revit_api_docs/data.py +320 -0
  28. revit_api_docs-0.1.0/revit_api_docs/default_config.yaml +85 -0
  29. revit_api_docs-0.1.0/revit_api_docs/embedder/__init__.py +1 -0
  30. revit_api_docs-0.1.0/revit_api_docs/embedder/providers/__init__.py +25 -0
  31. revit_api_docs-0.1.0/revit_api_docs/embedder/providers/base.py +28 -0
  32. revit_api_docs-0.1.0/revit_api_docs/embedder/providers/google.py +36 -0
  33. revit_api_docs-0.1.0/revit_api_docs/embedder/providers/openai.py +58 -0
  34. revit_api_docs-0.1.0/revit_api_docs/llm_client.py +288 -0
  35. revit_api_docs-0.1.0/revit_api_docs/prompts/__init__.py +5 -0
  36. revit_api_docs-0.1.0/revit_api_docs/prompts/loader.py +20 -0
  37. revit_api_docs-0.1.0/revit_api_docs/prompts/pipeline.api_quality_stage1_no_html.md +28 -0
  38. revit_api_docs-0.1.0/revit_api_docs/prompts/pipeline.api_quality_stage1_system.md +1 -0
  39. revit_api_docs-0.1.0/revit_api_docs/prompts/pipeline.api_quality_stage1_with_html.md +35 -0
  40. revit_api_docs-0.1.0/revit_api_docs/prompts/pipeline.api_quality_stage2.md +33 -0
  41. revit_api_docs-0.1.0/revit_api_docs/prompts/pipeline.api_quality_stage2_system.md +1 -0
  42. revit_api_docs-0.1.0/revit_api_docs/prompts/pipeline.rewrite_query.md +21 -0
  43. revit_api_docs-0.1.0/revit_api_docs/prompts/pipeline.rewrite_query_system.md +1 -0
  44. revit_api_docs-0.1.0/revit_api_docs/prompts/pipeline.sdk_extract_readme_system.md +1 -0
  45. revit_api_docs-0.1.0/revit_api_docs/prompts/pipeline.sdk_extract_readme_user.md +22 -0
  46. revit_api_docs-0.1.0/revit_api_docs/prompts/pipeline.sdk_golden_code.md +32 -0
  47. revit_api_docs-0.1.0/revit_api_docs/prompts/pipeline.sdk_golden_code_system.md +1 -0
  48. revit_api_docs-0.1.0/revit_api_docs/prompts/pipeline.sdk_quality_file_batch.md +17 -0
  49. revit_api_docs-0.1.0/revit_api_docs/prompts/pipeline.sdk_quality_file_system.md +1 -0
  50. revit_api_docs-0.1.0/revit_api_docs/prompts/pipeline.sdk_quality_project.md +20 -0
  51. revit_api_docs-0.1.0/revit_api_docs/prompts/pipeline.sdk_quality_project_system.md +1 -0
  52. revit_api_docs-0.1.0/revit_api_docs/reranker.py +177 -0
  53. revit_api_docs-0.1.0/revit_api_docs/retriever.py +901 -0
  54. revit_api_docs-0.1.0/revit_api_docs/server.py +244 -0
  55. revit_api_docs-0.1.0/tests/conftest.py +75 -0
  56. revit_api_docs-0.1.0/tests/test_data.py +208 -0
  57. revit_api_docs-0.1.0/tests/test_package.py +63 -0
  58. revit_api_docs-0.1.0/tests/test_retriever.py +294 -0
  59. revit_api_docs-0.1.0/tests/test_server.py +151 -0
  60. revit_api_docs-0.1.0/tests/test_shipped_db.py +75 -0
@@ -0,0 +1,21 @@
1
+ # Secrets never enter this repository
2
+ .env*
3
+ !.env.example
4
+ .secrets/
5
+ *.token
6
+
7
+ # Python
8
+ __pycache__/
9
+ *.pyc
10
+ .venv/
11
+ dist/
12
+ build/
13
+ *.egg-info/
14
+ .pytest_cache/
15
+
16
+ # Local data set copies and pipeline output (the data set ships as a GitHub Release)
17
+ data/
18
+ out/
19
+
20
+ # Local Claude Code state
21
+ .claude/settings.local.json
@@ -0,0 +1,32 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions follow
5
+ [Semantic Versioning](https://semver.org/).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.1.0] - 2026-09-20
10
+
11
+ First release, split out of the `revit-api-rag` repository (working-tree copy,
12
+ no git history).
13
+
14
+ ### Added
15
+
16
+ - MCP server `revit-api-docs` (stdio) with two read-only tools:
17
+ `search_revit_api(query, top_k)` and `get_code_examples(query, top_k)`.
18
+ - Data set as GitHub Release `v1.0-data` (Revit 2026 API reference SQLite,
19
+ SDK samples SQLite, two ChromaDB indexes); downloaded on first run into the
20
+ per-user data directory, SHA-256 verified, resumable. `REVIT_API_DOCS_DATA_DIR`
21
+ overrides the location; `revit-api-docs download` prefetches.
22
+ - Keyword search over SQLite works with no API key; an OpenAI-compatible
23
+ embedding key adds vector search, `COHERE_API_KEY` adds reranking. Embedding
24
+ or rerank failures fall back to keyword search instead of erroring.
25
+ - CLI: `serve` (default), `download`, `search <query> [--examples] [--top-k]`.
26
+ - Offline data pipeline (`pipeline/`, `uv sync --extra pipeline`) from the old
27
+ repository, importing the package's shared retriever, LLM client and prompts.
28
+ - CI (tests + build on Linux/Windows, Python 3.11/3.13) and PyPI Trusted
29
+ Publishing on version tags.
30
+
31
+ [Unreleased]: https://github.com/revitbridge/revit-api-docs/compare/v0.1.0...HEAD
32
+ [0.1.0]: https://github.com/revitbridge/revit-api-docs/releases/tag/v0.1.0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 revitbridge
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,139 @@
1
+ Metadata-Version: 2.5
2
+ Name: revit-api-docs
3
+ Version: 0.1.0
4
+ Summary: Revit API reference search for MCP hosts: local semantic + keyword lookup over the Revit 2026 API docs and SDK samples
5
+ Project-URL: Homepage, https://github.com/revitbridge/revit-api-docs
6
+ Project-URL: Issues, https://github.com/revitbridge/revit-api-docs/issues
7
+ Project-URL: Changelog, https://github.com/revitbridge/revit-api-docs/blob/main/CHANGELOG.md
8
+ Project-URL: Data, https://github.com/revitbridge/revit-api-docs/releases/tag/v1.0-data
9
+ Author: revitbridge
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: api-docs,bim,mcp,rag,revit
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Scientific/Engineering
21
+ Requires-Python: >=3.11
22
+ Requires-Dist: chromadb<2,>=1
23
+ Requires-Dist: httpx>=0.27
24
+ Requires-Dist: mcp<3,>=2
25
+ Requires-Dist: openai<3,>=1
26
+ Requires-Dist: pyyaml>=6
27
+ Provides-Extra: pipeline
28
+ Requires-Dist: beautifulsoup4>=4.12; extra == 'pipeline'
29
+ Requires-Dist: google-genai>=1; extra == 'pipeline'
30
+ Requires-Dist: tqdm>=4.66; extra == 'pipeline'
31
+ Requires-Dist: tree-sitter-c-sharp>=0.20; extra == 'pipeline'
32
+ Requires-Dist: tree-sitter>=0.20; extra == 'pipeline'
33
+ Description-Content-Type: text/markdown
34
+
35
+ # revit-api-docs
36
+
37
+ Revit API reference search as an MCP server: two read-only tools over a local
38
+ copy of the Revit 2026 API documentation (27,596 classes, methods, properties
39
+ and enums) and the official SDK samples (153 projects).
40
+
41
+ **Optional.** It exists for models that do not know the Revit API well. If
42
+ your model already writes correct Revit code, you do not need it;
43
+ [revit-bridge](https://github.com/revitbridge/revit-bridge) works without it.
44
+ It never talks to Revit and it never calls a model itself.
45
+
46
+ ## Install
47
+
48
+ Prerequisites: Python 3.11+ with [`uv`](https://docs.astral.sh/uv/) (for
49
+ `uvx`), about 700 MB of disk for the data set, network for the first run.
50
+
51
+ **Claude Desktop** — `claude_desktop_config.json`:
52
+
53
+ ```json
54
+ {
55
+ "mcpServers": {
56
+ "revit-api-docs": {
57
+ "command": "uvx",
58
+ "args": ["revit-api-docs"]
59
+ }
60
+ }
61
+ }
62
+ ```
63
+
64
+ **Claude Code**:
65
+
66
+ ```bash
67
+ claude mcp add revit-api-docs -- uvx revit-api-docs
68
+ ```
69
+
70
+ **Any MCP client** — run `uvx revit-api-docs` as a stdio server.
71
+
72
+ On the first start the server downloads the data set (335 MB, four files) from
73
+ this repository's [`v1.0-data` release](https://github.com/revitbridge/revit-api-docs/releases/tag/v1.0-data)
74
+ into `%LOCALAPPDATA%\revit-api-docs` (Windows) or `~/.local/share/revit-api-docs`
75
+ (Linux; `~/Library/Application Support/revit-api-docs` on macOS), verifies each
76
+ file's SHA-256 and unpacks the vector stores. Tool calls made while that runs
77
+ return a short progress message instead of results. To do it ahead of time:
78
+
79
+ ```bash
80
+ uvx revit-api-docs download
81
+ ```
82
+
83
+ From a checkout: `uv sync` then `uv run revit-api-docs`.
84
+
85
+ ## Use
86
+
87
+ Two tools, both read-only:
88
+
89
+ - `search_revit_api(query, top_k=10)` — API entries with signature, parameters
90
+ and remarks. Query with an API name (`Wall.Create`,
91
+ `FilteredElementCollector OfCategory`) or a short task (`create floor from
92
+ boundary`).
93
+ - `get_code_examples(query, top_k=3)` — C# from the SDK samples that use the
94
+ matching APIs, with the project name and the APIs each sample touches.
95
+
96
+ Without any API key the server answers from keyword search over the SQLite
97
+ reference (exact and partial name matches, which is what a model usually
98
+ asks for once it knows roughly what it wants). With an embedding key it adds
99
+ semantic search over the vector store, and with a Cohere key it reranks the
100
+ merged candidates. See Configure.
101
+
102
+ Try it from a terminal (installs the data set if needed):
103
+
104
+ ```bash
105
+ uvx revit-api-docs search "Wall.Create"
106
+ uvx revit-api-docs search "rotate element around axis" --examples
107
+ ```
108
+
109
+ ## Configure
110
+
111
+ All settings are environment variables; there is no config file to edit.
112
+
113
+ | Variable | Default | Meaning |
114
+ |---|---|---|
115
+ | `REVIT_API_DOCS_DATA_DIR` | `%LOCALAPPDATA%\revit-api-docs` (Windows), `~/.local/share/revit-api-docs` (Linux), `~/Library/Application Support/revit-api-docs` (macOS) | Where the data set lives. An existing tree with `sqlite/` and `chromadb/` from the old `revit-api-rag` checkout works as is |
116
+ | `REVIT_API_DOCS_EMBEDDING_API_KEY` | *(unset)* | Key for the embedding endpoint; turns on semantic (vector) search. `OPENROUTER_API_KEY` is used when this is unset |
117
+ | `REVIT_API_DOCS_EMBEDDING_BASE_URL` | `https://openrouter.ai/api/v1` | Any OpenAI-compatible `/embeddings` endpoint |
118
+ | `REVIT_API_DOCS_EMBEDDING_MODEL` | `openai/text-embedding-3-large` | Must produce the same 3072-dimensional space the shipped vectors were built with (`text-embedding-3-large`); another model makes vector search return noise |
119
+ | `COHERE_API_KEY` | *(unset)* | Enables reranking with Cohere `rerank-v3.5` (native REST API) |
120
+ | `REVIT_API_DOCS_RELEASE_URL` | this repository's `v1.0-data` release | Mirror for the data files; the SHA-256 checks still apply |
121
+ | `HTTPS_PROXY` / `HTTP_PROXY` | *(unset)* | Proxy for the embedding and rerank calls |
122
+
123
+ Pass them through the `env` block of your MCP host's server entry.
124
+
125
+ Data set: the SQLite databases and ChromaDB indexes were built from the Revit
126
+ 2026 API CHM and the Revit 2026 SDK samples with the pipeline in `pipeline/`
127
+ (`uv sync --extra pipeline`; needs the CHM, the SDK and OpenRouter/Cohere keys
128
+ in the environment). The server does not need any of that.
129
+
130
+ Development:
131
+
132
+ ```bash
133
+ uv sync
134
+ uv run pytest
135
+ uv build
136
+ uvx --from . revit-api-docs search "Wall.Create"
137
+ ```
138
+
139
+ License: MIT. Issues and discussion: <https://github.com/revitbridge/revit-api-docs/issues>.
@@ -0,0 +1,105 @@
1
+ # revit-api-docs
2
+
3
+ Revit API reference search as an MCP server: two read-only tools over a local
4
+ copy of the Revit 2026 API documentation (27,596 classes, methods, properties
5
+ and enums) and the official SDK samples (153 projects).
6
+
7
+ **Optional.** It exists for models that do not know the Revit API well. If
8
+ your model already writes correct Revit code, you do not need it;
9
+ [revit-bridge](https://github.com/revitbridge/revit-bridge) works without it.
10
+ It never talks to Revit and it never calls a model itself.
11
+
12
+ ## Install
13
+
14
+ Prerequisites: Python 3.11+ with [`uv`](https://docs.astral.sh/uv/) (for
15
+ `uvx`), about 700 MB of disk for the data set, network for the first run.
16
+
17
+ **Claude Desktop** — `claude_desktop_config.json`:
18
+
19
+ ```json
20
+ {
21
+ "mcpServers": {
22
+ "revit-api-docs": {
23
+ "command": "uvx",
24
+ "args": ["revit-api-docs"]
25
+ }
26
+ }
27
+ }
28
+ ```
29
+
30
+ **Claude Code**:
31
+
32
+ ```bash
33
+ claude mcp add revit-api-docs -- uvx revit-api-docs
34
+ ```
35
+
36
+ **Any MCP client** — run `uvx revit-api-docs` as a stdio server.
37
+
38
+ On the first start the server downloads the data set (335 MB, four files) from
39
+ this repository's [`v1.0-data` release](https://github.com/revitbridge/revit-api-docs/releases/tag/v1.0-data)
40
+ into `%LOCALAPPDATA%\revit-api-docs` (Windows) or `~/.local/share/revit-api-docs`
41
+ (Linux; `~/Library/Application Support/revit-api-docs` on macOS), verifies each
42
+ file's SHA-256 and unpacks the vector stores. Tool calls made while that runs
43
+ return a short progress message instead of results. To do it ahead of time:
44
+
45
+ ```bash
46
+ uvx revit-api-docs download
47
+ ```
48
+
49
+ From a checkout: `uv sync` then `uv run revit-api-docs`.
50
+
51
+ ## Use
52
+
53
+ Two tools, both read-only:
54
+
55
+ - `search_revit_api(query, top_k=10)` — API entries with signature, parameters
56
+ and remarks. Query with an API name (`Wall.Create`,
57
+ `FilteredElementCollector OfCategory`) or a short task (`create floor from
58
+ boundary`).
59
+ - `get_code_examples(query, top_k=3)` — C# from the SDK samples that use the
60
+ matching APIs, with the project name and the APIs each sample touches.
61
+
62
+ Without any API key the server answers from keyword search over the SQLite
63
+ reference (exact and partial name matches, which is what a model usually
64
+ asks for once it knows roughly what it wants). With an embedding key it adds
65
+ semantic search over the vector store, and with a Cohere key it reranks the
66
+ merged candidates. See Configure.
67
+
68
+ Try it from a terminal (installs the data set if needed):
69
+
70
+ ```bash
71
+ uvx revit-api-docs search "Wall.Create"
72
+ uvx revit-api-docs search "rotate element around axis" --examples
73
+ ```
74
+
75
+ ## Configure
76
+
77
+ All settings are environment variables; there is no config file to edit.
78
+
79
+ | Variable | Default | Meaning |
80
+ |---|---|---|
81
+ | `REVIT_API_DOCS_DATA_DIR` | `%LOCALAPPDATA%\revit-api-docs` (Windows), `~/.local/share/revit-api-docs` (Linux), `~/Library/Application Support/revit-api-docs` (macOS) | Where the data set lives. An existing tree with `sqlite/` and `chromadb/` from the old `revit-api-rag` checkout works as is |
82
+ | `REVIT_API_DOCS_EMBEDDING_API_KEY` | *(unset)* | Key for the embedding endpoint; turns on semantic (vector) search. `OPENROUTER_API_KEY` is used when this is unset |
83
+ | `REVIT_API_DOCS_EMBEDDING_BASE_URL` | `https://openrouter.ai/api/v1` | Any OpenAI-compatible `/embeddings` endpoint |
84
+ | `REVIT_API_DOCS_EMBEDDING_MODEL` | `openai/text-embedding-3-large` | Must produce the same 3072-dimensional space the shipped vectors were built with (`text-embedding-3-large`); another model makes vector search return noise |
85
+ | `COHERE_API_KEY` | *(unset)* | Enables reranking with Cohere `rerank-v3.5` (native REST API) |
86
+ | `REVIT_API_DOCS_RELEASE_URL` | this repository's `v1.0-data` release | Mirror for the data files; the SHA-256 checks still apply |
87
+ | `HTTPS_PROXY` / `HTTP_PROXY` | *(unset)* | Proxy for the embedding and rerank calls |
88
+
89
+ Pass them through the `env` block of your MCP host's server entry.
90
+
91
+ Data set: the SQLite databases and ChromaDB indexes were built from the Revit
92
+ 2026 API CHM and the Revit 2026 SDK samples with the pipeline in `pipeline/`
93
+ (`uv sync --extra pipeline`; needs the CHM, the SDK and OpenRouter/Cohere keys
94
+ in the environment). The server does not need any of that.
95
+
96
+ Development:
97
+
98
+ ```bash
99
+ uv sync
100
+ uv run pytest
101
+ uv build
102
+ uvx --from . revit-api-docs search "Wall.Create"
103
+ ```
104
+
105
+ License: MIT. Issues and discussion: <https://github.com/revitbridge/revit-api-docs/issues>.
File without changes
File without changes