Chapter 3 : MCP Server Advanced
MCP Server Best Practices
Please consider below aspects when designing and implementing MCP Servers
- Implement Security
- Mitigating Prompt Bloat and Efficient context handling can Lower Token Consumption
- Using Models Free Vs Paid
- Trial out both and choose as per business use cases
Using Data Modeling
- You can combine data to reduce number of Tools. Use data modeling with multiple table joins, bringing data in one Tool instead of many.
- Data modeling is implemented in backend APIs and will have respective MCP Server Tool.
- Is available in MCP Server REST.
MCP Server REST Data Modeling
Implement Data modeling by Following these example steps -
Configure Data Modeling in Builder Studio
Join tables 1st and 2nd
Join tables 2nd and 3rd
- Verify API call output in Swagger
Use Data Modeling in MCP Server
- MCP Server project with data modeling
Compare Tool calls without and with data modeling
- MCP Server Tools called when no data modeling
- Prompt
- LLM actions : Multiple Tools called
- MCP Server Tools called with data modeling
- Prompt
- LLM actions : Only one Tools called
- LLM actions : Final message
Configure Multiple MCP Servers
AI-Ready Data from multiple databases
- Please follow Readme in downloaded dir:
mcp\spring-java\README-MCP-Server.md
- Look For Section: How to setup multiple MCP Servers
MCP Server Limitations
Large Responses
caution
When calling the MCP Server Tool, if response is very large, you will get buffer exceeded notice in cursor chats. In such case:
- Narrow down response by fetching fewer data. e.g. Use Tools for queried data or get by key data, over get table data (ViewAll) which is full table data.
MCP Server Max Tools Limit
Cursor allows maximum total of 40 Tools from all MCP Servers. Based on LLM model recommendations.
Also
Server Name + Tool Name
length must be <= 60 chars only.Exceeding Total Tools Limit Notification
Solutions For Maximum Tools Limit
Best solution is to design MCP Server Tools properly.
- Remove un-used Tools from generated code. See How to Enable/Disable Tools in previous chapter.
- Use data modeling.
- Refer to Using Data Modeling
- For data needed across multiple database connections via Tools, one can use Data Mesh on API side and provide one API endpoint = one Tool.
- If you still hit MCP Server 40-Tool Limit in Cursor, There are some open source mcp proxy solutions available, as mentioned in Cursor forums. Search in forums for such solutions.