> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scoutcode.live/llms.txt
> Use this file to discover all available pages before exploring further.

# Examples

## Cross-Codebase Context

#### Context

Frontend teams often need to reference backend APIs and data models.
Tools like Cursor can infer this automatically, but they must grep, read, and analyze large portions of the backend repo every time — which increases token usage, latency, and cost.

***

#### What Scout Code Does

Scout Code indexes your backend repo and exposes it as an **MCP server**.
Cursor (or any MCP client) can then query structured repo context instantly, without re-reading source files.

***

#### Example

**Backend (fruit-service)**

```python theme={null}
# models.py
class Fruit(BaseModel):
    id: int
    name: str
    color: str

# routes/fruit.py
@app.get("/fruits")
def get_all_fruits():
    return [
        {"id": 1, "name": "Apple", "color": "Red"},
        {"id": 2, "name": "Banana", "color": "Yellow"},
    ]
```

Developer prompt in Cursor:

> Create a frontend function to call `/fruits` API and display all fruits in a table.

***

#### Without Scout Code

```
Preparing to read the codebase...
Grepping for "fruits" in routes/
Reading lines 1–120 from routes/fruit.py
Found reference to "Fruit" model
Reading lines 10–60 from models/fruit.py
Parsing OpenAPI specs...
Building combined response schema...
```

**Token usage:** \~56K
**Latency:** \~12s

***

#### With Scout Code MCP

```
Querying MCP: scout-code://fruit-service
Request: describe endpoint "/fruits"
Response: model Fruit(id, name, color)
Using schema from MCP context
Generated React code
```

**Token usage:** \~33K
**Latency:** \~2s

***

#### Resulting Frontend

```tsx theme={null}
import axios from "axios";

interface Fruit { id: number; name: string; color: string; }

export async function getFruits(): Promise<Fruit[]> {
  const res = await axios.get("/api/fruits");
  return res.data;
}
```

***

#### Summary

| Aspect       | Without Scout Code | With Scout Code  |
| ------------ | ------------------ | ---------------- |
| Repo Reading | Full code scan     | Single MCP query |
| Token Usage  | \~56K              | \~33K            |
| Latency      | \~12s              | \~2s             |
| Cost         | High               | Lower            |

Scout Code converts your codebase into a queryable context source — reducing tokens, improving speed, and enabling context-aware responses across repos.

***

## Web Context
