About Django Mcpz
Django Mcpz is an MCP server published by adamchainz in the Developer Tools category: easy peasy MCP servers in Django.
The repository has 51 stars and 4 forks, with the last commit 7 days ago. Recent commit activity is the strongest signal that reported issues will get attention.
Install
git clone https://github.com/adamchainz/django-mcpzThis server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.
Ask AI
Ask AI about Django Mcpz
Powered by Claude · Grounded in docs
Security checks
Static checks derived from the repository 4 days ago. Heuristics on the source, not an audit.
- ✓README presentThe repository ships documentation.
- ✓License declaredUsable under a stated license.
- ✓Tests presentA test suite exists in the repository.
- ✓Dependencies pinnedA lockfile pins dependency versions.
- ✓No dynamic code executionSource scan found no eval, dynamic Function, or shell execution.
1 check has not been run yet.
Releases
README
=========== django-mcpz
.. image:: https://img.shields.io/readthedocs/django-mcpz?style=for-the-badge :target: https://django-mcpz.readthedocs.io/en/latest/
.. image:: https://img.shields.io/github/actions/workflow/status/adamchainz/django-mcpz/main.yml.svg?branch=main&style=for-the-badge :target: https://github.com/adamchainz/django-mcpz/actions?workflow=CI
.. image:: https://img.shields.io/badge/Coverage-100%25-success?style=for-the-badge :target: https://github.com/adamchainz/django-mcpz/actions?workflow=CI
.. image:: https://img.shields.io/pypi/v/django-mcpz.svg?style=for-the-badge :target: https://pypi.org/project/django-mcpz/
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg?style=for-the-badge :target: https://github.com/psf/black
.. image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white&style=for-the-badge :target: https://github.com/pre-commit/pre-commit :alt: pre-commit
Easy peasy MCP servers in Django.
django-mcpz lets you build a Model Context Protocol (MCP) server in your Django project.
Create an MCP server object with metadata, give it a URL, and attach Python functions to it as tools.
The MCP server acts like a regular synchronous Django view, handling the intricacies of the MCP protocol.
django-mcpz leans on msgspec <https://msgspec.dev/>__ for defining schemas and fast JSON serialization and deserialization.
A quick example:
.. code-block:: python
from typing import Literal
import msgspec
from django_mcpz.server import MCPServer
from django_mcpz.bearer_tokens.auth import token_auth
from example.models import Order
server = MCPServer(
name="shop",
version="1.0.0",
instructions="Query the shop’s order database.",
auth=token_auth,
)
class CountOrdersParams(msgspec.Struct):
status: Literal["pending", "shipped", "cancelled"] | None = None
class CountOrdersResult(msgspec.Struct):
count: int
@server.tool(
description="Count Order rows, optionally filtered by status.",
read_only=True,
)
def count_orders(request, params: CountOrdersParams) -> CountOrdersResult:
qs = Order.objects.all()
if params.status is not None:
qs = qs.filter(status=params.status)
return CountOrdersResult(count=qs.count())
Documentation
Please see https://django-mcpz.readthedocs.io/.
README fetched from the repository 4 days ago. The original is authoritative.