Skip to content

Commit d3f3774

Browse files
Merge pull request #132 from codacy/fix-vscode-mcp
fix: instruct user what to do in case they use VSCode and MCP isn't working CF-1841
2 parents 0a32924 + 00de283 commit d3f3774

1 file changed

Lines changed: 23 additions & 6 deletions

File tree

src/commands/configureMCP.ts

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,7 @@ const newRulesTemplate = (params?: RepositoryParams, excludedScopes?: ('guardrai
9797

9898
const commonRules: Rule[] = [
9999
{
100-
when: 'Trying to call a tool that needs a rootPath as a parameter',
101-
enforce: ['Always use the standard, non-URL-encoded file system path'],
102-
scope: 'guardrails',
103-
},
104-
{
105-
when: 'After ANY successful `edit_file` or `reapply` operation',
100+
when: 'CRITICAL: After ANY successful `edit_file` or `reapply` operation',
106101
enforce: [
107102
"YOU MUST IMMEDIATELY run the `codacy_cli_analyze` tool from Codacy's MCP Server for each file that was edited, with:",
108103
'- `rootPath`: set to the workspace path',
@@ -113,6 +108,28 @@ const newRulesTemplate = (params?: RepositoryParams, excludedScopes?: ('guardrai
113108
],
114109
scope: 'guardrails',
115110
},
111+
{
112+
when: 'After every response',
113+
enforce: [
114+
"If you made any file edits in this conversation, verify you ran `codacy_cli_analyze` tool from Codacy's MCP Server ",
115+
],
116+
scope: 'guardrails',
117+
},
118+
{
119+
when: 'When there are no Codacy MCP Server tools available, or the MCP Server is not reachable',
120+
enforce: [
121+
'Suggest the user the following troubleshooting steps:',
122+
'- Try to reset the MCP on the extension',
123+
'- If the user is using VSCode, suggest them to review their Copilot > MCP settings in Github, under their organization or personal account. Refer them to Settings > Copilot > Enable MCP servers in Copilot. Suggested URL (https://github.com/settings/copilot/features) or https://github.com/organizations/{organization-name}/settings/copilot/features (This can only be done by their organization admins / owners)',
124+
'If none of the above steps work, suggest the user to contact Codacy support',
125+
],
126+
scope: 'guardrails',
127+
},
128+
{
129+
when: 'Trying to call a tool that needs a rootPath as a parameter',
130+
enforce: ['Always use the standard, non-URL-encoded file system path'],
131+
scope: 'guardrails',
132+
},
116133
{
117134
when: 'CRITICAL: Dependencies and Security Checks',
118135
enforce: [

0 commit comments

Comments
 (0)