Intégration MCP pour Django via FastMCP
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_mcp_integration-1.0.5.tar.gz.
File metadata
- Download URL: django_mcp_integration-1.0.5.tar.gz
- Upload date:
- Size: 16.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5042ef30f94d7ab5de52033f8409b305feb4ecee8ae97b2c544a8960b13558d
|
|
| MD5 |
ec385f64db875fa81687744d769b340c
|
|
| BLAKE2b-256 |
2341906755107abd002eb4d0ec20f6c3972bf6b25182fddbd74275d63473cc4d
|
Provenance
The following attestation bundles were made for django_mcp_integration-1.0.5.tar.gz:
Publisher:
release.yml on mosco23/django-mcp-integration
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_mcp_integration-1.0.5.tar.gz -
Subject digest:
b5042ef30f94d7ab5de52033f8409b305feb4ecee8ae97b2c544a8960b13558d - Sigstore transparency entry: 776270442
- Sigstore integration time:
-
Permalink:
mosco23/django-mcp-integration@abefa5a5acac695efed388018ddf4e2365620c98 -
Branch / Tag:
refs/tags/v1.0.5 - Owner: https://github.com/mosco23
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@abefa5a5acac695efed388018ddf4e2365620c98 -
Trigger Event:
push
-
Statement type:
File details
Details for the file django_mcp_integration-1.0.5-py3-none-any.whl.
File metadata
- Download URL: django_mcp_integration-1.0.5-py3-none-any.whl
- Upload date:
- Size: 21.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
334de90a2afe2f959d7b37c68ba724ea7429e00aa053717f7ed614eca29445b5
|
|
| MD5 |
66232638d113c74cb4637f31a11919f9
|
|
| BLAKE2b-256 |
ef15ac61694f42f8c3cab045ed742ead5667c29703cd07f073ee66a4d5464788
|
Provenance
The following attestation bundles were made for django_mcp_integration-1.0.5-py3-none-any.whl:
Publisher:
release.yml on mosco23/django-mcp-integration
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_mcp_integration-1.0.5-py3-none-any.whl -
Subject digest:
334de90a2afe2f959d7b37c68ba724ea7429e00aa053717f7ed614eca29445b5 - Sigstore transparency entry: 776270445
- Sigstore integration time:
-
Permalink:
mosco23/django-mcp-integration@abefa5a5acac695efed388018ddf4e2365620c98 -
Branch / Tag:
refs/tags/v1.0.5 - Owner: https://github.com/mosco23
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@abefa5a5acac695efed388018ddf4e2365620c98 -
Trigger Event:
push
-
Statement type: