Skip to content

Commit 1346f12

Browse files
committed
MCP checkbox for always allow
1 parent 6ee118e commit 1346f12

File tree

26 files changed

+744
-22
lines changed

26 files changed

+744
-22
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Roo Cline Changelog
22

3+
## [2.2.2]
4+
5+
- Add checkboxes to auto-approve MCP tools
6+
37
## [2.2.1]
48

59
- Fix another diff editing indentation bug

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Roo-Cline
22

3-
A fork of Cline, an autonomous coding agent, with some added experimental configuration and automation features.
3+
A fork of Cline, an autonomous coding agent, optimized for speed and flexibility.
44
- Auto-approval capabilities for commands, write, and browser operations
55
- Support for .clinerules per-project custom instructions
66
- Ability to run side-by-side with Cline
@@ -10,6 +10,7 @@ A fork of Cline, an autonomous coding agent, with some added experimental config
1010
- Support for copying prompts from the history screen
1111
- Support for editing through diffs / handling truncated full-file edits
1212
- Support for newer Gemini models (gemini-exp-1206 and gemini-2.0-flash-exp)
13+
- Support for auto-approving MCP tools
1314

1415
## Disclaimer
1516

jest.config.js

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,35 @@ module.exports = {
55
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
66
transform: {
77
'^.+\\.tsx?$': ['ts-jest', {
8-
tsconfig: 'tsconfig.json'
8+
tsconfig: {
9+
"module": "CommonJS",
10+
"moduleResolution": "node",
11+
"esModuleInterop": true,
12+
"allowJs": true
13+
}
914
}]
1015
},
1116
testMatch: ['**/__tests__/**/*.test.ts'],
1217
moduleNameMapper: {
13-
'^vscode$': '<rootDir>/node_modules/@types/vscode/index.d.ts'
18+
'^vscode$': '<rootDir>/src/__mocks__/vscode.js',
19+
'@modelcontextprotocol/sdk$': '<rootDir>/src/__mocks__/@modelcontextprotocol/sdk/index.js',
20+
'@modelcontextprotocol/sdk/(.*)': '<rootDir>/src/__mocks__/@modelcontextprotocol/sdk/$1',
21+
'^delay$': '<rootDir>/src/__mocks__/delay.js',
22+
'^p-wait-for$': '<rootDir>/src/__mocks__/p-wait-for.js',
23+
'^globby$': '<rootDir>/src/__mocks__/globby.js',
24+
'^serialize-error$': '<rootDir>/src/__mocks__/serialize-error.js',
25+
'^strip-ansi$': '<rootDir>/src/__mocks__/strip-ansi.js',
26+
'^default-shell$': '<rootDir>/src/__mocks__/default-shell.js',
27+
'^os-name$': '<rootDir>/src/__mocks__/os-name.js'
1428
},
29+
transformIgnorePatterns: [
30+
'node_modules/(?!(@modelcontextprotocol|delay|p-wait-for|globby|serialize-error|strip-ansi|default-shell|os-name)/)'
31+
],
1532
setupFiles: [],
1633
globals: {
1734
'ts-jest': {
18-
diagnostics: false
35+
diagnostics: false,
36+
isolatedModules: true
1937
}
2038
}
2139
};
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class Client {
2+
constructor() {
3+
this.request = jest.fn()
4+
}
5+
6+
connect() {
7+
return Promise.resolve()
8+
}
9+
10+
close() {
11+
return Promise.resolve()
12+
}
13+
}
14+
15+
module.exports = {
16+
Client
17+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
class StdioClientTransport {
2+
constructor() {
3+
this.start = jest.fn().mockResolvedValue(undefined)
4+
this.close = jest.fn().mockResolvedValue(undefined)
5+
this.stderr = {
6+
on: jest.fn()
7+
}
8+
}
9+
}
10+
11+
class StdioServerParameters {
12+
constructor() {
13+
this.command = ''
14+
this.args = []
15+
this.env = {}
16+
}
17+
}
18+
19+
module.exports = {
20+
StdioClientTransport,
21+
StdioServerParameters
22+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const { Client } = require('./client/index.js')
2+
const { StdioClientTransport, StdioServerParameters } = require('./client/stdio.js')
3+
const {
4+
CallToolResultSchema,
5+
ListToolsResultSchema,
6+
ListResourcesResultSchema,
7+
ListResourceTemplatesResultSchema,
8+
ReadResourceResultSchema,
9+
ErrorCode,
10+
McpError
11+
} = require('./types.js')
12+
13+
module.exports = {
14+
Client,
15+
StdioClientTransport,
16+
StdioServerParameters,
17+
CallToolResultSchema,
18+
ListToolsResultSchema,
19+
ListResourcesResultSchema,
20+
ListResourceTemplatesResultSchema,
21+
ReadResourceResultSchema,
22+
ErrorCode,
23+
McpError
24+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
const CallToolResultSchema = {
2+
parse: jest.fn().mockReturnValue({})
3+
}
4+
5+
const ListToolsResultSchema = {
6+
parse: jest.fn().mockReturnValue({
7+
tools: []
8+
})
9+
}
10+
11+
const ListResourcesResultSchema = {
12+
parse: jest.fn().mockReturnValue({
13+
resources: []
14+
})
15+
}
16+
17+
const ListResourceTemplatesResultSchema = {
18+
parse: jest.fn().mockReturnValue({
19+
resourceTemplates: []
20+
})
21+
}
22+
23+
const ReadResourceResultSchema = {
24+
parse: jest.fn().mockReturnValue({
25+
contents: []
26+
})
27+
}
28+
29+
const ErrorCode = {
30+
InvalidRequest: 'InvalidRequest',
31+
MethodNotFound: 'MethodNotFound',
32+
InvalidParams: 'InvalidParams',
33+
InternalError: 'InternalError'
34+
}
35+
36+
class McpError extends Error {
37+
constructor(code, message) {
38+
super(message)
39+
this.code = code
40+
}
41+
}
42+
43+
module.exports = {
44+
CallToolResultSchema,
45+
ListToolsResultSchema,
46+
ListResourcesResultSchema,
47+
ListResourceTemplatesResultSchema,
48+
ReadResourceResultSchema,
49+
ErrorCode,
50+
McpError
51+
}

src/__mocks__/McpHub.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
export class McpHub {
2+
connections = []
3+
isConnecting = false
4+
5+
constructor() {
6+
this.toggleToolAlwaysAllow = jest.fn()
7+
this.callTool = jest.fn()
8+
}
9+
10+
async toggleToolAlwaysAllow(serverName: string, toolName: string, shouldAllow: boolean): Promise<void> {
11+
return Promise.resolve()
12+
}
13+
14+
async callTool(serverName: string, toolName: string, toolArguments?: Record<string, unknown>): Promise<any> {
15+
return Promise.resolve({ result: 'success' })
16+
}
17+
}

src/__mocks__/default-shell.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Mock default shell based on platform
2+
const os = require('os');
3+
4+
let defaultShell;
5+
if (os.platform() === 'win32') {
6+
defaultShell = 'cmd.exe';
7+
} else {
8+
defaultShell = '/bin/bash';
9+
}
10+
11+
module.exports = defaultShell;
12+
module.exports.default = defaultShell;

src/__mocks__/delay.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
function delay(ms) {
2+
return new Promise(resolve => setTimeout(resolve, ms));
3+
}
4+
5+
module.exports = delay;
6+
module.exports.default = delay;

0 commit comments

Comments
 (0)