bazis-mcp 2.4.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.
- bazis_mcp-2.4.0/.dockerignore +3 -0
- bazis_mcp-2.4.0/.github/workflows/build-publish.yml +20 -0
- bazis_mcp-2.4.0/.github/workflows/release.yml +77 -0
- bazis_mcp-2.4.0/.github/workflows/tests.yml +74 -0
- bazis_mcp-2.4.0/.github/workflows/update-licenses.yml +18 -0
- bazis_mcp-2.4.0/.gitignore +44 -0
- bazis_mcp-2.4.0/CLAUDE.md +57 -0
- bazis_mcp-2.4.0/PKG-INFO +107 -0
- bazis_mcp-2.4.0/README.md +80 -0
- bazis_mcp-2.4.0/bazis/contrib/mcp/AGENTS.md +44 -0
- bazis_mcp-2.4.0/bazis/contrib/mcp/__init__.py +19 -0
- bazis_mcp-2.4.0/bazis/contrib/mcp/_version.py +24 -0
- bazis_mcp-2.4.0/bazis/contrib/mcp/bazis_manifest.toml +29 -0
- bazis_mcp-2.4.0/bazis/contrib/mcp/catalog.json +870 -0
- bazis_mcp-2.4.0/bazis/contrib/mcp/catalog.py +87 -0
- bazis_mcp-2.4.0/bazis/contrib/mcp/project.py +138 -0
- bazis_mcp-2.4.0/bazis/contrib/mcp/server.py +199 -0
- bazis_mcp-2.4.0/bazis_mcp.egg-info/PKG-INFO +107 -0
- bazis_mcp-2.4.0/bazis_mcp.egg-info/SOURCES.txt +46 -0
- bazis_mcp-2.4.0/bazis_mcp.egg-info/dependency_links.txt +1 -0
- bazis_mcp-2.4.0/bazis_mcp.egg-info/entry_points.txt +2 -0
- bazis_mcp-2.4.0/bazis_mcp.egg-info/requires.txt +8 -0
- bazis_mcp-2.4.0/bazis_mcp.egg-info/scm_file_list.json +41 -0
- bazis_mcp-2.4.0/bazis_mcp.egg-info/scm_version.json +8 -0
- bazis_mcp-2.4.0/bazis_mcp.egg-info/top_level.txt +1 -0
- bazis_mcp-2.4.0/docs/releases/2.4.0.md +11 -0
- bazis_mcp-2.4.0/pyproject.toml +98 -0
- bazis_mcp-2.4.0/pytest.ini +3 -0
- bazis_mcp-2.4.0/sample/manage.py +35 -0
- bazis_mcp-2.4.0/sample/project.env +9 -0
- bazis_mcp-2.4.0/sample/sample/__init__.py +14 -0
- bazis_mcp-2.4.0/sample/sample/main.py +21 -0
- bazis_mcp-2.4.0/sample/sample/router.py +19 -0
- bazis_mcp-2.4.0/sample/sample/settings.py +15 -0
- bazis_mcp-2.4.0/sample/sample/urls.py +29 -0
- bazis_mcp-2.4.0/sample/sample/wsgi.py +22 -0
- bazis_mcp-2.4.0/sample/shop/__init__.py +13 -0
- bazis_mcp-2.4.0/sample/shop/migrations/0001_initial.py +106 -0
- bazis_mcp-2.4.0/sample/shop/migrations/__init__.py +13 -0
- bazis_mcp-2.4.0/sample/shop/models.py +27 -0
- bazis_mcp-2.4.0/sample/shop/router.py +22 -0
- bazis_mcp-2.4.0/sample/shop/routes.py +25 -0
- bazis_mcp-2.4.0/scripts/update_catalog.py +94 -0
- bazis_mcp-2.4.0/setup.cfg +4 -0
- bazis_mcp-2.4.0/tests/__init__.py +13 -0
- bazis_mcp-2.4.0/tests/conftest.py +29 -0
- bazis_mcp-2.4.0/tests/test_manifest.py +19 -0
- bazis_mcp-2.4.0/tests/test_server.py +259 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
name: Build and Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*.*.*'
|
|
7
|
+
# started by the Release workflow on the tag it creates: a tag pushed with the
|
|
8
|
+
# workflow token does not trigger the push event above
|
|
9
|
+
workflow_dispatch:
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: write
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
build:
|
|
16
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
17
|
+
uses: ecofuture-tech/.github/.github/workflows/reusable-build-publish.yml@main
|
|
18
|
+
secrets:
|
|
19
|
+
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
|
|
20
|
+
TEST_PYPI_TOKEN: ${{ secrets.TEST_PYPI_TOKEN }}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
# Creates the release tag vX.Y.Z on the current main commit and starts Build and Publish
|
|
4
|
+
# for it. Run it from the Actions tab (or through the GitHub API) on the main branch.
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
inputs:
|
|
9
|
+
version:
|
|
10
|
+
description: 'Version without the "v" prefix, e.g. 2.3.0 or 2.4.0-rc1'
|
|
11
|
+
required: true
|
|
12
|
+
type: string
|
|
13
|
+
|
|
14
|
+
permissions:
|
|
15
|
+
contents: write
|
|
16
|
+
actions: write
|
|
17
|
+
|
|
18
|
+
concurrency:
|
|
19
|
+
group: release
|
|
20
|
+
cancel-in-progress: false
|
|
21
|
+
|
|
22
|
+
jobs:
|
|
23
|
+
release:
|
|
24
|
+
runs-on: ubuntu-latest
|
|
25
|
+
timeout-minutes: 10
|
|
26
|
+
if: github.ref == 'refs/heads/main'
|
|
27
|
+
env:
|
|
28
|
+
GH_TOKEN: ${{ github.token }}
|
|
29
|
+
VERSION: ${{ inputs.version }}
|
|
30
|
+
steps:
|
|
31
|
+
- uses: actions/checkout@v4
|
|
32
|
+
with:
|
|
33
|
+
fetch-depth: 0
|
|
34
|
+
|
|
35
|
+
- name: Validate the version
|
|
36
|
+
run: |
|
|
37
|
+
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-(alpha|beta|rc)[0-9]+)?$ ]]; then
|
|
38
|
+
echo "::error::Invalid version '$VERSION', expected e.g. 2.3.0 or 2.4.0-rc1"
|
|
39
|
+
exit 1
|
|
40
|
+
fi
|
|
41
|
+
if git rev-parse -q --verify "refs/tags/v$VERSION" >/dev/null; then
|
|
42
|
+
echo "::error::Tag v$VERSION already exists"
|
|
43
|
+
exit 1
|
|
44
|
+
fi
|
|
45
|
+
# versionsort.suffix: a pre-release (v2.4.0-rc1) sorts before its release (v2.4.0)
|
|
46
|
+
LAST_TAG=$(git -c versionsort.suffix=- tag --list 'v*' --sort=-v:refname | head -n 1)
|
|
47
|
+
echo "Last release: ${LAST_TAG:-none}, new release: v$VERSION"
|
|
48
|
+
# sort -V orders "~" before anything, as versionsort.suffix does with "-"
|
|
49
|
+
NEWEST=$(printf '%s\n%s\n' "${LAST_TAG#v}" "$VERSION" | sed 's/-/~/' | sort -V | tail -n 1)
|
|
50
|
+
if [ -n "$LAST_TAG" ] && [ "$NEWEST" != "${VERSION/-/\~}" ]; then
|
|
51
|
+
echo "::error::Version $VERSION is not newer than $LAST_TAG"
|
|
52
|
+
exit 1
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
- name: Require green tests on this commit
|
|
56
|
+
run: |
|
|
57
|
+
CONCLUSION=$(gh run list --workflow tests.yml --commit "$GITHUB_SHA" --status completed \
|
|
58
|
+
--json conclusion --jq 'map(.conclusion) | first // "none"')
|
|
59
|
+
echo "Tests on $GITHUB_SHA: $CONCLUSION"
|
|
60
|
+
if [ "$CONCLUSION" != "success" ]; then
|
|
61
|
+
echo "::error::The Tests workflow has not succeeded on $GITHUB_SHA ($CONCLUSION)"
|
|
62
|
+
exit 1
|
|
63
|
+
fi
|
|
64
|
+
|
|
65
|
+
- name: Create the tag
|
|
66
|
+
run: |
|
|
67
|
+
git config user.name 'github-actions[bot]'
|
|
68
|
+
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
|
|
69
|
+
git tag -a "v$VERSION" -m "${{ github.event.repository.name }} $VERSION" "$GITHUB_SHA"
|
|
70
|
+
git push origin "v$VERSION"
|
|
71
|
+
|
|
72
|
+
- name: Start Build and Publish
|
|
73
|
+
run: gh workflow run build-publish.yml --ref "v$VERSION"
|
|
74
|
+
|
|
75
|
+
- name: Summary
|
|
76
|
+
run: |
|
|
77
|
+
echo "Tagged \`v$VERSION\` at \`$GITHUB_SHA\` and started Build and Publish." >> "$GITHUB_STEP_SUMMARY"
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
concurrency:
|
|
13
|
+
group: tests-${{ github.ref }}
|
|
14
|
+
cancel-in-progress: true
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
lint:
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
timeout-minutes: 10
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
- uses: astral-sh/setup-uv@v6
|
|
23
|
+
- run: uvx ruff check bazis tests sample scripts
|
|
24
|
+
|
|
25
|
+
tests:
|
|
26
|
+
name: tests (python ${{ matrix.python }}, ${{ matrix.resolution }})
|
|
27
|
+
runs-on: ubuntu-latest
|
|
28
|
+
timeout-minutes: 30
|
|
29
|
+
strategy:
|
|
30
|
+
fail-fast: false
|
|
31
|
+
matrix:
|
|
32
|
+
python: ['3.12', '3.13', '3.14']
|
|
33
|
+
resolution: [highest]
|
|
34
|
+
include:
|
|
35
|
+
# the lowest versions allowed by pyproject.toml
|
|
36
|
+
- python: '3.12'
|
|
37
|
+
resolution: lowest-direct
|
|
38
|
+
|
|
39
|
+
# the server reads the project without connecting to PostgreSQL or Redis: no services
|
|
40
|
+
env:
|
|
41
|
+
BS_DEBUG: 'true'
|
|
42
|
+
BS_SECRET_KEY: ci-only-secret-key-that-is-long-enough-0123456789
|
|
43
|
+
BS_DATABASES__DEFAULT__HOST: localhost
|
|
44
|
+
BS_DATABASES__DEFAULT__PORT: '5432'
|
|
45
|
+
BS_DATABASES__DEFAULT__NAME: bazis
|
|
46
|
+
BS_DATABASES__DEFAULT__USER: postgres
|
|
47
|
+
BS_DATABASES__DEFAULT__PASSWORD: postgres
|
|
48
|
+
BS_CACHES__DEFAULT__LOCATION: redis://localhost:6379/1
|
|
49
|
+
steps:
|
|
50
|
+
- uses: actions/checkout@v4
|
|
51
|
+
|
|
52
|
+
- name: Install GDAL (required by the PostGIS database backend)
|
|
53
|
+
# a stalled Ubuntu mirror must fail the step quickly instead of hanging the job
|
|
54
|
+
timeout-minutes: 10
|
|
55
|
+
run: |
|
|
56
|
+
APT="sudo apt-get -o Acquire::Retries=3 -o Acquire::http::Timeout=30 -o Acquire::https::Timeout=30"
|
|
57
|
+
$APT update
|
|
58
|
+
$APT install -y --no-install-recommends gdal-bin
|
|
59
|
+
|
|
60
|
+
- uses: astral-sh/setup-uv@v6
|
|
61
|
+
with:
|
|
62
|
+
python-version: ${{ matrix.python }}
|
|
63
|
+
activate-environment: true
|
|
64
|
+
|
|
65
|
+
- name: Install dependencies
|
|
66
|
+
run: uv pip install --resolution ${{ matrix.resolution }} -e '.[test]'
|
|
67
|
+
|
|
68
|
+
- name: Check for missing migrations
|
|
69
|
+
working-directory: sample
|
|
70
|
+
run: python manage.py makemigrations --check --dry-run
|
|
71
|
+
|
|
72
|
+
- name: Run tests
|
|
73
|
+
working-directory: sample
|
|
74
|
+
run: python -m pytest ../tests -o addopts="" -p no:cacheprovider
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
name: Update Licenses
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
paths:
|
|
8
|
+
- '**.py'
|
|
9
|
+
- 'pyproject.toml'
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: write
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
update-licenses:
|
|
16
|
+
uses: ecofuture-tech/.github/.github/workflows/reusable-update-licenses.yml@main
|
|
17
|
+
secrets:
|
|
18
|
+
WORKFLOW_LICENSE_TOKEN: ${{ secrets.WORKFLOW_LICENSE_TOKEN }}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
.idea
|
|
2
|
+
.ipynb_checkpoints
|
|
3
|
+
.mypy_cache
|
|
4
|
+
.vscode
|
|
5
|
+
__pycache__
|
|
6
|
+
.pytest_cache
|
|
7
|
+
htmlcov
|
|
8
|
+
dist
|
|
9
|
+
site
|
|
10
|
+
.coverage
|
|
11
|
+
coverage.xml
|
|
12
|
+
.netlify
|
|
13
|
+
test.db
|
|
14
|
+
log.txt
|
|
15
|
+
Pipfile.lock
|
|
16
|
+
env3.*
|
|
17
|
+
env
|
|
18
|
+
docs_build
|
|
19
|
+
venv
|
|
20
|
+
.venv
|
|
21
|
+
docs.zip
|
|
22
|
+
archive.zip
|
|
23
|
+
|
|
24
|
+
.env
|
|
25
|
+
local.env
|
|
26
|
+
*/.env*
|
|
27
|
+
|
|
28
|
+
# vim temporary files
|
|
29
|
+
*~
|
|
30
|
+
.*.sw?
|
|
31
|
+
*.DS_Store
|
|
32
|
+
|
|
33
|
+
*.egg-info
|
|
34
|
+
build
|
|
35
|
+
dist
|
|
36
|
+
|
|
37
|
+
docs/_autosummary
|
|
38
|
+
docs/_build
|
|
39
|
+
*.DS_Store
|
|
40
|
+
*.log
|
|
41
|
+
my-*
|
|
42
|
+
My*
|
|
43
|
+
*/**/_version.py
|
|
44
|
+
/uv.lock
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# bazis-mcp
|
|
2
|
+
|
|
3
|
+
The MCP server of a Bazis project (`bazis-mcp` command, `MCPServer` of the official `mcp`
|
|
4
|
+
SDK 2.x): the catalog of the Bazis packages and the facts and system checks of the
|
|
5
|
+
project, for AI agents. All tools only read.
|
|
6
|
+
|
|
7
|
+
- `bazis/contrib/mcp/server.py` — the tools, the resource, the prompts and `main()`;
|
|
8
|
+
- `bazis/contrib/mcp/catalog.py` — the installed packages and the snapshot `catalog.json`;
|
|
9
|
+
- `bazis/contrib/mcp/project.py` — loading the project, `bazis.core.introspect` and the
|
|
10
|
+
system checks;
|
|
11
|
+
- `scripts/update_catalog.py` — rebuilds `catalog.json` from the wheels on PyPI.
|
|
12
|
+
|
|
13
|
+
stdout is the protocol channel of the stdio transport: nothing may print to it.
|
|
14
|
+
`main()` sends the output of loading the project to stderr, and the SDK diverts stdout
|
|
15
|
+
while it serves.
|
|
16
|
+
|
|
17
|
+
The sample project used by the tests is in `sample/`, the tests are in `tests/`.
|
|
18
|
+
|
|
19
|
+
## Running the tests
|
|
20
|
+
|
|
21
|
+
The tests need neither PostgreSQL nor Redis (only GDAL for the PostGIS backend).
|
|
22
|
+
Run them from the `sample` directory:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
cd sample
|
|
26
|
+
BS_DEBUG=true \
|
|
27
|
+
BS_SECRET_KEY=local-secret-key-that-is-long-enough-0123456789 \
|
|
28
|
+
BS_DATABASES__DEFAULT__HOST=localhost BS_DATABASES__DEFAULT__NAME=bazis \
|
|
29
|
+
BS_DATABASES__DEFAULT__USER=postgres BS_DATABASES__DEFAULT__PASSWORD=postgres \
|
|
30
|
+
BS_CACHES__DEFAULT__LOCATION=redis://localhost:6379/1 \
|
|
31
|
+
python -m pytest ../tests -o addopts="" -p no:cacheprovider
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Lint: `ruff check bazis tests sample scripts`.
|
|
35
|
+
|
|
36
|
+
## Releasing
|
|
37
|
+
|
|
38
|
+
A release is the tag `vX.Y.Z` on `main`: the Build and Publish workflow builds the package
|
|
39
|
+
(the version comes from the tag through setuptools-scm) and publishes it to PyPI
|
|
40
|
+
(pre-releases `-alphaN`/`-betaN`/`-rcN` go to Test PyPI) and creates the GitHub release.
|
|
41
|
+
|
|
42
|
+
Claude Code sessions cannot push tags. Release through the **Release** workflow instead:
|
|
43
|
+
|
|
44
|
+
1. Rebuild the catalog with `python scripts/update_catalog.py` after the releases of the
|
|
45
|
+
other Bazis packages, and commit it.
|
|
46
|
+
2. Make sure the changes are merged into `main` and the Tests workflow is green on the
|
|
47
|
+
`main` head commit (the Release workflow checks this and refuses otherwise).
|
|
48
|
+
3. Add the release notes as `docs/releases/X.Y.Z.md` in the change being released.
|
|
49
|
+
4. Start the workflow `release.yml` on `ref: main` with the input `version: X.Y.Z`
|
|
50
|
+
(GitHub API: `POST /repos/ecofuture-tech/bazis-mcp/actions/workflows/release.yml/dispatches`;
|
|
51
|
+
with the GitHub MCP tools: `actions_run_trigger`, method `run_workflow`).
|
|
52
|
+
5. The Release run creates the annotated tag and starts Build and Publish on it. Check
|
|
53
|
+
that both runs succeed and that the version appears on https://pypi.org/project/bazis-mcp/.
|
|
54
|
+
|
|
55
|
+
bazis-mcp is released after the other Bazis packages: its catalog describes their latest
|
|
56
|
+
releases. Pick the version by semver: breaking changes (tools renamed or removed, their
|
|
57
|
+
results changed) bump the minor version while the project is below 3.0.
|
bazis_mcp-2.4.0/PKG-INFO
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: bazis-mcp
|
|
3
|
+
Version: 2.4.0
|
|
4
|
+
Summary: MCP server of Bazis projects: the catalog of the Bazis packages and the facts and checks of the project for AI agents.
|
|
5
|
+
Author-email: Ilya Kharyn <ilya.tt07@gmail.com>
|
|
6
|
+
Maintainer-email: Ilya Kharyn <ilya.tt07@gmail.com>
|
|
7
|
+
License-Expression: Apache-2.0
|
|
8
|
+
Project-URL: Home, https://github.com/ecofuture-tech/bazis-mcp
|
|
9
|
+
Keywords: bazis,django,fastapi,pydantic,framework,jsonapi,mcp,ai,agents
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Classifier: Framework :: Django
|
|
18
|
+
Classifier: Framework :: FastAPI
|
|
19
|
+
Requires-Python: >=3.12
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
Requires-Dist: bazis>=2.4.1
|
|
22
|
+
Requires-Dist: mcp>=2.0
|
|
23
|
+
Provides-Extra: test
|
|
24
|
+
Requires-Dist: bazis-test-utils>=2.3.0; extra == "test"
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: ruff; extra == "dev"
|
|
27
|
+
|
|
28
|
+
# bazis-mcp
|
|
29
|
+
|
|
30
|
+
The [MCP](https://modelcontextprotocol.io) server of a [Bazis](https://github.com/ecofuture-tech/bazis)
|
|
31
|
+
project. It gives AI agents (Claude Code, IDEs with MCP support) what they need to build and
|
|
32
|
+
check a Bazis project from the project itself rather than from memory:
|
|
33
|
+
|
|
34
|
+
- the catalog of the Bazis packages, also the ones not installed: what each one solves,
|
|
35
|
+
what it requires, and its guide for agents (`AGENTS.md` and `bazis_manifest.toml`);
|
|
36
|
+
- the facts about the project: installed packages, settings (secrets hidden), models and
|
|
37
|
+
routes (`bazis.core.introspect`);
|
|
38
|
+
- the system checks of the project and of its Bazis packages (`manage.py bazis_doctor`).
|
|
39
|
+
|
|
40
|
+
All tools only read. The agent changes the files itself and checks the result with the
|
|
41
|
+
server.
|
|
42
|
+
|
|
43
|
+
## Installation
|
|
44
|
+
|
|
45
|
+
Install it as a development dependency of the project:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pip install bazis-mcp
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Register the server for the MCP client with the directory of `manage.py` (MCP clients
|
|
52
|
+
start servers in their own working directory, usually the repository root):
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Claude Code, run in the repository root
|
|
56
|
+
claude mcp add bazis -- .venv/bin/bazis-mcp --project-dir app
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
or in `.mcp.json` of the repository:
|
|
60
|
+
|
|
61
|
+
```json
|
|
62
|
+
{
|
|
63
|
+
"mcpServers": {
|
|
64
|
+
"bazis": {"command": ".venv/bin/bazis-mcp", "args": ["--project-dir", "app"]}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
(`app` is the directory of `manage.py`; leave `--project-dir` out if it is the root.)
|
|
70
|
+
|
|
71
|
+
`bazis-mcp [--project-dir DIR] [--settings MODULE]`:
|
|
72
|
+
|
|
73
|
+
- `--project-dir` — the directory of `manage.py` and `project.env` (default: the current
|
|
74
|
+
directory);
|
|
75
|
+
- `--settings` — the settings module (default: `DJANGO_SETTINGS_MODULE`, or the module
|
|
76
|
+
that `manage.py` sets).
|
|
77
|
+
|
|
78
|
+
The environment of the project (`project.env`, `BS_*` variables) is read as by
|
|
79
|
+
`manage.py`. The server needs neither the database nor Redis. It loads the settings and
|
|
80
|
+
the application of the project, so it runs the project code like `manage.py` does. If the
|
|
81
|
+
project cannot be loaded, the catalog tools still work and the project tools return the
|
|
82
|
+
error.
|
|
83
|
+
|
|
84
|
+
`bazis-mcp` is not a Django app: do not add it to `BS_INSTALLED_APPS`.
|
|
85
|
+
|
|
86
|
+
## Tools
|
|
87
|
+
|
|
88
|
+
| Tool | Returns |
|
|
89
|
+
|---|---|
|
|
90
|
+
| `list_packages` | Every Bazis package: `summary`, `solves`, `requires`, `pairs_well`, `installed_version`, `catalog_version`, `guide_version` |
|
|
91
|
+
| `package_guide(name)` | The `AGENTS.md` and the manifest of a package (`bazis` for the core) |
|
|
92
|
+
| `project_info(sections)` | `packages`, `settings`, `models`, `routes` of the project |
|
|
93
|
+
| `run_doctor(deploy)` | The messages of the system checks; `ok` is false if there is an error |
|
|
94
|
+
|
|
95
|
+
Resource: `bazis://packages/{name}/agents.md`. Prompts: `add_package(name)` (add a package
|
|
96
|
+
and make the checks pass) and `audit_project` (review the project against the guides and
|
|
97
|
+
checks of its packages).
|
|
98
|
+
|
|
99
|
+
An installed package is described by its installed files. The packages that are not
|
|
100
|
+
installed, and those installed in a version without a guide (before 2.4), come from
|
|
101
|
+
`catalog.json`, a snapshot of the latest releases taken at the release of bazis-mcp;
|
|
102
|
+
`guide_version` is the version the guide describes.
|
|
103
|
+
|
|
104
|
+
The settings are shown with the secrets hidden by `bazis.core.introspect` (by the names
|
|
105
|
+
of the settings and keys, the passwords of URLs and the credentials of `Authorization`
|
|
106
|
+
values). The tool results go to the model of the MCP client: review what the project keeps
|
|
107
|
+
in its settings before connecting it.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# bazis-mcp
|
|
2
|
+
|
|
3
|
+
The [MCP](https://modelcontextprotocol.io) server of a [Bazis](https://github.com/ecofuture-tech/bazis)
|
|
4
|
+
project. It gives AI agents (Claude Code, IDEs with MCP support) what they need to build and
|
|
5
|
+
check a Bazis project from the project itself rather than from memory:
|
|
6
|
+
|
|
7
|
+
- the catalog of the Bazis packages, also the ones not installed: what each one solves,
|
|
8
|
+
what it requires, and its guide for agents (`AGENTS.md` and `bazis_manifest.toml`);
|
|
9
|
+
- the facts about the project: installed packages, settings (secrets hidden), models and
|
|
10
|
+
routes (`bazis.core.introspect`);
|
|
11
|
+
- the system checks of the project and of its Bazis packages (`manage.py bazis_doctor`).
|
|
12
|
+
|
|
13
|
+
All tools only read. The agent changes the files itself and checks the result with the
|
|
14
|
+
server.
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
Install it as a development dependency of the project:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pip install bazis-mcp
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Register the server for the MCP client with the directory of `manage.py` (MCP clients
|
|
25
|
+
start servers in their own working directory, usually the repository root):
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Claude Code, run in the repository root
|
|
29
|
+
claude mcp add bazis -- .venv/bin/bazis-mcp --project-dir app
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
or in `.mcp.json` of the repository:
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"mcpServers": {
|
|
37
|
+
"bazis": {"command": ".venv/bin/bazis-mcp", "args": ["--project-dir", "app"]}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
(`app` is the directory of `manage.py`; leave `--project-dir` out if it is the root.)
|
|
43
|
+
|
|
44
|
+
`bazis-mcp [--project-dir DIR] [--settings MODULE]`:
|
|
45
|
+
|
|
46
|
+
- `--project-dir` — the directory of `manage.py` and `project.env` (default: the current
|
|
47
|
+
directory);
|
|
48
|
+
- `--settings` — the settings module (default: `DJANGO_SETTINGS_MODULE`, or the module
|
|
49
|
+
that `manage.py` sets).
|
|
50
|
+
|
|
51
|
+
The environment of the project (`project.env`, `BS_*` variables) is read as by
|
|
52
|
+
`manage.py`. The server needs neither the database nor Redis. It loads the settings and
|
|
53
|
+
the application of the project, so it runs the project code like `manage.py` does. If the
|
|
54
|
+
project cannot be loaded, the catalog tools still work and the project tools return the
|
|
55
|
+
error.
|
|
56
|
+
|
|
57
|
+
`bazis-mcp` is not a Django app: do not add it to `BS_INSTALLED_APPS`.
|
|
58
|
+
|
|
59
|
+
## Tools
|
|
60
|
+
|
|
61
|
+
| Tool | Returns |
|
|
62
|
+
|---|---|
|
|
63
|
+
| `list_packages` | Every Bazis package: `summary`, `solves`, `requires`, `pairs_well`, `installed_version`, `catalog_version`, `guide_version` |
|
|
64
|
+
| `package_guide(name)` | The `AGENTS.md` and the manifest of a package (`bazis` for the core) |
|
|
65
|
+
| `project_info(sections)` | `packages`, `settings`, `models`, `routes` of the project |
|
|
66
|
+
| `run_doctor(deploy)` | The messages of the system checks; `ok` is false if there is an error |
|
|
67
|
+
|
|
68
|
+
Resource: `bazis://packages/{name}/agents.md`. Prompts: `add_package(name)` (add a package
|
|
69
|
+
and make the checks pass) and `audit_project` (review the project against the guides and
|
|
70
|
+
checks of its packages).
|
|
71
|
+
|
|
72
|
+
An installed package is described by its installed files. The packages that are not
|
|
73
|
+
installed, and those installed in a version without a guide (before 2.4), come from
|
|
74
|
+
`catalog.json`, a snapshot of the latest releases taken at the release of bazis-mcp;
|
|
75
|
+
`guide_version` is the version the guide describes.
|
|
76
|
+
|
|
77
|
+
The settings are shown with the secrets hidden by `bazis.core.introspect` (by the names
|
|
78
|
+
of the settings and keys, the passwords of URLs and the credentials of `Authorization`
|
|
79
|
+
values). The tool results go to the model of the MCP client: review what the project keeps
|
|
80
|
+
in its settings before connecting it.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# bazis-mcp — guide for AI agents
|
|
2
|
+
|
|
3
|
+
The MCP server of a Bazis project. It gives an agent the catalog of the Bazis packages
|
|
4
|
+
(also the ones not installed) with their guides, and the facts and system checks of the
|
|
5
|
+
project it runs in. All tools only read; the agent changes the files itself.
|
|
6
|
+
|
|
7
|
+
## Setup
|
|
8
|
+
|
|
9
|
+
Install it as a development dependency of the project (`pip install bazis-mcp`) and
|
|
10
|
+
register the command for the MCP client with the directory of `manage.py` (the client
|
|
11
|
+
starts it in its own working directory):
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
claude mcp add bazis -- .venv/bin/bazis-mcp --project-dir <directory of manage.py>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
`bazis-mcp [--project-dir DIR] [--settings MODULE]` loads the project in `DIR` (default:
|
|
18
|
+
the current directory) with `project.env` and the settings module of `manage.py` (or
|
|
19
|
+
`DJANGO_SETTINGS_MODULE`). It is not a Django app: do not add it to `BS_INSTALLED_APPS`.
|
|
20
|
+
|
|
21
|
+
## Tools
|
|
22
|
+
|
|
23
|
+
- `list_packages` — every Bazis package: `summary`, `solves`, `requires`, `pairs_well`,
|
|
24
|
+
`installed_version` (null if not installed), `catalog_version` and `guide_version`.
|
|
25
|
+
- `package_guide(name)` — AGENTS.md and manifest of a package (`bazis` for the core).
|
|
26
|
+
An installed package is described by its installed files, the others (and installed
|
|
27
|
+
versions without a guide, before 2.4) by the catalog; `guide_version` says which.
|
|
28
|
+
- `project_info(sections)` — `packages`, `settings` (secrets hidden), `models`, `routes`
|
|
29
|
+
of the project (`bazis.core.introspect`).
|
|
30
|
+
- `run_doctor(deploy)` — the Django system checks with the checks of the Bazis packages
|
|
31
|
+
(`manage.py bazis_doctor`); `ok` is false if there is an error.
|
|
32
|
+
|
|
33
|
+
The resource `bazis://packages/{name}/agents.md` is the AGENTS.md of a package; the prompts
|
|
34
|
+
`add_package(name)` and `audit_project` describe these tasks step by step.
|
|
35
|
+
|
|
36
|
+
## Rules
|
|
37
|
+
|
|
38
|
+
- Choose packages by `solves` and read `package_guide` before using a package; follow the
|
|
39
|
+
guide of the installed version (when `guide_version` differs from `installed_version`,
|
|
40
|
+
upgrade the package or check the guide against its code).
|
|
41
|
+
- Run `run_doctor` and the tests after every change. If the project cannot be loaded, the
|
|
42
|
+
project tools return the error and the catalog tools still work.
|
|
43
|
+
- The catalog of the packages that are not installed is a snapshot made at the release of
|
|
44
|
+
bazis-mcp; their latest version may be newer.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Copyright 2026 EcoFuture Technology Services LLC and contributors
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
try:
|
|
16
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
17
|
+
__version__ = version('bazis-mcp')
|
|
18
|
+
except PackageNotFoundError:
|
|
19
|
+
__version__ = 'dev'
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# file generated by vcs-versioning
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
__all__ = [
|
|
6
|
+
"__version__",
|
|
7
|
+
"__version_tuple__",
|
|
8
|
+
"version",
|
|
9
|
+
"version_tuple",
|
|
10
|
+
"__commit_id__",
|
|
11
|
+
"commit_id",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
version: str
|
|
15
|
+
__version__: str
|
|
16
|
+
__version_tuple__: tuple[int | str, ...]
|
|
17
|
+
version_tuple: tuple[int | str, ...]
|
|
18
|
+
commit_id: str | None
|
|
19
|
+
__commit_id__: str | None
|
|
20
|
+
|
|
21
|
+
__version__ = version = '2.4.0'
|
|
22
|
+
__version_tuple__ = version_tuple = (2, 4, 0)
|
|
23
|
+
|
|
24
|
+
__commit_id__ = commit_id = 'g08858be18'
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# What the package is for and how to use it, for tools and AI agents (see AGENTS.md).
|
|
2
|
+
# `import` paths and `check` ids are verified by tests/test_manifest.py.
|
|
3
|
+
|
|
4
|
+
[package]
|
|
5
|
+
name = "bazis-mcp"
|
|
6
|
+
summary = "MCP server of a Bazis project: the catalog of the Bazis packages and the facts and checks of the project for AI agents"
|
|
7
|
+
solves = [
|
|
8
|
+
"an AI agent chooses the Bazis packages a project needs and reads how to use them",
|
|
9
|
+
"an AI agent reads the models, routes and settings of the project",
|
|
10
|
+
"an AI agent checks the project after a change",
|
|
11
|
+
]
|
|
12
|
+
requires = ["bazis"]
|
|
13
|
+
pairs_well = []
|
|
14
|
+
|
|
15
|
+
[[extension_points]]
|
|
16
|
+
name = "bazis-mcp"
|
|
17
|
+
import = "bazis.contrib.mcp.server.main"
|
|
18
|
+
use_when = "the command that MCP clients run in the project directory"
|
|
19
|
+
|
|
20
|
+
[[extension_points]]
|
|
21
|
+
name = "server"
|
|
22
|
+
import = "bazis.contrib.mcp.server.server"
|
|
23
|
+
use_when = "the MCPServer instance, to mount it in another server or test it in-process"
|
|
24
|
+
|
|
25
|
+
[[pitfalls]]
|
|
26
|
+
text = "the server loads the settings and the application of the project: it runs the project code, like manage.py"
|
|
27
|
+
|
|
28
|
+
[[pitfalls]]
|
|
29
|
+
text = "the guides of packages that are not installed come from a snapshot taken at the release of bazis-mcp"
|