Tutorial

How to Scope MCP Servers Per Project to Reduce Token Bloat

Reduce MCP token bloat by scoping tool servers per project. Only load the tools each project actually needs instead of exposing everything globally.

Every MCP server you connect adds tool descriptions to your LLM context window. A global setup with 10 servers might add 5,000+ tokens of tool descriptions to every request, even when the agent only needs search. Project-scoped MCP configurations load only the tools each project needs. This tutorial shows how to configure the Scavio MCP server (mcp.scavio.dev/mcp) per project so you only pay for the context tokens you actually use.

Prerequisites

  • An MCP-compatible client (Claude Desktop, Cursor, or Cline)
  • A Scavio API key from scavio.dev
  • Basic JSON configuration knowledge
  • At least two projects that need different tool sets

Walkthrough

Step 1: Audit your current MCP token usage

Check how many MCP servers you have configured globally. Each server adds tool descriptions that consume context tokens on every request.

Python
# Check your current MCP configuration
import json, os

# Common MCP config locations
config_paths = [
    os.path.expanduser('~/.config/claude/claude_desktop_config.json'),
    os.path.expanduser('~/.cursor/mcp.json'),
    '.mcp.json',  # Project-level
]

for path in config_paths:
    if os.path.exists(path):
        with open(path) as f:
            config = json.load(f)
        servers = config.get('mcpServers', {})
        print(f'{path}:')
        print(f'  Servers: {len(servers)}')
        for name, cfg in servers.items():
            print(f'    - {name}')
        # Estimate token cost (rough: ~200 tokens per tool description)
        est_tools = len(servers) * 5  # ~5 tools per server average
        est_tokens = est_tools * 200
        print(f'  Estimated tool description tokens: ~{est_tokens}')
    else:
        print(f'{path}: not found')

Step 2: Create project-scoped MCP configurations

Instead of one global config, create per-project .mcp.json files that only include the servers each project needs.

Python
import json

def create_project_mcp(project_path: str, servers: dict, description: str = ''):
    """Create a project-scoped MCP configuration."""
    config = {'mcpServers': servers}
    config_path = os.path.join(project_path, '.mcp.json')
    with open(config_path, 'w') as f:
        json.dump(config, f, indent=2)
    tool_count = len(servers)
    est_tokens = tool_count * 5 * 200
    print(f'Created {config_path}')
    print(f'  Servers: {tool_count}')
    print(f'  Est. token overhead: ~{est_tokens}')
    if description:
        print(f'  Purpose: {description}')

# Project 1: E-commerce research - needs search only
create_project_mcp('/projects/ecommerce-research', {
    'scavio': {
        'url': 'https://mcp.scavio.dev/mcp',
        'headers': {'Authorization': 'Bearer ${SCAVIO_API_KEY}'}
    }
}, 'E-commerce product research with multi-platform search')

# Project 2: Content pipeline - needs search + file tools
create_project_mcp('/projects/content-pipeline', {
    'scavio': {
        'url': 'https://mcp.scavio.dev/mcp',
        'headers': {'Authorization': 'Bearer ${SCAVIO_API_KEY}'}
    },
    'filesystem': {
        'command': 'npx',
        'args': ['-y', '@modelcontextprotocol/server-filesystem', '/projects/content-pipeline/output']
    }
}, 'Content generation with search grounding')

Step 3: Compare global vs scoped token costs

Calculate the token savings from scoping. A project that only needs search saves thousands of tokens per request compared to a global config with 10 servers.

Python
def compare_token_costs(global_servers: int, scoped_servers: int,
                       avg_tools_per_server: int = 5,
                       tokens_per_tool: int = 200,
                       requests_per_day: int = 100) -> dict:
    global_tokens = global_servers * avg_tools_per_server * tokens_per_tool
    scoped_tokens = scoped_servers * avg_tools_per_server * tokens_per_tool
    savings_per_request = global_tokens - scoped_tokens
    daily_savings = savings_per_request * requests_per_day
    # At ~$3/1M input tokens (GPT-4o rate)
    cost_per_token = 3.0 / 1_000_000
    monthly_savings = daily_savings * 30 * cost_per_token
    return {
        'global_tokens_per_request': global_tokens,
        'scoped_tokens_per_request': scoped_tokens,
        'savings_per_request': savings_per_request,
        'daily_token_savings': daily_savings,
        'monthly_cost_savings': monthly_savings,
    }

# Scenario: global has 10 servers, project only needs 1 (Scavio)
result = compare_token_costs(global_servers=10, scoped_servers=1)
print('Token Savings Analysis')
print('=' * 40)
print(f'Global config: {result["global_tokens_per_request"]:,} tokens/request')
print(f'Scoped config: {result["scoped_tokens_per_request"]:,} tokens/request')
print(f'Savings: {result["savings_per_request"]:,} tokens/request')
print(f'Daily savings: {result["daily_token_savings"]:,} tokens')
print(f'Monthly cost savings: ${result["monthly_cost_savings"]:.2f}')

Step 4: Set up the Scavio MCP server for a project

Create a minimal .mcp.json that only configures the Scavio search MCP server. This gives the project access to 6 platforms with minimal token overhead.

Python
# Minimal Scavio-only MCP config for any project
scavio_only_config = {
    'mcpServers': {
        'scavio': {
            'url': 'https://mcp.scavio.dev/mcp',
            'headers': {
                'Authorization': 'Bearer ${SCAVIO_API_KEY}'
            }
        }
    }
}

def setup_scavio_mcp(project_dir: str):
    config_path = os.path.join(project_dir, '.mcp.json')
    with open(config_path, 'w') as f:
        json.dump(scavio_only_config, f, indent=2)
    print(f'Scavio MCP configured at {config_path}')
    print(f'Platforms available: Google, Amazon, YouTube, Walmart, Reddit, TikTok')
    print(f'Endpoint: mcp.scavio.dev/mcp')
    print(f'Cost: $0.005 per search credit')
    print(f'Token overhead: ~1,000 tokens (vs ~10,000 with 10 global servers)')

# Setup for multiple projects
for project in ['ecommerce-tool', 'content-agent', 'research-bot']:
    project_path = f'/projects/{project}'
    if os.path.isdir(project_path):
        setup_scavio_mcp(project_path)
    else:
        print(f'Would configure: {project_path}/.mcp.json')

Python Example

Python
import json, os

def create_scavio_mcp(project_dir):
    config = {'mcpServers': {'scavio': {
        'url': 'https://mcp.scavio.dev/mcp',
        'headers': {'Authorization': 'Bearer ${SCAVIO_API_KEY}'}
    }}}
    path = os.path.join(project_dir, '.mcp.json')
    with open(path, 'w') as f:
        json.dump(config, f, indent=2)
    print(f'Created {path}')
    print(f'  1 server, ~1,000 token overhead')
    print(f'  6 platforms: Google, Amazon, YouTube, Walmart, Reddit, TikTok')

create_scavio_mcp('.')

JavaScript Example

JavaScript
const fs = require('fs');
const path = require('path');

function createScavioMcp(projectDir) {
  const config = { mcpServers: { scavio: {
    url: 'https://mcp.scavio.dev/mcp',
    headers: { Authorization: 'Bearer ${SCAVIO_API_KEY}' }
  }}};
  const configPath = path.join(projectDir, '.mcp.json');
  fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
  console.log(`Created ${configPath}`);
  console.log('  1 server, ~1,000 token overhead');
  console.log('  6 platforms: Google, Amazon, YouTube, Walmart, Reddit, TikTok');
}

createScavioMcp('.');

Expected Output

JSON
Token Savings Analysis
========================================
Global config: 10,000 tokens/request
Scoped config: 1,000 tokens/request
Savings: 9,000 tokens/request
Daily savings: 900,000 tokens
Monthly cost savings: $81.00

Scavio MCP configured at /projects/ecommerce-tool/.mcp.json
Platforms available: Google, Amazon, YouTube, Walmart, Reddit, TikTok
Endpoint: mcp.scavio.dev/mcp
Cost: $0.005 per search credit
Token overhead: ~1,000 tokens (vs ~10,000 with 10 global servers)

Related Tutorials

Frequently Asked Questions

Most developers complete this tutorial in 15 to 30 minutes. You will need a Scavio API key (free tier works) and a working Python or JavaScript environment.

An MCP-compatible client (Claude Desktop, Cursor, or Cline). A Scavio API key from scavio.dev. Basic JSON configuration knowledge. At least two projects that need different tool sets. A Scavio API key gives you 250 free credits per month.

Yes. The free tier includes 250 credits per month, which is more than enough to complete this tutorial and prototype a working solution.

Scavio has a native LangChain package (langchain-scavio), an MCP server, and a plain REST API that works with any HTTP client. This tutorial uses the raw REST API, but you can adapt to your framework of choice.

Start Building

Reduce MCP token bloat by scoping tool servers per project. Only load the tools each project actually needs instead of exposing everything globally.