Skip to main content
Glama
gemini2026

Documentation Search MCP Server

by gemini2026

snyk_monitor_project

Set up continuous security monitoring for a project directory to detect vulnerabilities and maintain protection over time.

Instructions

Set up continuous monitoring for a project with Snyk.

Args:
    project_path: Path to the project directory

Returns:
    Status of monitoring setup and project details

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_pathNo.

Implementation Reference

  • Main handler function for the 'snyk_monitor_project' MCP tool. Registers the tool with @mcp.tool(), handles input validation via signature, tests Snyk connection, and delegates to SnykIntegration.monitor_project for core logic.
    async def snyk_monitor_project(project_path: str = "."):
        """
        Set up continuous monitoring for a project with Snyk.
    
        Args:
            project_path: Path to the project directory
    
        Returns:
            Status of monitoring setup and project details
        """
        from .snyk_integration import snyk_integration
    
        try:
            # Test connection and get organization info
            connection_test = await snyk_integration.test_connection()
            if connection_test["status"] != "connected":
                return {
                    "error": "Snyk integration not configured",
                    "details": connection_test.get("error", "Unknown error"),
                    "setup_required": [
                        "Set SNYK_API_KEY environment variable",
                        "Set SNYK_ORG_ID environment variable",
                        "Ensure you have organization admin privileges",
                    ],
                }
    
            # Set up monitoring
            monitor_result = await snyk_integration.monitor_project(project_path)
    
            if "error" in monitor_result:
                return monitor_result
    
            return {
                "status": "success",
                "monitoring_enabled": True,
                "project_details": monitor_result,
                "organization": connection_test.get("organizations", []),
                "next_steps": [
                    "🔔 Configure alert preferences in Snyk dashboard",
                    "📊 Review security reports regularly",
                    "🔄 Enable automatic PRs for security updates",
                    "📈 Set up integration with CI/CD pipeline",
                ],
                "dashboard_url": "https://app.snyk.io/org/your-org/projects",
            }
    
        except Exception as e:
            return {
                "error": f"Monitoring setup failed: {str(e)}",
                "project_path": project_path,
            }
  • Core helper method in SnykIntegration class that implements project monitoring by parsing dependencies, generating manifest, and calling Snyk REST API to import the project for continuous monitoring.
    async def monitor_project(self, project_path: str) -> Dict[str, Any]:
        """Set up continuous monitoring for a project"""
    
        # Find project dependencies
        dep_result = find_and_parse_dependencies(project_path)
        if not dep_result:
            return {"error": "No supported dependency files found"}
    
        filename, ecosystem, dependencies = dep_result
    
        try:
            async with httpx.AsyncClient(timeout=self.timeout) as client:
                # Import project for monitoring
                import_payload = {
                    "target": {
                        "files": [
                            {
                                "path": filename,
                                "contents": self._generate_manifest_content(
                                    dependencies, ecosystem
                                ),
                            }
                        ]
                    }
                }
    
                if not self.org_id:
                    return {
                        "error": "SNYK_ORG_ID environment variable is required for monitoring"
                    }
    
                response = await client.post(
                    f"{self.rest_api_url}/orgs/{self.org_id}/projects",
                    headers=self._get_headers(),
                    json=import_payload,
                )
    
                if response.status_code == 201:
                    project_data = response.json()
                    return {
                        "status": "monitoring_enabled",
                        "project_id": project_data.get("data", {}).get("id"),
                        "project_name": os.path.basename(project_path),
                        "dependencies_count": len(dependencies),
                    }
                else:
                    return {
                        "error": f"Failed to enable monitoring: {response.status_code}",
                        "details": response.text,
                    }
    
        except Exception as e:
            return {"error": f"Monitoring setup failed: {str(e)}"}
  • MCP tool registration decorator @mcp.tool() that registers the snyk_monitor_project function as an MCP tool.
    @mcp.tool()
    async def snyk_monitor_project(project_path: str = "."):
  • Tool schema/arguments documentation defining input (project_path: str) and expected output format.
    """
    Set up continuous monitoring for a project with Snyk.
    
    Args:
        project_path: Path to the project directory
    
    Returns:
        Status of monitoring setup and project details
    """

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/gemini2026/documentation-search-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server