Django MCP Integration
Intégration transparente de MCP (Model Context Protocol) dans Django via FastMCP.
Installation
pip install django-mcp-integration
Configuration Django
- Modifier le fichier settings.py
# settings.py
INSTALLED_APPS = [
# ...
'django_mcp_integration',
]
# Optionnel
MCP_SERVER_NAME = "Mon Serveur MCP"
MCP_HOST = "localhost"
MCP_PORT = 8000
MCP_HTTP_PATH = "/mcp/"
MCP_ENABLED = True
MCP_SERVER_INSTRUCTIONS = None
MCP_SERVER_VERSION = "1.0.0"
- Modifier le fichier asgi.py
# asgi.py
import os
# from django.core.asgi import get_asgi_application
from django_mcp_integration.handlers.asgi import get_mcp_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'my_project.settings')
application = get_mcp_asgi_application()
Utiliser dans un outil
# blog/tools.py or blog/mcp_tools.py
from django_mcp_integration import mcp_tool
@mcp_tool(
name="add",
description="make a + b",
)
async def add(a: int, b: int) -> int:
return a + b
@mcp_tool(
name="create_post",
description="create post by IA"
)
class CreatePostTool:
# optional
def check_permission(self, obj):
pass
# required method
async def execute(self, title: str, content: str):
pass
lancerment du server
uvicorn django_mcp_test.asgi:application
Metadata
Release files for django-mcp-integration 1.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| django_mcp_integration-1.0.5.tar.gz | 16.4 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_mcp_integration-1.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 38.0 kB
Release files / django_mcp_integration-1.0.5.tar.gz
| Download URL | django_mcp_integration-1.0.5.tar.gz |
|---|---|
| Size | 16.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b5042ef30f94d7ab5de52033f8409b305feb4ecee8ae97b2c544a8960b13558d
|
|
BLAKE2b-256 checksum How to use checksums |
2341906755107abd002eb4d0ec20f6c3972bf6b25182fddbd74275d63473cc4d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 23, 2025.
Transparency logRelease files / django_mcp_integration-1.0.5-py3-none-any.whl
| Download URL | django_mcp_integration-1.0.5-py3-none-any.whl |
|---|---|
| Size | 21.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
334de90a2afe2f959d7b37c68ba724ea7429e00aa053717f7ed614eca29445b5
|
|
BLAKE2b-256 checksum How to use checksums |
ef15ac61694f42f8c3cab045ed742ead5667c29703cd07f073ee66a4d5464788
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 23, 2025.
Transparency logSecurity for django-mcp-integration 1.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for django_mcp_integration-1.0.5.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 23, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.