You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The server automatically detects `DJANGO_SETTINGS_MODULE` from your environment. You can override it with `--settings` or add to your Python path with `--pythonpath`:
The server automatically detects `DJANGO_SETTINGS_MODULE` from your environment. You can override it with `--settings` or add to your Python path with `--pythonpath`.
93
-
94
-
There's also a Django management command if you prefer, but that requires adding mcp-django to `INSTALLED_APPS`:
89
+
**Using the management command** (requires adding `mcp_django` to `INSTALLED_APPS`):
95
90
96
91
```bash
97
92
python manage.py mcp
98
93
```
99
94
100
-
### Transport
95
+
### Docker
96
+
97
+
If you're using Docker and Docker Compose, you can run mcp-django as a separate compose service using HTTP transport. This makes it easier to connect your MCP client (running on your host) to the Django project (running in a container):
Configure your MCP client using one of the examples below. The command is the same for all clients, just expressed in annoyingly different JSON soup.
133
+
Configure your MCP client to connect to the server.
118
134
119
135
Don't see your client? [Submit a PR](CONTRIBUTING.md) with setup instructions.
120
136
121
-
### Claude Code
137
+
#### Opencode
138
+
139
+
For **local development**, use `type: local` with the command:
122
140
123
141
```json
124
142
{
125
-
"mcpServers": {
143
+
"$schema": "https://opencode.ai/config.json",
144
+
"mcp": {
126
145
"django": {
127
-
"command": "python",
128
-
"args": ["-m", "mcp_django"],
129
-
"cwd": "/path/to/your/django/project",
130
-
"env": {
146
+
"type": "local",
147
+
"command": ["python", "-m", "mcp_django"],
148
+
"enabled": true,
149
+
"environment": {
131
150
"DJANGO_SETTINGS_MODULE": "myproject.settings"
132
151
}
133
152
}
134
153
}
135
154
}
136
155
```
137
156
138
-
### Opencode
157
+
For **Docker development**, use `type: remote` with the URL:
139
158
140
159
```json
141
160
{
142
161
"$schema": "https://opencode.ai/config.json",
143
162
"mcp": {
144
163
"django": {
145
-
"type": "local",
146
-
"command": ["python", "-m", "mcp_django"],
147
-
"enabled": true,
148
-
"environment": {
164
+
"type": "remote",
165
+
"url": "http://localhost:8001/mcp",
166
+
"enabled": true
167
+
}
168
+
}
169
+
}
170
+
```
171
+
172
+
#### Claude Code
173
+
174
+
For **local development**, use the command configuration:
175
+
176
+
```json
177
+
{
178
+
"mcpServers": {
179
+
"django": {
180
+
"command": "python",
181
+
"args": ["-m", "mcp_django"],
182
+
"cwd": "/path/to/your/django/project",
183
+
"env": {
149
184
"DJANGO_SETTINGS_MODULE": "myproject.settings"
150
185
}
151
186
}
152
187
}
153
188
}
154
189
```
155
190
191
+
For **Docker development** with HTTP/SSE transport, configuration varies by Claude Code version - consult the MCP client documentation for remote server setup.
192
+
156
193
## Features
157
194
158
195
mcp-django provides an MCP server with Django project exploration resources and tools for LLM assistants.
0 commit comments