Claude-Gemini Integration Tool 'CGMB' v1.1.0: Implementing Windows Support
Source: Dev.to
Overview
Version 1.1.0 of CGMB (Claude‑Gemini Multimodal Bridge) adds full Windows support, OCR for scanned PDFs, URL auto‑routing, and support for the latest Gemini models (gemini-3-flash, gemini-2.5-flash).
New Features in v1.1.0
| 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 Normalization
Background
- v1.0 only handled Unix‑style paths.
- Windows paths:
- Start with a drive letter (
C:,D:…) - Use backslashes (
\) as separators - May contain mixed forward slashes (
C:/Users/...)
- Start with a drive letter (
Implementation (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. - Slashes are unified before calling
path.normalize(). - The result of
path.isAbsolute()is combined with the Windows pattern detection.
Prompt‑Based Path Detection
// Regex to detect both Windows and 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) || [];
Usage examples
CGMB analyze C:\Users\name\Documents\report.pdf
CGMB analyze /home/user/documents/report.pdf
URL Auto‑Routing
The tool now determines the URL type and routes the request 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 Table
| 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
Version Comparison
| 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, gemini-2.5-flash |
Future Plans
- More advanced routing algorithms
- Quick support for new Gemini models
- Performance optimizations
Links
- GitHub:
- README:
- NPM:
Feedback and issues are welcome!