This MCP server integrates with Sumo Logic's API to perform log searches, allowing you to query your Sumo Logic logs with customizable time ranges. It provides a streamlined interface for retrieving log data through the Model Context Protocol.
Install dependencies:
npm install
Create a .env
file with the required environment variables:
ENDPOINT=https://api.au.sumologic.com/api/v1 # Sumo Logic API endpoint
SUMO_API_ID=your_api_id # Sumo Logic API ID
SUMO_API_KEY=your_api_key # Sumo Logic API Key
Build the project:
npm run build
Start the server:
npm start
You can also run the MCP server using Docker:
Build the Docker image:
docker build -t mcp/sumologic .
Run the container using one of these methods:
Option A: Using environment variables directly:
docker run -e ENDPOINT=your_endpoint -e SUMO_API_ID=your_api_id -e SUMO_API_KEY=your_api_key mcp/sumologic
Option B: Using a .env file:
docker run --env-file .env mcp/sumologic
The server requires the following environment variables:
ENDPOINT
- The Sumo Logic API endpoint (e.g., https://api.au.sumologic.com/api/v1)SUMO_API_ID
- Your Sumo Logic API IDSUMO_API_KEY
- Your Sumo Logic API KeyThe server provides a search-sumologic
tool that allows you to search Sumo Logic logs using custom queries.
The search tool accepts the following parameters:
query
(required): The Sumo Logic search queryfrom
(optional): Start time in ISO 8601 formatto
(optional): End time in ISO 8601 formatHere's an example of how to use the search functionality:
const query = '_index=app_pro_fiat_cont | json auto | fields log_identifier';
const results = await search(sumoClient, query, {
from: '2024-02-23T00:00:00Z',
to: '2024-02-24T00:00:00Z',
});
The server includes comprehensive error handling:
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.