Skip to main content

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:
    async def create(self, title: str, description: str):
        pass

lancerment du server

uvicorn django_mcp_test.asgi:application

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_mcp_integration-1.0.2.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_mcp_integration-1.0.2-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file django_mcp_integration-1.0.2.tar.gz.

File metadata

  • Download URL: django_mcp_integration-1.0.2.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for django_mcp_integration-1.0.2.tar.gz
Algorithm Hash digest
SHA256 d45bb38dace3c529d8b36781dcd10c4c5f3b6365f9c049c61bb0f07dbfce953b
MD5 c83a2837e8d30800a4ba981818b9c2b8
BLAKE2b-256 6c646e700908f7ec227eee65387db09404ea697178686545701267e4c87d0a11

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_mcp_integration-1.0.2.tar.gz:

Publisher: release.yml on mosco23/django-mcp-integration

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_mcp_integration-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for django_mcp_integration-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a3f7aeb78cd01725a688cc29032b6c8aa9cf5e99a5f42a5ca64878220ab26858
MD5 1f7a69474db470be1b402f8caae2fc92
BLAKE2b-256 f3b0341d6360cb18de5e39b9e90c160b94cb4309a38adafaf860cbadcdb56fec

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_mcp_integration-1.0.2-py3-none-any.whl:

Publisher: release.yml on mosco23/django-mcp-integration

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page