Model Context Protocol (MCP)
Model Context Protocol (MCP) is a protocol that enables complex AI interactions, and tool execution on your behalf, inside and outside of Visual Studio Code. It allows you to interact with AI models and tools in a more natural and intuitive way, without the need for manual coding or configuration.
Step-by-Step: Setting Up MCP in DBCode
1. Review Your MCP Settings
Before starting, make sure your settings are configured correctly:
- Open DBCode MCP Settings
- Default port is
5002
- Set the authentication method:
None
→ no auth requiredQuerystring
→ you must include a?auth=YOUR_SECRET_TOKEN
in the URLBearer
→ include aAuthorization: Bearer YOUR_SECRET_TOKEN
header (less common)
2. Start the MCP Server
Open the command palette (F1
or Cmd/Ctrl + Shift + P
) and run:
DBCode: MCP Start Server
This starts the local MCP server at:
http://localhost:5002/sse
You’re now ready to connect a tool to DBCode.
3. Connect a Client to MCP
MCP clients connect to the server in one of two ways, depending on their capabilities:
Clients Supporting SSE/HTTP
Clients that support SSE/HTTP can connect directly to the DBCode MCP server using SSE/HTTP. These clients typically need:
- The MCP server URL:
http://localhost:5002/sse
- Your authentication token (if authentication is configured). You can generate a token using the command palette:
DBCode: MCP Generate Authorization Token
.
Consult your client’s documentation for specific instructions on where to configure the MCP server URL and authentication token.
Some clients may not have a specific authentication configuration, the querystring authentication method allows the token to be included in the URL. For example:
http://localhost:5002/sse?auth=YOUR_SECRET_TOKEN
Clients Supporting Only stdio
Some AI systems only support stdio for MCP communication rather than SSE/HTTP. For these, use SuperGateway as an adapter.
Rather than running SuperGateway yourself, you’ll typically provide the command to your client as part of its MCP configuration.
When configuring your stdio-only client, you’ll be asked to provide a command.
Use one of these SuperGateway commands based on your authentication method:
For Query String Authentication:
npx -y supergateway --sse "http://localhost:5002/sse?auth=YOUR_SECRET_TOKEN"
For Bearer Token Authentication:
npx -y supergateway --sse "http://localhost:5002/sse" --oauth2Bearer "YOUR_SECRET_TOKEN"
For No Authentication (not recommend):
npx -y @supercorp/supergateway --sse "http://localhost:5002/sse"
Using Docker:
If you prefer to run SuperGateway in Docker, you can use these commands:
For Query String Authentication:
docker run -i --rm supercorp/supergateway --sse "http://host.docker.internal:5002/sse?auth=YOUR_SECRET_TOKEN"
For Bearer Token Authentication:
docker run -i --rm supercorp/supergateway --sse "http://host.docker.internal:5002/sse" --oauth2Bearer "YOUR_SECRET_TOKEN"
For No Authentication:
docker run -i --rm supercorp/supergateway --sse "http://host.docker.internal:5002/sse"
Note: host.docker.internal
allows the Docker container to access services running on your host machine.
Consult your client’s documentation for specific instructions on where to enter this command in the client’s MCP configuration settings.
To generate a token, use the command palette: DBCode: MCP Generate Authorization Token
. This will create a new token for you to use.
4. Stopping the MCP Server
When finished, stop the server using the command palette:
DBCode: MCP Stop Server
Authentication Methods
The MCP server supports different authentication methods:
Bearer Token Authentication
The MCP client includes a bearer token in the request headers.
Query String Authentication
The MCP client includes a query parameter in the URL. For example:
http://localhost:5002/sse?auth=YOUR_SECRET_TOKEN
No Authentication
No authentication required. Use only for development and testing purposes.
Example Client Configurations
Cursor
Cursor supports MCP through JSON configuration files. You can configure DBCode’s MCP server in two ways:
Project-Specific Configuration
Create a .cursor/mcp.json
file in your project directory:
Using SSE (Direct Connection):
{ "mcpServers": { "dbcode": { "url": "http://localhost:5002/sse?auth=YOUR_SECRET_TOKEN" } }}
Using SuperGateway (stdio):
{ "mcpServers": { "dbcode": { "command": "npx", "args": [ "-y", "supergateway", "--sse", "http://localhost:5002/sse?auth=YOUR_SECRET_TOKEN" ] } }}
Global Configuration
Create a ~/.cursor/mcp.json
file in your home directory:
{ "mcpServers": { "dbcode": { "command": "npx", "args": [ "-y", "supergateway", "--sse", "http://localhost:5002/sse?auth=YOUR_SECRET_TOKEN" ] } }}
Using Docker with Cursor
For Docker-based setups, use this configuration:
{ "mcpServers": { "dbcode": { "command": "docker", "args": [ "run", "-i", "--rm", "supercorp/supergateway", "--sse", "http://host.docker.internal:5002/sse?auth=YOUR_SECRET_TOKEN" ] } }}
With Bearer Token Authentication
If you’re using bearer token authentication instead of query string:
{ "mcpServers": { "dbcode": { "command": "npx", "args": [ "-y", "supergateway", "--sse", "http://localhost:5002/sse", "--oauth2Bearer", "YOUR_SECRET_TOKEN" ] } }}
Without Authentication (Development Only)
For development environments without authentication:
{ "mcpServers": { "dbcode": { "command": "npx", "args": [ "-y", "supergateway", "--sse", "http://localhost:5002/sse" ] } }}
Notes:
- Replace
YOUR_SECRET_TOKEN
with the actual token generated using theDBCode: MCP Generate Authorization Token
command. - The SSE (direct connection) and stdio (SuperGateway) configurations can be used interchangeably in the above examples.
For more information about MCP configuration in Cursor, see the official Cursor MCP documentation.