# MCP Workspace

This directory is used for **temporary working files** during MCP code execution.

## Purpose

When executing code to process data from MCP servers, this workspace provides a place to:

- Store intermediate results
- Cache frequently-used data
- Save processing outputs before returning to model
- Maintain state across operations

## Guidelines

- Files here are **temporary** and should not be committed to git
- Clean up files after operations complete
- Use descriptive filenames with timestamps if needed
- Maximum file size: 10MB recommended

## Common Use Cases

### 1. Cache Large Datasets

```typescript
// Fetch once, use multiple times
const bookings = await database.getBookings({ limit: 10000 });
await fs.writeFile("./workspace/bookings-cache.json", JSON.stringify(bookings));

// Later, read from cache
const cached = JSON.parse(
  await fs.readFile("./workspace/bookings-cache.json", "utf-8"),
);
```

### 2. Intermediate Processing

```typescript
// Process large dataset step-by-step
const raw = await gdrive.getSheet({ sheetId: "abc123" });
await fs.writeFile("./workspace/raw-data.json", JSON.stringify(raw));

const filtered = raw.filter((row) => row.status === "active");
await fs.writeFile("./workspace/filtered-data.json", JSON.stringify(filtered));

// Only return summary to model
console.log(`Processed ${raw.length} → ${filtered.length} rows`);
```

### 3. State Persistence

```typescript
// Track progress across operations
const progress = {
  processedIds: [...],
  failedIds: [...],
  lastProcessed: new Date().toISOString()
};
await fs.writeFile('./workspace/import-progress.json', JSON.stringify(progress));
```

## Cleanup

Files in this directory are not committed to git. They persist only during the development session and should be cleaned up periodically.
