FIXES_SUMMARY.md•5.78 kB
# MCP Server Fixes - Comprehensive Summary
**Date**: 2025-11-04
**Build Time**: 18:25
**Status**: ✅ All Fixes Complete & Verified
---
## Problem 1: Claude Code Crash (React Error #327)
### Root Cause
The network tools were passing **Zod schema objects directly** instead of JSON schemas in the `networkTools` array. This caused Claude Code's React UI to crash when trying to render the tool schemas.
**Error**: `Minified React error #327` - "Cannot read properties of undefined (reading 'codePointAt')"
**Why it crashed**:
```javascript
// BEFORE (Broken):
inputSchema: httpRequestSchema // This is a Zod object with _def, ~standard, etc.
// AFTER (Fixed):
inputSchema: {
type: 'object',
properties: { ... } // Plain JSON schema
}
```
### Solution
Replaced all Zod schema references with inline JSON schemas in `/src/tools/network.ts`
**Files Modified**:
- `src/tools/network.ts` (lines 659-789)
**Tools Fixed** (9 total):
1. ✅ `http_request` - Make HTTP/HTTPS requests
2. ✅ `http_download` - Download files from URLs
3. ✅ `http_health_check` - Check service health
4. ✅ `network_ping` - Ping hosts
5. ✅ `network_port_check` - Check if ports are open
6. ✅ `network_dns_lookup` - DNS lookups
7. ✅ `network_curl` - Advanced curl operations
8. ✅ `network_netstat` - Network connection stats
9. ✅ `network_traceroute` - Trace network routes
---
## Problem 2: Docker Compose V2 Detection
### Root Cause
System has Docker Compose V2 (`docker compose`) but code was hardcoded to use V1 syntax (`docker-compose`).
**Error**: `command not found: docker-compose`
### Solution
Added auto-detection that tries V2 first, falls back to V1, with caching for performance.
**Files Modified**:
- `src/tools/docker.ts` (lines 64-85, 301, 313, 325, 339)
**Implementation**:
```typescript
// Detection helper (lines 64-85)
async function getDockerComposeCommand(): Promise<string> {
try {
await execAsync('docker compose version', { timeout: 5000 });
return 'docker compose'; // V2
} catch {
return 'docker-compose'; // V1 fallback
}
}
// Cached for performance
let cachedDockerComposeCmd: string | null = null;
```
**Functions Updated** (4 total):
1. ✅ `dockerComposeUp` - Start containers
2. ✅ `dockerComposeDown` - Stop and remove containers
3. ✅ `dockerComposePs` - List compose stack containers
4. ✅ `dockerComposeLogs` - View compose stack logs
---
## Problem 3: Shell Working Directory Reset
### Status
✅ **Already Fixed** - No changes needed!
The shell tools (`shell_execute` and `shell_execute_streaming`) already support the `cwd` parameter properly.
**Location**: `src/tools/shell.ts` (lines 17, 26, 48, 104)
---
## Build & Verification
### Build Status
```bash
$ npm run build
> mcp-unrestricted-dev-server@1.0.0 build
> tsc
# Success - No errors
```
**Build Output**: `/home/connor-boetig/proj/mcp2/build/`
**Build Time**: Nov 4 18:25
### All Tool Modules Compiled
- ✅ filesystem.js (20K)
- ✅ shell.js (9.1K)
- ✅ docker.js (26K)
- ✅ git.js (33K)
- ✅ network.js (30K) ← **Fixed schemas**
- ✅ mongodb.js (624B - stub)
- ✅ process.js (406B - stub)
- ✅ index.js (main entry point)
### Server Test
```bash
$ node build/index.js <<< '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'
# Server starts successfully
# All tools load without errors
# Network tools show proper JSON schemas (not Zod objects)
```
---
## Complete Tool Inventory
### ✅ Filesystem Tools (10)
`fs_read_file`, `fs_write_file`, `fs_append_file`, `fs_delete_file`, `fs_list_directory`, `fs_create_directory`, `fs_delete_directory`, `fs_get_file_info`, `fs_move_file`, `fs_copy_file`
### ✅ Shell Tools (2)
`shell_execute` (with cwd support), `shell_execute_streaming`
### ✅ Docker Tools (16)
`docker_ps`, `docker_logs`, `docker_exec`, `docker_start`, `docker_stop`, `docker_restart`, `docker_inspect`, `docker_build`, `docker_images`, `docker_pull`, `docker_compose_up` (V2!), `docker_compose_down` (V2!), `docker_compose_ps` (V2!), `docker_compose_logs` (V2!), `docker_rm`, `docker_rmi`
### ✅ Git Tools (21)
`git_status`, `git_add`, `git_commit`, `git_diff`, `git_log`, `git_branch`, `git_checkout`, `git_pull`, `git_push`, `git_clone`, `git_init`, `git_merge`, `git_rebase`, `git_fetch`, `git_remote`, `git_stash`, `git_reset`, `git_revert`, `git_tag`, `git_show`, `git_config`
### ✅ Network/HTTP Tools (9) ← **FIXED**
`http_request`, `http_download`, `http_health_check`, `network_ping`, `network_port_check`, `network_dns_lookup`, `network_curl`, `network_netstat`, `network_traceroute`
### ⚠️ MongoDB Tools (Stubbed)
Not implemented yet - placeholder exists
### ⚠️ Process Tools (Stubbed)
Not implemented yet - placeholder exists
**Total**: 58 functional tools
---
## What's Next
### Immediate Testing
1. **Reconnect MCP server** to Claude Code
2. **Verify no crashes** when viewing tools (especially network tools)
3. **Test docker-compose** commands with FastAPI project at `/home/connor-boetig/proj/comp`
4. **Test network tools** against live APIs
### Test Commands
```bash
# Restart Claude Code to reload the MCP server
# Then in Claude Code session:
# Test network tool
"Use http_request to GET https://api.github.com/zen"
# Test docker-compose V2
"Use docker_compose_up with cwd /home/connor-boetig/proj/comp"
# Test shell cwd
"Use shell_execute to run 'pwd' with cwd /tmp"
```
---
## Summary
✅ **Fixed**: Network tool schemas (Zod → JSON) - **prevents Claude Code crash**
✅ **Fixed**: Docker Compose V2 auto-detection - **works on modern systems**
✅ **Verified**: Shell cwd support already working
✅ **Built**: All TypeScript compiled successfully
✅ **Tested**: Server starts and loads all tools correctly
**Ready to reconnect and test!** 🚀