Loading...
Loading...
Compare original and translation side by side
.mcp.jsonexport SONARQUBE_TOKEN="squ_your_token"
export SONARQUBE_URL="https://sonarqube.mycompany.com" # or http://host.docker.internal:9000 for local Dockerexport SONARQUBE_TOKEN="squ_your_token"
export SONARQUBE_ORG="your-org-key" # required for SonarCloud.mcp.jsonexport SONARQUBE_TOKEN="squ_your_token"
export SONARQUBE_URL="https://sonarqube.mycompany.com" # 本地Docker实例请使用http://host.docker.internal:9000export SONARQUBE_TOKEN="squ_your_token"
export SONARQUBE_ORG="your-org-key" # SonarCloud必填
**Requirements:**
- Docker must be installed and running
- `SONARQUBE_TOKEN` is always required
- `SONARQUBE_URL` is required for SonarQube Server (use `host.docker.internal` for local instances)
- `SONARQUBE_ORG` is required for SonarCloud (omit `SONARQUBE_URL` in that case)
**要求:**
- 必须安装并运行Docker
- `SONARQUBE_TOKEN`为必填项
- SonarQube Server需要设置`SONARQUBE_URL`(本地实例请使用`host.docker.internal`)
- SonarCloud需要设置`SONARQUBE_ORG`(此时无需设置`SONARQUBE_URL`)# SonarQube Server
export SONARQUBE_TOKEN="squ_your_token"
export SONARQUBE_URL="https://sonarqube.mycompany.com"
# SonarCloud
export SONARQUBE_TOKEN="squ_your_token"
export SONARQUBE_ORG="your-org-key"mcp__sonarqube-mcp__<tool-name># SonarQube Server
export SONARQUBE_TOKEN="squ_your_token"
export SONARQUBE_URL="https://sonarqube.mycompany.com"
# SonarCloud
export SONARQUBE_TOKEN="squ_your_token"
export SONARQUBE_ORG="your-org-key"mcp__sonarqube-mcp__<tool-name>references/metrics.mdreferences/severity-levels.mdreferences/best-practices.mdreferences/llm-context.mdreferences/metrics.mdreferences/severity-levels.mdreferences/best-practices.mdreferences/llm-context.md| User Intent | Tool to Use |
|---|---|
| Check if project passes quality gate | |
| Find critical issues in a project | |
| Analyze code before committing | |
| Understand a flagged rule | |
| Get detailed project metrics | |
| Mark an issue as false positive | |
| 用户意图 | 要使用的工具 |
|---|---|
| 检查项目是否通过质量门 | |
| 在项目中查找严重问题 | |
| 提交前分析代码 | |
| 理解标记的规则 | |
| 获取项目详细指标 | |
| 将问题标记为误报 | |
get_project_quality_gate_statusprojectKeypullRequestanalysisIdNote: There is noparameter on this tool. Without abranchorpullRequest, the tool returns the quality gate status for the default branch.analysisId
{
"name": "get_project_quality_gate_status",
"arguments": {
"projectKey": "my-application"
}
}{
"name": "get_project_quality_gate_status",
"arguments": {
"projectKey": "backend-service",
"pullRequest": "456"
}
}status: "OK"status: "ERROR"conditionsmetricKeyactualValueerrorThresholdcomparatorreferences/metrics.mdget_project_quality_gate_statusprojectKeypullRequestanalysisId注意:该工具没有参数。如果未设置branch或pullRequest,工具将返回默认分支的质量门状态。analysisId
{
"name": "get_project_quality_gate_status",
"arguments": {
"projectKey": "my-application"
}
}{
"name": "get_project_quality_gate_status",
"arguments": {
"projectKey": "backend-service",
"pullRequest": "456"
}
}status: "OK"status: "ERROR"conditionsmetricKeyactualValueerrorThresholdcomparatorreferences/metrics.mdsearch_sonar_issues_in_projectsprojectsseveritiesBLOCKERHIGHMEDIUMLOWINFOpullRequestIdpps{
"name": "search_sonar_issues_in_projects",
"arguments": {
"projects": ["my-backend", "my-frontend"],
"severities": ["BLOCKER", "HIGH"],
"p": 1,
"ps": 50
}
}{
"name": "search_sonar_issues_in_projects",
"arguments": {
"projects": ["my-service"],
"pullRequestId": "123",
"severities": ["HIGH", "MEDIUM"],
"p": 1,
"ps": 100
}
}change_sonar_issue_status{
"name": "change_sonar_issue_status",
"arguments": {
"key": "AY1234",
"status": "falsepositive",
"comment": "This pattern is safe in our context because..."
}
}falsepositiveacceptreopenAlways present the list of issues to the user before changing their status. Never autonomously mark issues as false positives without explicit user confirmation.
search_sonar_issues_in_projectsprojectsseveritiesBLOCKERHIGHMEDIUMLOWINFOpullRequestIdpps{
"name": "search_sonar_issues_in_projects",
"arguments": {
"projects": ["my-backend", "my-frontend"],
"severities": ["BLOCKER", "HIGH"],
"p": 1,
"ps": 50
}
}{
"name": "search_sonar_issues_in_projects",
"arguments": {
"projects": ["my-service"],
"pullRequestId": "123",
"severities": ["HIGH", "MEDIUM"],
"p": 1,
"ps": 100
}
}change_sonar_issue_status{
"name": "change_sonar_issue_status",
"arguments": {
"key": "AY1234",
"status": "falsepositive",
"comment": "在我们的场景中该模式是安全的,原因是..."
}
}falsepositiveacceptreopen在更改问题状态前,务必先向用户展示问题列表。未经用户明确确认,切勿自主将问题标记为误报。
analyze_code_snippetprojectKeyfileContentlanguagecodeSnippetfileContentjavascripttypescriptpythonjavagophpcscppkotlinrubyscalaswift{
"name": "analyze_code_snippet",
"arguments": {
"projectKey": "my-typescript-app",
"fileContent": "async function fetchUser(id: string) {\n const query = `SELECT * FROM users WHERE id = ${id}`;\n return db.execute(query);\n}",
"language": "typescript"
}
}{
"name": "analyze_code_snippet",
"arguments": {
"projectKey": "my-python-service",
"fileContent": "import pickle\n\ndef load_model(path):\n with open(path, 'rb') as f:\n return pickle.load(f)",
"language": "python"
}
}ruleKeyCRITICALHIGHshow_ruleruleKeyanalyze_code_snippetprojectKeyfileContentlanguagecodeSnippetfileContentjavascripttypescriptpythonjavagophpcscppkotlinrubyscalaswift{
"name": "analyze_code_snippet",
"arguments": {
"projectKey": "my-typescript-app",
"fileContent": "async function fetchUser(id: string) {\n const query = `SELECT * FROM users WHERE id = ${id}`;\n return db.execute(query);\n}",
"language": "typescript"
}
}{
"name": "analyze_code_snippet",
"arguments": {
"projectKey": "my-python-service",
"fileContent": "import pickle\n\ndef load_model(path):\n with open(path, 'rb') as f:\n return pickle.load(f)",
"language": "python"
}
}ruleKeyCRITICALHIGHshow_ruleruleKeyshow_rulekey<language>:<rule-id>typescript:S1082java:S2068{
"name": "show_rule",
"arguments": {
"key": "typescript:S1082"
}
}cweowasp-a2show_rulekey<language>:<rule-id>typescript:S1082java:S2068{
"name": "show_rule",
"arguments": {
"key": "typescript:S1082"
}
}cweowasp-a2get_component_measuresprojectKeypullRequestmetricKeyscoveragebugsvulnerabilitiescode_smellscomplexitycognitive_complexitynclocduplicated_lines_densitynew_coveragenew_bugs{
"name": "get_component_measures",
"arguments": {
"projectKey": "my-project-key",
"metricKeys": ["coverage", "bugs", "vulnerabilities", "code_smells", "ncloc"]
}
}references/metrics.mdget_component_measuresprojectKeypullRequestmetricKeyscoveragebugsvulnerabilitiescode_smellscomplexitycognitive_complexitynclocduplicated_lines_densitynew_coveragenew_bugs{
"name": "get_component_measures",
"arguments": {
"projectKey": "my-project-key",
"metricKeys": ["coverage", "bugs", "vulnerabilities", "code_smells", "ncloc"]
}
}references/metrics.mdbackend-api{
"name": "get_project_quality_gate_status",
"arguments": {
"projectKey": "backend-api",
"pullRequest": "234"
}
}search_sonar_issues_in_projectsbackend-api{
"name": "get_project_quality_gate_status",
"arguments": {
"projectKey": "backend-api",
"pullRequest": "234"
}
}search_sonar_issues_in_projects{
"name": "analyze_code_snippet",
"arguments": {
"projectKey": "my-go-service",
"fileContent": "func handler(w http.ResponseWriter, r *http.Request) {\n id := r.URL.Query().Get(\"id\")\n query := fmt.Sprintf(\"SELECT * FROM orders WHERE id = %s\", id)\n rows, _ := db.Query(query)\n // ...\n}",
"language": "go"
}
}show_ruleruleKey{
"name": "analyze_code_snippet",
"arguments": {
"projectKey": "my-go-service",
"fileContent": "func handler(w http.ResponseWriter, r *http.Request) {\n id := r.URL.Query().Get(\"id\")\n query := fmt.Sprintf(\"SELECT * FROM orders WHERE id = %s\", id)\n rows, _ := db.Query(query)\n // ...\n}",
"language": "go"
}
}show_ruleruleKeypayment-service{
"name": "search_sonar_issues_in_projects",
"arguments": {
"projects": ["payment-service"],
"severities": ["BLOCKER"],
"p": 1,
"ps": 50
}
}show_rulepayment-service{
"name": "search_sonar_issues_in_projects",
"arguments": {
"projects": ["payment-service"],
"severities": ["BLOCKER"],
"p": 1,
"ps": 50
}
}show_ruleget_project_quality_gate_statusanalyze_code_snippetshow_ruleppschange_sonar_issue_statuslanguageanalyze_code_snippetget_project_quality_gate_statusanalyze_code_snippetshow_ruleppschange_sonar_issue_statusanalyze_code_snippetlanguageanalyze_code_snippetreferences/llm-context.mdpaging.totalpaging.pageSizeanalyze_code_snippetreferences/llm-context.mdpaging.totalpaging.pageSize