I've released v1.1.0 of "CGMB," an MCP tool that integrates Claude Code and Gemini.
Previous article: Bridging Claude and Gemini: Creating the Multimodal Integration Tool "CGMB"
What You'll Learn
- 4 new features added in v1.1.0
- Implementation details of Windows path normalization
- How URL auto-routing works
v1.1.0 New Features
| Feature | Description | Status |
|---|---|---|
| πͺ Windows Support | Path normalization & drive letter handling | β Full Support |
| π OCR Feature | Scanned PDF support | β New |
| π URL Auto-Routing | Layer selection by URL type | β New |
| π Latest Models | gemini-3-flash, gemini-2.5-flash | β Supported |
Windows Path Implementation
The Challenge
v1.0 only supported Unix paths, but Windows paths have these characteristics:
- Start with a drive letter (
C:,D:, etc.) - Use backslash (
\) as separator - May have mixed forward slashes (
C:/Users/...)
Node.js's path.isAbsolute() can correctly determine Windows paths, but cannot handle mixed slashes.
Implementation
Handled in the validateAndNormalize method of CGMBServer.ts:
// Detect Windows absolute path pattern (case-insensitive)
const isWindowsAbsolutePath = /^[A-Za-z]:[/\\]/.test(filePath);
if (isWindows && isWindowsAbsolutePath) {
// Normalize forward slashes to backslashes
preprocessedPath = filePath.replace(/\//g, '\\');
}
const normalizedPath = path.normalize(preprocessedPath);
// Absolute path detection (considering Windows pattern)
const isAbsolute = path.isAbsolute(normalizedPath) || isWindowsAbsolutePath;
const resolvedPath = isAbsolute
? normalizedPath
: path.resolve(baseDir, normalizedPath);
Key Points:
- Regex
/^[A-Za-z]:[/\\]/detects drive letters - Unify slashes before
path.normalize()normalization - Combine
path.isAbsolute()result with Windows pattern detection
File Path Extraction from Prompts
v1.1.0 automatically detects file paths written in prompts.
// Regex to detect both Windows + Unix paths
const filePathRegex = /(?:[A-Za-z]:\\[^\s"'<>|]+\.[a-zA-Z0-9]+|\/(?!https?:)[^\s"'<>|]+\.[a-zA-Z0-9]+|\.\.?\/[^\s"'<>|]+\.[a-zA-Z0-9]+)/gi;
const localPathsInPrompt = prompt.match(filePathRegex) || [];
This enables usage like:
CGMB analyze C:\Users\name\Documents\report.pdf
CGMB analyze /home/user/documents/report.pdf
URL Auto-Routing
Determines URL type and automatically routes to the optimal AI layer.
private detectUrlType(url: string): 'pdf' | 'image' | 'audio' | 'web' {
const lower = url.toLowerCase();
const urlPath = lower.split('?')[0] ?? lower;
if (urlPath.endsWith('.pdf') || lower.includes('/pdf')) {
return 'pdf';
}
if (/\.(png|jpg|jpeg|gif|webp|bmp|svg)$/.test(urlPath)) {
return 'image';
}
if (/\.(mp3|wav|m4a|ogg|flac|aac)$/.test(urlPath)) {
return 'audio';
}
return 'web';
}
Routing Destinations
| URL Type | Destination | Reason |
|---|---|---|
| AI Studio | OCR processing via Gemini File API | |
| Images/Audio | AI Studio | Multimodal processing |
| Web Pages | Gemini CLI | Real-time information retrieval |
Installation & Upgrade
# New installation
npm install -g claude-gemini-multimodal-bridge
# Upgrade
npm update -g claude-gemini-multimodal-bridge
Improvements from v1.0.0
| Item | v1.0.0 | v1.1.0 |
|---|---|---|
| Windows Support | β Unix only | β Full support |
| OCR Feature | β None | β Scanned PDF support |
| URL Routing | Basic | β Type-based auto-selection |
| Gemini Models | gemini-2.0-flash | β gemini-3-flash support |
Future Plans
- More advanced routing algorithms
- Quick support for new Gemini models
- Performance optimization
Links
- GitHub: https://github.com/goodaymmm/claude-gemini-multimodal-bridge
- README: https://github.com/goodaymmm/claude-gemini-multimodal-bridge/blob/main/README.md
- NPM: https://www.npmjs.com/package/claude-gemini-multimodal-bridge
Feedback and Issues are welcome!
Top comments (0)