MCP server exposing django-silk profiling data as AI assistant tools
Project description
django-silk-mcp
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.
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. The MCP server runs as part of your Django app — no separate process needed, it shares the same port as your dev server. Then configure your MCP client:
Claude Code:
claude mcp add silk-mcp --transport http http://localhost:8000/silk/mcp
Cursor: Go to Settings → Toos & MCPs → New MCP Server and add a new server with the following configuration:
{
"mcpServers": {
"silk-mcp": {
"url": "http://localhost:8000/silk/mcp"
}
}
}
The same URL works with any MCP-compatible AI tool.
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/"
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
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_silk_mcp-0.1.5.tar.gz.
File metadata
- Download URL: django_silk_mcp-0.1.5.tar.gz
- Upload date:
- Size: 19.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
323701b7efa315ee4a63484641e29c190ad32b90c233339e118896ce0ec3ddbb
|
|
| MD5 |
e44fb8e423b4c4625330e4ee5f43e98c
|
|
| BLAKE2b-256 |
eccd58921f458ff5682af465bfa13e44d5604b6c6d87b367b1f6e54f24eb3366
|
Provenance
The following attestation bundles were made for django_silk_mcp-0.1.5.tar.gz:
Publisher:
publish.yml on vintasoftware/django-silk-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_silk_mcp-0.1.5.tar.gz -
Subject digest:
323701b7efa315ee4a63484641e29c190ad32b90c233339e118896ce0ec3ddbb - Sigstore transparency entry: 1279830512
- Sigstore integration time:
-
Permalink:
vintasoftware/django-silk-mcp@73e3efad153a7465fd6ff3f40edcef25bc6b343c -
Branch / Tag:
refs/tags/0.1.5 - Owner: https://github.com/vintasoftware
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@73e3efad153a7465fd6ff3f40edcef25bc6b343c -
Trigger Event:
release
-
Statement type:
File details
Details for the file django_silk_mcp-0.1.5-py3-none-any.whl.
File metadata
- Download URL: django_silk_mcp-0.1.5-py3-none-any.whl
- Upload date:
- Size: 26.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
970cb88120068c12656ad845ba4fec0758befe19bcaf19a651809df5e7164110
|
|
| MD5 |
02efacf68dac95ab59cd6d14b2d8e341
|
|
| BLAKE2b-256 |
b334b52fae01b4e8883669ac053ef9e0428f37c1606d3cfc5f9caeabd329dd4b
|
Provenance
The following attestation bundles were made for django_silk_mcp-0.1.5-py3-none-any.whl:
Publisher:
publish.yml on vintasoftware/django-silk-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_silk_mcp-0.1.5-py3-none-any.whl -
Subject digest:
970cb88120068c12656ad845ba4fec0758befe19bcaf19a651809df5e7164110 - Sigstore transparency entry: 1279830523
- Sigstore integration time:
-
Permalink:
vintasoftware/django-silk-mcp@73e3efad153a7465fd6ff3f40edcef25bc6b343c -
Branch / Tag:
refs/tags/0.1.5 - Owner: https://github.com/vintasoftware
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@73e3efad153a7465fd6ff3f40edcef25bc6b343c -
Trigger Event:
release
-
Statement type: