Skip to main content

MCP server exposing django-silk profiling data as AI assistant tools

Project description

django-silk-mcp

codecov

An MCP server that exposes django-silk profiling data as tools for any MCP-compatible AI coding assistant. Enables query-level investigation and optimization directly from your conversation — N+1 detection, EXPLAIN ANALYZE, over-fetch analysis, and Python profiling without leaving your editor.

Requirements

  • Python 3.11+
  • Django 4.2+
  • django-silk 5.0+ installed and active
  • PostgreSQL (for explain_slow_queries)

Installation

pip install django-silk-mcp
# or
uv add django-silk-mcp

Configuration

1. Add to INSTALLED_APPS

INSTALLED_APPS = [
    ...
    "silk",
    "django_silk_mcp",
]

2. Configure your MCP client

Expose the MCP server as a URL inside your Django app. Works on both WSGI and ASGI with no extra infrastructure.

Add to your root urls.py:

urlpatterns = [
    ...
    path("silk/", include("silk.urls", namespace="silk")),
    path("silk/mcp", include("django_silk_mcp.urls")),
]

This serves the MCP endpoint at /silk/mcp. Then configure your MCP client with the URL:

{
  "mcpServers": {
    "silk-profiler": {
      "url": "http://localhost:<port>/silk/mcp"
    }
  }
}

AI assistant skill

Install the skill to get guided workflows and tool reference in your AI assistant:

npx skills add vintasoftware/django-silk-mcp

Tools

Tool Purpose
get_most_expensive_endpoints Rank all endpoints by average DB time
get_request_time_breakdown DB% vs Python% — confirm where time is spent
get_duplicate_queries Detect N+1 patterns
get_query_sources Which code lines triggered each query
get_overfetched_fields SQL columns vs serializer fields — .only() candidates
explain_slow_queries EXPLAIN (ANALYZE, BUFFERS) on slow SELECTs
get_request_queries All SQL for a specific request
get_slow_queries Slowest individual queries across all requests
get_slow_requests Slowest HTTP requests
compare_requests Before/after comparison with burst deduplication
get_python_profiles @silk_profile decorated block timings
get_cprofile_hotspots cProfile hotspots — no decorators needed

Usage

# Hit an endpoint first so Silk has data
curl http://localhost:8000/api/your-endpoint/

# Then ask your AI assistant
# "What are the slowest endpoints?"
# "Find N+1 queries in /api/your-endpoint/"
# "Run EXPLAIN on the slow queries for /api/your-endpoint/"

Links

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_silk_mcp-0.1.0.tar.gz (17.8 kB view details)

Uploaded Source

Built Distribution

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

django_silk_mcp-0.1.0-py3-none-any.whl (25.4 kB view details)

Uploaded Python 3

File details

Details for the file django_silk_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: django_silk_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 17.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for django_silk_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 56e2fecb86994cffbc749efa0cbe6425e1341448da2e8f308ea0874329e56577
MD5 0a2b351c27765845fd1fd459b1eea157
BLAKE2b-256 85f406c2ae2fa1daa3c3b9905b8bf016fa53c079c37d83a598e5b242f8316b0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_silk_mcp-0.1.0.tar.gz:

Publisher: publish.yml on vintasoftware/django-silk-mcp

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_silk_mcp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: django_silk_mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 25.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for django_silk_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 32f7b7151797fed6074c786cba49b4c33920165c21f3da008166d37f16b4e6c7
MD5 2ce03baa439e4439c8ae175f19df770d
BLAKE2b-256 af491f42f258724699fc65369c96b37571afe9a10a693bfcedef436e0044d20d

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_silk_mcp-0.1.0-py3-none-any.whl:

Publisher: publish.yml on vintasoftware/django-silk-mcp

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