This MCP server provides a powerful way to query large JSON files using JSONPath expressions. It's designed to work with Large Language Models (LLMs) that implement the Model Context Protocol, allowing them to effectively analyze and extract information from JSON data that would otherwise be too large to process.
You can install and run the JSON Query MCP server directly using npx:
npx json-query-mcp
To integrate with the Cursor editor:
Locate your Cursor MCP configuration file:
/Users/$USER/.cursor/mcp.json
Add the JSON Query MCP server to your configuration:
{
"mcpServers": {
"json-query": {
"command": "npx",
"args": ["json-query-mcp"],
}
}
}
The JSON Query MCP server provides several useful capabilities for working with large JSON data:
You can extract specific data from large JSON files using JSONPath expressions. JSONPath is a query language for JSON, similar to XPath for XML.
Example JSONPath expressions:
$.store.book[*].author
- Get all authors of all books$.store.book[?(@.price < 10)]
- Get all books with price less than 10$.store.book[-1:]
- Get the last bookYou can search for keys within a JSON structure that match or are similar to a provided query string.
Similarly, you can search for specific values within the JSON data that match your search criteria.
The server supports:
These capabilities are particularly useful when working with very large JSON files (over 1M characters) like API definitions, configuration files, or datasets.
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.