Skip to main content

Scott Spence's post on MCP Optmization

https://scottspence.com/posts/optimising-mcp-server-context-usage-in-claude-code

Highlights

  • MCP servers all have their own descriptions and prompts for their various functions and tools. However, if you make a lot of these MCP servers and make their descriptions and prompts too detailed, you'll eat your context window before you even get a chance to use it.

  • Architecture fundamentals on the MCP level: if you have multiple MCP servers that do similar tasks, group them under one MCP server. Example, if you have four different MCPs that each handle accessing a specific search engine, group their functionality under one MCP server and use some pattern/approach to choose the search engine that's right for the job.

  • Trim your descriptions. People using your MCP server may need the extended context, but the LLMs don't. Same goes for the descriptions of your parameters in your methods: other developers/people using your MCP server need the full story if they don't deeply understand the domain the MCP handles, but your LLMs don't.

  • Keep an eye on your context usage every so often. Even as you consolidate your MCP servers, think about what additions may cause the token usage to grow again.