The Problem with Direct Conversion
APIs are designed to return comprehensive data. MCPs need to return minimal, relevant data.Example: Web Scraper API
Take an API like Apify’s web scraper. When you search, it returns:- All search result links
- Full HTML of each page
- Metadata, timestamps, pagination info
- 10-20 results per request
- Forgets earlier context
- Hits token limits
- Produces poor results
Same Problem Everywhere
| Data Source | API Returns | MCP Should Return |
|---|---|---|
| Web scraper | Full HTML pages | Extracted text snippets |
| Database | All matching rows | Top N relevant results |
| HubSpot/CRM | Full contact records | Key fields only |
| Search APIs | Paginated results | Summarized highlights |
Solution 1: Summarize Before Returning
Don’t return raw API responses. Process them first.Option A: Pre-computed Summaries
Store summaries alongside your data:Option B: On-the-fly Summarization
Use a small/nano LLM to summarize before returning:Solution 2: Build a Layer on Top
Don’t modify your existing API. Build an MCP-optimized layer on top: Your existing API continues serving developers. Your MCP layer:- Calls the same API
- Processes/summarizes responses
- Returns minimal, relevant data
Authentication: Use Your Existing Auth
Don’t create a separate auth system for MCPs. Use the same OAuth server that authenticates your existing users.What You Need
| Component | Description |
|---|---|
| OAuth Client ID | Your application’s client identifier |
| OAuth Client Secret | Your application’s secret (keep secure!) |
| OAuth Server URL | Your auth provider’s token endpoint |
| Redirect URI | Where to redirect after authentication |
| Scopes | Permissions the MCP needs |
Same Auth, Same Data
Implementation with @leanmcp/auth
Defining Scopes
Define scopes based on what the MCP actually needs:Complete Example: HubSpot Integration
Summary
| Don’t | Do |
|---|---|
| Auto-convert OpenAPI to MCP | Build an optimized MCP layer |
| Return raw API responses | Summarize/filter before returning |
| Create separate MCP auth | Use your existing OAuth server |
| Request all scopes | Request minimal scopes needed |
| Return full records | Return essential fields only |