This guide explains how to configure @zereight/mcp-gitlab in VS Code using mcp.json.
VS Code supports two MCP configuration locations:
- Workspace:
.vscode/mcp.json - User profile: open the user
mcp.jsonfrom the Command Palette
Use workspace config when you want to share the MCP server with your team.
A secure workspace example using input prompts:
{
"inputs": [
{
"type": "promptString",
"id": "gitlab-token",
"description": "GitLab Personal Access Token",
"password": true
}
],
"servers": {
"gitlab": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@zereight/mcp-gitlab"],
"env": {
"GITLAB_PERSONAL_ACCESS_TOKEN": "${input:gitlab-token}",
"GITLAB_API_URL": "https://gitlab.com/api/v4",
"GITLAB_READ_ONLY_MODE": "false"
}
}
}
}A local OAuth example:
{
"inputs": [
{
"type": "promptString",
"id": "gitlab-oauth-client-id",
"description": "GitLab OAuth Client ID"
}
],
"servers": {
"gitlab": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@zereight/mcp-gitlab"],
"env": {
"GITLAB_USE_OAUTH": "true",
"GITLAB_OAUTH_CLIENT_ID": "${input:gitlab-oauth-client-id}",
"GITLAB_OAUTH_REDIRECT_URI": "http://127.0.0.1:8888/callback",
"GITLAB_API_URL": "https://gitlab.com/api/v4"
}
}
}
}If your GitLab OAuth app is confidential, add GITLAB_OAUTH_CLIENT_SECRET too.
VS Code resolves ${input:name} by looking up an entry in the top-level inputs array.
Example:
"GITLAB_PERSONAL_ACCESS_TOKEN": "${input:gitlab-token}"
means:
- find the input whose
idisgitlab-token - prompt the user for a value
- inject that value into the environment variable
If the inputs entry is missing or the id does not match exactly, the value will not resolve correctly.
When VS Code loads the server, you may need to trust it before it starts.
Useful actions:
MCP: List ServersMCP: Open Workspace Folder ConfigurationMCP: Open User ConfigurationMCP: Reset Trust
To inspect logs:
- open Chat
- select the MCP error notification if present
- choose Show Output
Use:
https://gitlab.com/api/v4
not:
https://gitlab.com
If you use ${input:gitlab-token}, you must also define an input with id: "gitlab-token".
In VS Code mcp.json, the top-level key is:
servers
not mcpServers.
The redirect URI in GitLab must exactly match the URI in your MCP config.
Prefer input variables or environment files over committing secrets in .vscode/mcp.json.