Sparrow On-Demand MCP
MCP (Model Context Protocol) is a standard protocol that enables safe interaction with a variety of API services through an AI LLM (Large Language Model). Through this technology, Sparrow On-Demand MCP makes it easy to use the analysis features provided by Sparrow On-Demand from the AI plugin in your IDE.
Sparrow On-Demand MCP provides the following features.
- Security analysis of a single file or a folder
- Checking analysis progress
- Looking up analysis results and analysis rules
MCP architecture
Execution flow
It is a good idea to run a test analysis with a sample project. Use the test analysis to verify the authentication, analysis request, and response flows in advance.
- The MCP client that connects your local IDE to the Sparrow On-Demand MCP server.
- You can invoke it by specifying Sparrow On-Demand MCP when you enter a command in the LLM chat panel of your local IDE.
- The NPM-based MCP server provided by Sparrow On-Demand.
- It can relay requests and responses between the LLM chat panel of the local IDE, the LLM server, and the Sparrow On-Demand server.
- The Sparrow On-Demand server that performs the requested analysis.
- The Sparrow On-Demand server runs on AWS and performs source code analysis, open source analysis, and web vulnerability analysis.
- An LLM (Large Language Model) server that you install locally or that is provided as a commercial cloud service.
- It generates secure code based on the Sparrow On-Demand analysis results.
Installation
Prerequisites
-
Install Node.js 22 or later and npm
-
A Sparrow On-Demand API token is required
Tip: See Token issuance.
-
Connect your IDE to an LLM, for example through a plugin
If you already use another IDE and LLM, there are no additional requirements. This section explains how to connect Sparrow On-Demand MCP in Cursor IDE to a local Ollama instance. For how to install and configure Ollama, see the Ollama official documentation.
Installing the MCP package
Install the MCP package with npm. You can install it globally or locally.
# Global installation
npm install -g @sparrowai/sparrow-mcp
# Local installation
npm install @sparrowai/sparrow-mcp
Creating the MCP configuration file
Create the MCP configuration file (mcp.json) in your IDE and add the configuration including your Sparrow On-Demand API token.
//Global installation
{
"mcpServers": {
"sparrow-mcp": {
"command": "node",
"args": ["C:\\Users\\<username>\\AppData\\Roaming\\npm\\node_modules\\@sparrowai\\sparrow-mcp\\dist\\src\\server.js"],
"env": {
"SPARROW_API_KEY": "your-ondemand-token",
"SPARROW_API_URL": "https://ondemand.sparrowcloud.ai",
"OLLAMA_BASE_URL": "http://localhost:11434",
"OLLAMA_MODEL": "gpt-oss:20b",
"NODE_ENV": "development"
}
}
}
}
// Local installation
{
"mcpServers": {
"sparrow-mcp": {
"command": "node",
"args": ["./node_modules/@sparrowai/sparrow-mcp/dist/src/server.js"],
"env": {
"SPARROW_API_KEY": "API_KEY",
"SPARROW_API_URL": "https://ondemand.sparrowcloud.ai",
"OLLAMA_BASE_URL": "YOUR_OLLAMA_SERVER_URL",
"OLLAMA_MODEL": "gpt-oss:20b",
"NODE_ENV": "development"
}
}
}
}
//Global installation
{
"mcpServers": {
"sparrow-mcp": {
"command": "node",
"args": ["C:\\Users\\<username>\\AppData\\Roaming\\npm\\node_modules\\@sparrowai\\sparrow-mcp\\dist\\src\\server.js"],
"env": {
"SPARROW_API_KEY": "your-ondemand-token",
"SPARROW_API_URL": "https://ondemand.sparrowcloud.ai",
"OLLAMA_BASE_URL": "http://localhost:11434",
"OLLAMA_MODEL": "gpt-oss:20b",
"NODE_ENV": "development"
}
}
}
}
// Local installation
{
"mcpServers": {
"sparrow-mcp": {
"command": "node",
"args": [".\\node_modules\\@sparrowai\\sparrow-mcp\\dist\\src\\server.js"],
"env": {
"SPARROW_API_KEY": "API_KEY",
"SPARROW_API_URL": "https://ondemand.sparrowcloud.ai",
"OLLAMA_BASE_URL": "YOUR_OLLAMA_SERVER_URL",
"OLLAMA_MODEL": "gpt-oss:20b",
"NODE_ENV": "development"
}
}
}
}
Now save the mcp.json file and restart Cursor IDE.
Usage
Sparrow On-Demand MCP usage flow
- Write your code in Cursor IDE.
- When you have finished writing the code, ask the LLM to run an analysis through Sparrow MCP.
- The LLM analyzes the code through Sparrow On-Demand MCP and returns the results.
- Review the analysis results and instruct the LLM to apply the suggested changes.
Cautions when writing prompts
Required input items
-
When you request an analysis through Sparrow On-Demand MCP, you must include
sparrow mcpin the command. -
You must specify the file or folder path you want to analyze.
Example
For example, you can write something like: Analyze the ./Cursor/project/dev/2512.1/test/ folder with Sparrow MCP.
Warning: Depending on how the LLM behaves, MCP may not work correctly. In the free version of Cursor IDE, the OpenAI GPT-4 model is set as the default. Because the GPT-4 model sometimes fails to recognize the MCP server, in that case you should use the paid version of Cursor IDE, or specify the MCP server path in the prompt so that the LLM uses the MCP server.
Configuring automatic analysis
You can configure Sparrow On-Demand MCP to automatically run an analysis at a specific point in time.
-
Go to the Settings window in Cursor.
-
Select the Rules and Commands tab.
-
Click the Add Rule button.
-
Add a new rule as follows.
When new code is added, analyze the code through Sparrow On-Demand MCP, suggest secure code based on the analysis results, and then apply that code directly to the file.When new code includes operations on external data, such as file I/O or DB I/O, analyze the code through Sparrow On-Demand MCP, suggest secure code based on the analysis results, and then apply that code directly to the file. -
Click the Done button to save the rule.
Sparrow On-Demand MCP analyses now run automatically.