EntityIdentification is a Model Context Protocol (MCP) server that helps determine whether two sets of data come from the same entity. It uses text normalization techniques and language models to evaluate both exact and semantic equality between data values.
To use the EntityIdentification tool, install the required dependency using pip:
pip install genai
The tool provides several functions to compare data and identify whether they belong to the same entity.
The system normalizes text by converting it to lowercase, removing punctuation, and standardizing whitespace.
The tool compares values both directly and semantically:
The system traverses JSON objects key by key, comparing corresponding values and leveraging a language model to assess semantic similarity.
Here's a practical example of how to use the EntityIdentification tool:
import json
import genai
import re
# Define your JSON objects to compare
json1 = {
"name": "John Doe",
"address": "123 Main St, Anytown, USA",
"hobbies": ["reading", "hiking", "coding"]
}
json2 = {
"name": "john doe",
"address": "123 Main Street, Anytown, USA",
"hobbies": ["coding", "hiking", "reading"]
}
# Compare the JSON objects
comparison_results = compare_json(json1, json2)
# Generate final matching result using the language model
model1 = genai.GenerativeModel("gemini-2.0-flash-thinking-exp")
result_matching = model1.generate_content("综合这些信息,你认为可以判断两个数据来自同一主体吗?"+json.dumps(comparison_results, ensure_ascii=False, indent=4))
# Print the result
print(result_matching.text)
The output will indicate whether the two data sets are likely from the same entity, based on both direct comparison and semantic analysis.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.