# Using Heavy Mcps

> Use mcporter and jq to reduce token bloat from heavy MCPs like Sanity or Brain vault. Filter and compact tool outputs outside chat to feed only essential data back to the model.

- **Type:** Skill
- **Install:** `agentstack add skill-nweii-agent-stuff-using-heavy-mcps`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [nweii](https://agentstack.voostack.com/s/nweii)
- **Installs:** 0
- **Category:** [Security](https://agentstack.voostack.com/c/security)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [nweii](https://github.com/nweii)
- **Source:** https://github.com/nweii/agent-stuff/tree/master/skills/using-heavy-mcps

## Install

```sh
agentstack add skill-nweii-agent-stuff-using-heavy-mcps
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Token-Efficient MCP Usage via MCPorter

When working with MCPs that return large payloads—like Sanity queries with full document content or Brain vault searches with entire file contents—you can route these calls through `mcporter` outside of chat, trim the output with `jq`, and feed only the compact result back to the model. This avoids the 20–40k token bloat that comes from loading full responses into context.

## When to Use This Pattern

Use mcporter + jq when:

- **Large responses**: Sanity queries returning full documents, Brain vault searches with file contents
- **Repeated queries**: You need the same data multiple times and only care about specific fields
- **Field filtering**: The MCP returns 50 fields but you only need 3
- **Chained operations**: Multiple MCP calls where each bloats context
- **List operations**: Getting 100 items but only needing titles and IDs

**Don't use this pattern when:**

- Exploring unfamiliar data (let Cursor call MCP directly to see full structure)
- Response is already small (
```

### Pattern 2: Embedding in other Cursor rules

Add mcporter commands to rules that need specific data:

```markdown
## Portfolio Context

When discussing portfolio work, use this to fetch current project list:

bunx mcporter call 'Sanity Developer.query_documents(
  resource: {projectId: "xyz", dataset: "production"},
  query: "*[_type == \"project\"]"
)' | jq '[.[] | {title: .title, role: .role}]'

```

### Pattern 3: Save as shell alias

Add to your `.zshrc` for frequently-used queries:

```bash
alias portfolio-list='bunx mcporter call '"'"'Sanity Developer.query_documents(
  resource: {projectId: "xyz", dataset: "production"},
  query: "*[_type == \"project\"]"
)'"'"' | jq "[.[] | {title: .title, slug: .slug.current}]"'
```

Then just run: `portfolio-list`

## When to Just Use Cursor's MCP Calls

Let Cursor call MCPs directly when:

- **Exploring**: You don't know the response structure yet
- **Small responses**: The data is already compact
- **Interactive filtering**: You want to iteratively refine what you're looking for
- **One-off questions**: Not worth the setup overhead

The mcporter pattern is for repeatability and token efficiency, not every MCP interaction.

## Avoiding Token Waste on Failed Calls

**Set timeouts to fail fast:**

```bash
# Don't wait forever for a hung MCP call
bunx mcporter call 'Brain.vault(action: "search", query: "test")' --timeout 10000
```

Default timeout is 30 seconds. For slow operations, increase it. For quick checks, decrease it.

**Check auth before expensive queries:**

```bash
# Verify authentication status
bunx mcporter config get "Sanity Developer"

# If auth is required, do it once
bunx mcporter auth "Sanity Developer"
```

This prevents loading huge error messages into context when auth fails.

**Use --output json for programmatic error handling:**

```bash
bunx mcporter call 'Brain.vault(action: "search", query: "test")' --output json
```

The structured envelope makes it easier to detect failures without loading full error traces into context.

## Debugging Tips

**Check available MCPs:**

```bash
bunx mcporter list
```

**See tool signatures and schemas:**

```bash
bunx mcporter list Brain --schema
bunx mcporter list "Sanity Developer" --schema
```

**Test without jq first:**

```bash
bunx mcporter call 'Brain.vault(action: "search", query: "test")'
```

Then add jq filtering once you see the structure.

**Format jq output for readability:**

```bash
... | jq '.'
# vs compact:
... | jq -c '.'
```

## Real-World Token Savings

**Before (direct MCP call in chat):**

- Sanity query for 10 projects with full content: ~25,000 tokens
- Brain vault search returning 5 notes: ~15,000 tokens

**After (mcporter + jq):**

- Same Sanity query, titles/IDs only: ~500 tokens
- Same vault search, metadata only: ~300 tokens

**Savings:** 95%+ reduction for typical filtered queries.

## Additional Resources

**Official mcporter documentation:** Available via Context7 at `/steipete/mcporter`

**Key docs to reference:**

- Call syntax and examples: [mcporter/docs/call-syntax.md](https://github.com/steipete/mcporter/blob/main/docs/call-syntax.md)
- Tool calling guide: [mcporter/docs/tool-calling.md](https://github.com/steipete/mcporter/blob/main/docs/tool-calling.md)
- Configuration: [mcporter/docs/config.md](https://github.com/steipete/mcporter/blob/main/docs/config.md)

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [nweii](https://github.com/nweii)
- **Source:** [nweii/agent-stuff](https://github.com/nweii/agent-stuff)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** yes
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-nweii-agent-stuff-using-heavy-mcps
- Seller: https://agentstack.voostack.com/s/nweii
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
