Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/xcode_index_mcp/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,10 @@ async def connect(self):
"""Connect to the Swift MCP service."""
if not self.reader or not self.writer:
try:
self.reader, self.writer = await asyncio.open_connection(self.host, self.port)
## Increase limit to 1MB for large JSON responses
self.reader, self.writer = await asyncio.open_connection(
self.host, self.port, limit=1024*1024
)
logger.info("Connected to Swift service")
except Exception as e:
raise McpError(
Expand Down Expand Up @@ -233,8 +236,11 @@ async def load_index(projectName: str) -> bool:
logger.info(f"Loading index for project: {projectName}")
try:
result = await swift_service.send_request("is_available", {"projectName": projectName})
logger.error(f"Request sent successfully: {result}")
return result
# Extract available boolean from the nested result structure
if isinstance(result, dict) and result.get("type") == "status":
value = result.get("value", {})
return value.get("available", False)
return False
except Exception as e:
logger.error(f"Failed to load index for project '{projectName}': {str(e)}")
raise McpError(
Expand Down
2 changes: 1 addition & 1 deletion swift-service/Sources/TCPServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class TCPServer {
}

private func handleClient(_ clientSocket: Int32) {
var buffer = [UInt8](repeating: 0, count: 1024)
var buffer = [UInt8](repeating: 0, count: 65536)

while true {
let bytesRead = read(clientSocket, &buffer, buffer.count)
Expand Down