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"
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.