1a1254f045
CI - 构建、测试和质量检查 / Rust 代码检查 (push) Has been cancelled
CI - 构建、测试和质量检查 / 单元测试 (push) Has been cancelled
CI - 构建、测试和质量检查 / 代码格式检查 (push) Has been cancelled
CI - 构建、测试和质量检查 / Clippy 代码质量检查 (push) Has been cancelled
CI - 构建、测试和质量检查 / 构建可执行文件 (claude_code_rs, macos-latest, x86_64-apple-darwin) (push) Has been cancelled
CI - 构建、测试和质量检查 / 构建可执行文件 (claude_code_rs, ubuntu-latest, x86_64-unknown-linux-gnu) (push) Has been cancelled
CI - 构建、测试和质量检查 / 构建可执行文件 (claude_code_rs.exe, windows-latest, x86_64-pc-windows-msvc) (push) Has been cancelled
- 添加 Rust GUI 桌面应用程序入口点 - 添加 TypeScript/JavaScript 项目基础结构文件 - 包含组件、工具、命令、服务和工具定义 - 添加配置文件如 .gitignore、.gitattributes 和 LICENSE - 包含图片资源和演示文件 - 为各种功能模块添加占位符和类型定义
114 lines
2.6 KiB
TypeScript
114 lines
2.6 KiB
TypeScript
export type PermissionMode =
|
|
| 'ask'
|
|
| 'skip_all_permission_checks'
|
|
| 'follow_a_plan'
|
|
|
|
export type Logger = {
|
|
info(message: string): void
|
|
warn(message: string): void
|
|
error(message: string): void
|
|
}
|
|
|
|
export type ClaudeForChromeContext = {
|
|
serverName?: string
|
|
logger?: Logger
|
|
[key: string]: unknown
|
|
}
|
|
|
|
export const BROWSER_TOOLS: Array<{ name: string; description: string }> = [
|
|
{
|
|
name: 'navigate',
|
|
description: 'Navigate a browser tab to a URL.',
|
|
},
|
|
{
|
|
name: 'read_page',
|
|
description: 'Capture high-level page state from the active tab.',
|
|
},
|
|
{
|
|
name: 'get_page_text',
|
|
description: 'Read visible page text from the active tab.',
|
|
},
|
|
{
|
|
name: 'find',
|
|
description: 'Find a pattern within page content.',
|
|
},
|
|
{
|
|
name: 'form_input',
|
|
description: 'Fill or update form inputs in the page.',
|
|
},
|
|
{
|
|
name: 'computer',
|
|
description: 'Perform browser-scoped mouse and keyboard actions.',
|
|
},
|
|
{
|
|
name: 'javascript_tool',
|
|
description: 'Run page-scoped JavaScript in the browser tab.',
|
|
},
|
|
{
|
|
name: 'tabs_context_mcp',
|
|
description: 'List or inspect browser tabs.',
|
|
},
|
|
{
|
|
name: 'tabs_create_mcp',
|
|
description: 'Create a new browser tab.',
|
|
},
|
|
{
|
|
name: 'resize_window',
|
|
description: 'Resize the browser window.',
|
|
},
|
|
{
|
|
name: 'upload_image',
|
|
description: 'Upload an image into the current page flow.',
|
|
},
|
|
{
|
|
name: 'read_console_messages',
|
|
description: 'Read browser console messages.',
|
|
},
|
|
{
|
|
name: 'read_network_requests',
|
|
description: 'Read captured network requests.',
|
|
},
|
|
{
|
|
name: 'shortcuts_list',
|
|
description: 'List extension/browser shortcuts.',
|
|
},
|
|
{
|
|
name: 'shortcuts_execute',
|
|
description: 'Execute a configured extension/browser shortcut.',
|
|
},
|
|
{
|
|
name: 'gif_creator',
|
|
description: 'Create or manage simple browser recordings.',
|
|
},
|
|
{
|
|
name: 'update_plan',
|
|
description: 'Update an in-browser action plan.',
|
|
},
|
|
]
|
|
|
|
export function createClaudeForChromeMcpServer(context: ClaudeForChromeContext) {
|
|
let closed = false
|
|
const handlers = new Map<unknown, unknown>()
|
|
|
|
return {
|
|
async connect() {
|
|
context.logger?.warn(
|
|
'Claude in Chrome MCP is running with a restored compatibility shim; browser actions are not available in this workspace.',
|
|
)
|
|
},
|
|
setRequestHandler(schema: unknown, handler: unknown) {
|
|
handlers.set(schema, handler)
|
|
},
|
|
async close() {
|
|
closed = true
|
|
handlers.clear()
|
|
context.logger?.info(
|
|
'Claude in Chrome MCP shim closed.',
|
|
)
|
|
},
|
|
get isClosed() {
|
|
return closed
|
|
},
|
|
}
|
|
}
|