### Getting Started with Semgrep MCP CLI and Docker Source: https://github.com/semgrep/mcp Instructions for running the Semgrep MCP project as a command-line interface (CLI) tool using Python's uvx, or as a Docker container. These commands provide the basic setup for interacting with the MCP server. ```bash uvx semgrep-mcp # see --help for more options ``` ```docker docker run -i --rm ghcr.io/semgrep/mcp -t stdio ``` -------------------------------- ### Install and Use semgrep-mcp CLI Source: https://github.com/semgrep/mcp Instructions for installing the semgrep-mcp package using pipx and an overview of its command-line interface. The CLI supports stdio and sse transports for communication, with stdio reading from stdin and writing to stdout, and sse starting an HTTP server. ```shell $ pipx install semgrep-mcp $ semgrep-mcp --help Usage: semgrep-mcp [OPTIONS] Entry point for the MCP server Supports both stdio and sse transports. For stdio, it will read from stdin and write to stdout. For sse, it will start an HTTP server on port 8000. Options: -v, --version Show version and exit. -t, --transport [stdio|sse] Transport protocol to use (stdio or sse) -h, --help Show this message and exit. ``` -------------------------------- ### Install Semgrep CLI Source: https://github.com/semgrep/semgrep Instructions for installing the Semgrep command-line interface on macOS, Linux, and via Docker. This is essential for running Semgrep locally or in CI/CD pipelines. ```shell # For macOS $ brew install semgrep ``` ```shell # For Ubuntu/WSL/Linux/macOS $ python3 -m pip install semgrep ``` ```dockerfile # To try Semgrep without installation run via Docker $ docker run -it -v "${PWD}:/src" semgrep/semgrep semgrep login $ docker run -e SEMGREP_APP_TOKEN= --rm -v "${PWD}:/src" semgrep/semgrep semgrep ci ``` -------------------------------- ### Install and Run Semgrep CLI Source: https://github.com/semgrep/semgrep This snippet details how to install the Semgrep CLI using various package managers like Homebrew and pip, or via Docker. It also shows how to log in to Semgrep and run a CI scan for your project. ```shell # For macOS\n$ brew install semgrep\n\n# For Ubuntu/WSL/Linux/macOS\n$ python3 -m pip install semgrep\n\n# To try Semgrep without installation run via Docker\n$ docker run -it -v \"${PWD}:/src\" semgrep/semgrep semgrep login\n$ docker run -e SEMGREP_APP_TOKEN=\u0026lt;TOKEN\u0026gt; --rm -v \"${PWD}:/src\" semgrep/semgrep semgrep ci ``` -------------------------------- ### Python SSE Client Example Source: https://github.com/semgrep/mcp This Python example illustrates setting up a Server-Sent Events (SSE) client to communicate with a server endpoint. It uses `sse_client` and `ClientSession` from the OpenAI Agents SDK to initialize a session and make a tool call, specifically demonstrating a `semgrep_scan` operation with code files as input. ```python from mcp.client.session import ClientSession from mcp.client.sse import sse_client async def main(): async with sse_client("http://localhost:8000/sse") as (read_stream, write_stream): async with ClientSession(read_stream, write_stream) as session: await session.initialize() results = await session.call_tool( "semgrep_scan", { "code_files": [ ``` -------------------------------- ### Install Semgrep MCP Server (VS Code Insiders - stdio) Source: https://github.com/semgrep/mcp Provides instructions to install the Semgrep MCP server for VS Code Insiders using the stdio communication method. This involves running a Docker container. ```shell docker run -i --rm ghcr.io/semgrep/mcp -t stdio ``` -------------------------------- ### Interactive Semgrep Query Example (Python) Source: https://github.com/semgrep/semgrep Demonstrates how to write and run a Semgrep query interactively to find specific code patterns. This example checks for Python equality where both sides are the same variable, which might indicate a bug. ```bash semgrep -e '$X == $X' --lang=py path/to/src ``` -------------------------------- ### OpenAI Agents SDK MCP Integration Source: https://github.com/semgrep/mcp Python example demonstrating how to initialize and use the MCPServerStdio with Semgrep MCP in the OpenAI Agents SDK. ```python from openai_agents import MCPServerStdio async with MCPServerStdio( params={ "command": "uvx", "args": ["semgrep-mcp"], } ) as server: tools = await server.list_tools() ``` -------------------------------- ### Install Semgrep MCP Server (VS Code Insiders - docker) Source: https://github.com/semgrep/mcp Provides instructions to install the Semgrep MCP server for VS Code Insiders using the docker communication method. This involves running a Docker container. ```shell docker run -i --rm ghcr.io/semgrep/mcp -t docker ``` -------------------------------- ### Cursor IDE MCP Server Configuration Source: https://github.com/semgrep/mcp Example JSON configuration file for the Cursor IDE to connect to the Semgrep MCP server. This setup allows Cursor to leverage Semgrep for code analysis tasks directly within the IDE. ```json { "mcpServers": { "semgrep": { "command": "uvx", "args": ["semgrep-mcp"], "env": { "SEMGREP_APP_TOKEN": "" } } } } ``` -------------------------------- ### Semgrep Upgrade Commands Source: https://github.com/semgrep/semgrep Instructions for upgrading Semgrep based on the installation method used. Covers Homebrew, pip, and Docker. ```bash # Using Homebrew $ brew upgrade semgrep ``` ```bash # Using pip $ python3 -m pip install --upgrade semgrep ``` ```docker # Using Docker $ docker pull semgrep/semgrep:latest ``` -------------------------------- ### Install Semgrep MCP Source: https://github.com/semgrep/mcp Installs the semgrep-mcp package using pipx, a tool for installing and running Python applications in isolated environments. ```bash pipx install semgrep-mcp ``` -------------------------------- ### Semgrep MCP Configuration for Cursor IDE Source: https://github.com/semgrep/mcp An example JSON configuration file for integrating Semgrep MCP with the Cursor IDE. This configuration specifies the command to run, its arguments, and environment variables like the SEMGREP_APP_TOKEN. ```json { "mcpServers": { "semgrep": { "command": "uvx", "args": [ "semgrep-mcp" ], "env": { "SEMGREP_APP_TOKEN": "" } } } } ``` -------------------------------- ### Semgrep Rule Examples by Use Case Source: https://github.com/semgrep/semgrep Links to specific Semgrep rules demonstrating various use cases, such as preventing dangerous API usage, analyzing code patterns, and enforcing security best practices. ```semgrep Prevent use of exec https://semgrep.dev/playground/s/lglB ``` ```semgrep Extract Spring routes https://semgrep.dev/playground/s/Y6wD ``` ```semgrep Securely set Flask cookies https://semgrep.dev/playground/s/6KwW ``` ```semgrep ExpressJS dataflow into sandbox.run https://semgrep.dev/playground/s/qEpR ``` ```semgrep Use assertEqual for == checks https://semgrep.dev/playground/s/oEox ``` ```semgrep Always check subprocess calls https://semgrep.dev/playground/s/zENk ``` ```semgrep Verify transactions before making them https://semgrep.dev/playground/s/p8zk ``` ```semgrep Finding XSS in Apache Airflow https://semgrep.dev/playground/s/KPwj ``` ```semgrep Hardcoded credentials https://semgrep.dev/playground/s/2Br8 ``` ```semgrep Find S3 ARN uses https://semgrep.dev/playground/s/jEKD ``` ```semgrep DES is deprecated (Java) https://semgrep.dev/playground/r/java.lang.security.audit.crypto.des-is-deprecated.des-is-deprecated ``` ```semgrep Deprecated Flask APIs (Python) https://semgrep.dev/playground/r/python.flask.maintainability.deprecated.deprecated-apis.flask-deprecated-apis ``` ```semgrep Deprecated Bokeh APIs (Python) https://semgrep.dev/playground/r/python.bokeh.maintainability.deprecated.deprecated_apis.bokeh-deprecated-apis ``` ```semgrep Use listenAndServeTLS (Go) https://semgrep.dev/playground/s/1Ayk ``` -------------------------------- ### OpenAI MCP Documentation Links Source: https://github.com/semgrep/mcp Provides links to official OpenAI documentation regarding the Model Context Protocol (MCP). These resources cover the setup and usage of MCP for integrating tools with OpenAI models. ```APIDOC OpenAI MCP Documentation: - https://platform.openai.com/docs/mcp - https://platform.openai.com/docs/guides/tools-remote-mcp ``` -------------------------------- ### Upgrade Semgrep Commands Source: https://github.com/semgrep/semgrep Run the appropriate command to upgrade Semgrep based on your installation method: Homebrew, pip, or Docker. ```shell # Using Homebrew $ brew upgrade semgrep # Using pip $ python3 -m pip install --upgrade semgrep # Using Docker $ docker pull semgrep/semgrep:latest ``` -------------------------------- ### Docker Run Command Source: https://github.com/semgrep/mcp Example command to run the Semgrep MCP Docker container, mapping port 8000 and using SSE output. ```shell docker run -p 8000:0000 ghcr.io/semgrep/mcp -t sse ``` -------------------------------- ### Python SSE Client Example Source: https://github.com/semgrep/mcp An asynchronous Python client demonstrating how to connect to the Semgrep MCP server's SSE endpoint, initialize a session, and call a tool like 'semgrep_scan'. It shows how to send code content for analysis. ```python from mcp.client.session import ClientSession from mcp.client.sse import sse_client async def main(): async with sse_client("http://localhost:8000/sse") as (read_stream, write_stream): async with ClientSession(read_stream, write_stream) as session: await session.initialize() results = await session.call_tool( "semgrep_scan", { "code_files": [ { "filename": "hello_world.py", "content": "def hello(): print('Hello, World!')", } ] }, ) print(results) ``` -------------------------------- ### Claude Code MCP Setup Command Source: https://github.com/semgrep/mcp Command-line instruction for setting up Model Context Protocol (MCP) for Claude Code, specifically adding Semgrep as a tool. This allows Claude to invoke Semgrep for code analysis or other tasks. ```shell claude mcp add semgrep uvx semgrep-mcp ``` -------------------------------- ### Semgrep Prompt for Rule Creation Source: https://github.com/semgrep/mcp A reusable prompt designed to assist users in writing custom Semgrep rules. This prompt guides the LLM to generate effective and accurate security rules based on user input. ```APIDOC write_custom_semgrep_rule: description: Return a prompt to help write a Semgrep rule. parameters: (User input describing the desired rule) returns: (Prompt for Semgrep rule generation) ``` -------------------------------- ### Run Semgrep MCP via uvx CLI Source: https://github.com/semgrep/mcp Execute the Semgrep MCP Python package as a CLI command using the uvx tool. This method is suitable for local development and execution environments where uvx is installed. ```shell uvx semgrep-mcp # see --help for more options ``` -------------------------------- ### Semgrep CLI Basic Usage Source: https://github.com/semgrep/semgrep Essential commands for interacting with the Semgrep CLI, including logging in to your Semgrep account and performing a CI scan on your project. It also shows how to run a specific query. ```shell # Log in to Semgrep to access Pro rules and Supply Chain features $ semgrep login ``` ```shell # Scan your project for vulnerabilities in source code and dependencies $ semgrep ci ``` ```shell # Run a specific query interactively (example for Python) $ semgrep -e '$X == $X' --lang=py path/to/src ``` -------------------------------- ### Interact with MCP Server Source: https://github.com/semgrep/mcp This Python snippet demonstrates how to use the `MCPServerStdio` class from the OpenAI Agents SDK to establish a connection with an MCP server. It shows how to configure the server with a command and arguments, and then asynchronously list the available tools provided by the server. ```python async with MCPServerStdio( params={ "command": "uvx", "args": ["semgrep-mcp"], } ) as server: tools = await server.list_tools() ``` -------------------------------- ### Semgrep MCP CLI Help Source: https://github.com/semgrep/mcp Displays the help message for the semgrep-mcp command-line interface, showing available options and usage. ```bash semgrep-mcp --help ``` -------------------------------- ### GitHub Product Features Overview Source: https://github.com/semgrep/semgrep This section lists various GitHub products and features, providing a brief description for each. It covers AI-powered tools, development environments, and project management capabilities. ```text GitHub Copilot Write better code with AI GitHub Spark New Build and deploy intelligent apps GitHub Models New Manage and compare prompts GitHub Advanced Security Find and fix vulnerabilities Actions Automate any workflow Codespaces Instant dev environments Issues Plan and track work Code Review Manage code changes Discussions Collaborate outside of code ``` -------------------------------- ### Docusaurus Data Attributes Source: https://semgrep.dev/docs/ JavaScript code to apply data attributes to the document's root element based on URL query parameters starting with 'docusaurus-data-'. This allows dynamic configuration of the page. ```javascript function(){ try{ const n=new URLSearchParams(window.location.search).entries(); for(var[t,e]of n) if(t.startsWith("docusaurus-data-")){ var a=t.replace("docusaurus-data-","data-"); document.documentElement.setAttribute(a,e) } }catch(t){} }() ``` -------------------------------- ### Python Semgrep Scan with LLM Client Source: https://github.com/semgrep/mcp This snippet demonstrates how to initialize an LLM client session and call a 'semgrep_scan' tool. It includes passing code files with their content and prints the results. Dependencies include 'mcp.client.session.ClientSession' and 'mcp.client.sse.sse_client'. ```python from mcp.client.session import ClientSession from mcp.client.sse import sse_client async def main(): async with sse_client("http://localhost:8000/sse") as (read_stream, write_stream): async with ClientSession(read_stream, write_stream) as session: await session.initialize() results = await session.call_tool( "semgrep_scan", { "code_files": [ { "filename": "hello_world.py", "content": "def hello(): print('Hello, World!')" } ] }, ) print(results) ``` -------------------------------- ### Semgrep MCP Configuration for Cursor Source: https://github.com/semgrep/mcp This JSON block configures Semgrep as an MCP server for the Cursor IDE. It specifies the command to run ('uvx') and its arguments ('semgrep-mcp'). This configuration can be added to your global '~/.cursor/mcp.json' or project-specific '.cursor/mcp.json' file. ```json { "mcpServers": { "semgrep": { "command": "uvx", "args": ["semgrep-mcp"] } } } ``` -------------------------------- ### Python Print Statement Detection Rule Source: https://github.com/semgrep/semgrep This Semgrep rule is designed to identify the use of Python's built-in `print()` function. It serves as a basic example of how Semgrep rules are structured and applied to analyze code for specific patterns, such as potential debugging statements or areas for refactoring. ```Semgrep rules: - id: python-print-to-logger message: Found a print statement. Consider using a proper logger. severity: INFO languages: - python pattern: |+ print(...) ``` -------------------------------- ### Semgrep Static Analysis Tool Description Source: https://github.com/semgrep/semgrep This entry describes the core functionality of the semgrep project, highlighting its purpose as a static analysis tool that supports multiple languages and uses code-like patterns for bug detection. ```text Lightweight static analysis for many languages. Find bug variants with patterns that look like source code. ``` -------------------------------- ### ChatGPT Connector Configuration for Semgrep MCP Source: https://github.com/semgrep/mcp Provides step-by-step instructions for configuring a ChatGPT connector to interface with Semgrep's MCP (Model Communication Protocol) server. This enables AI-driven code analysis and interaction. ```APIDOC Connector Setup: - Navigate to Connector Settings page (direct link: https://chatgpt.com/admin/ca#settings/ConnectorSettings?create-connector=true) - Connection Name: Set to "Semgrep" - MCP Server URL: Set to "https://mcp.semgrep.ai/sse" - Authentication: Select "No authentication" - Trust Application: Check the "I trust this application" checkbox - Finalize: Click "Create" Notes: - mcp.semgrep.ai is an experimental server and may change rapidly. - Refer to official OpenAI docs for more details on MCP: https://platform.openai.com/docs/mcp ``` -------------------------------- ### Configure Windsurf MCP with Semgrep Source: https://github.com/semgrep/mcp This snippet shows how to configure the Windsurf MCP server to use Semgrep. It involves adding a JSON block to your `~/.codeium/windsurf/mcp_config.json` file, specifying the command and arguments for the Semgrep MCP server. This enables Windsurf to integrate with Semgrep for code analysis. ```json { "mcpServers": { "semgrep": { "command": "uvx", "args": [ "semgrep-mcp" ] } } } ``` -------------------------------- ### Run Semgrep MCP Docker Container Source: https://github.com/semgrep/mcp Instructions for running the Semgrep MCP server as a Docker container. It's published on GitHub's Container Registry. The container requires interactive mode (`-i`) and the `-t stdio` flag to operate correctly, especially when using stdio mode. ```dockerfile docker run -i --rm ghcr.io/semgrep/mcp -t stdio ``` -------------------------------- ### Initialize FullStory Source: https://semgrep.dev/registry Initializes FullStory for session recording and user analytics. This script configures FullStory with the organization ID and script source, enabling detailed user session playback and analysis. ```javascript !(function (m, n, e, t, l, o, g, y) { var s, f, a = (function (h) { return ( !(h in m) || (m.console && m.console.log && m.console.log('FullStory namespace conflict. Please set window["_fs_namespace"].'), !1) ); })(e); function p(b) { var h, d = []; function j() { h && (d.forEach(function (b) { var d; try { d = b[h[0]] && b[h[0]](h[1]); } catch (h) { return void (b[3] && b[3](h)); } d && d.then ? d.then(b[2], b[3]) : b[2] && b[2](d); }), (d.length = 0)); } function r(b) { return function (d) { h || ((h = [b, d]), j()); }; } return ( b(r(0), r(1)), { then: function (b, h) { return p(function (r, i) { d.push([b, h, r, i]), j(); }); }, } ); } a && ((g = m[e] = (function () { var b = function (b, d, j, r) { function i(i, c) { h(b, d, j, i, c, r); } r = r || 2; var c, u = /Async$/; return u.test(b) ? ((b = b.replace(u, '')), 'function' == typeof Promise ? new Promise(i) : p(i)) : h(b, d, j, c, c, r); }; function h(h, d, j, r, i, c) { return b._api ? b._api(h, d, j, r, i, c) : (b.q && b.q.push([h, d, j, r, i, c]), null); } return (b.q = []), b; })()), (y = function (b) { function h(h) { 'function' == typeof h[4] && h[4](new Error(b)); } var d = g.q; if (d) { for (var j = 0; j < d.length; j++) h(d[j]); (d.length = 0), (d.push = h); } }), (function () { (o = n.createElement(t)).async = !0; o.crossOrigin = 'anonymous'; o.src = 'https://' + l; o.onerror = function () { y('Error loading ' + l); }; var b = n.getElementsByTagName(t)[0]; b && b.parentNode ? b.parentNode.insertBefore(o, b) : n.head.appendChild(o); })(), (function () { function b() {} function h(b, h, d) { g(b, h, d, 1); } function d(b, d, j) { h('setProperties', { type: b, properties: d }, j); } function j(b, h) { d('user', b, h); } function r(b, h, d) { j({ uid: b }, d), h && j(h, d); } (g.identify = r), (g.setUserVars = j), (g.identifyAccount = b), (g.clearUserCookie = b), (g.setVars = d), (g.event = function (b, d, j) { h('trackEvent', { name: b, properties: d }, j); }), (g.anonymize = function () { r(!1); }), (g.shutdown = function () { h('shutdown'); }), (g.restart = function () { h('restart'); }), (g.log = function (b, d) { h('log', { level: b, msg: d }); }), (g.consent = function (b) { h('setIdentity', { consent: !arguments.length || b }); }); })(), (s = 'fetch'), (f = 'XMLHttpRequest'), (g._w = {}), (g._w[f] = m[f]), (g._w[s] = m[s]), m[s] && (m[s] = function () { return g._w[s].apply(this, arguments); }), (g._v = '2.0.0')); })(window, document, window._fs_namespace, 'script', window._fs_script); ``` -------------------------------- ### Configure Claude Desktop MCP with Semgrep Source: https://github.com/semgrep/mcp This snippet demonstrates how to configure Claude Desktop's MCP server to integrate with Semgrep. It requires adding a specific JSON block to your `claude_desktop_config.json` file. This configuration defines the command and arguments needed for Semgrep's MCP server to function within Claude Desktop. ```json { "mcpServers": { "semgrep": { "command": "uvx", "args": [ "semgrep-mcp" ] } } } ``` -------------------------------- ### Run Semgrep MCP Docker Image with SSE Source: https://github.com/semgrep/mcp Launches the Semgrep MCP Docker container, mapping port 8000 and enabling Server-Sent Events (SSE) transport. This allows clients to connect to the server for streaming communication. ```shell docker run -p 8000:0000 ghcr.io/semgrep/mcp -t sse ``` -------------------------------- ### Windsurf MCP Configuration Source: https://github.com/semgrep/mcp JSON configuration for Windsurf to connect to the Semgrep MCP server, specifying the command and arguments. ```json { "mcpServers": { "semgrep": { "command": "uvx", "args": ["semgrep-mcp"] } } } ``` -------------------------------- ### Cursor IDE MCP Configuration Source: https://github.com/semgrep/mcp JSON configuration for Cursor IDE to connect to the Semgrep MCP server, specifying the command and arguments. ```json { "mcpServers": { "semgrep": { "command": "uvx", "args": ["semgrep-mcp"] } } } ``` -------------------------------- ### VS Code User Settings MCP Configuration Source: https://github.com/semgrep/mcp JSON configuration for VS Code User Settings to integrate Semgrep MCP, defining the server command and arguments. ```json { "mcp": { "servers": { "semgrep": { "command": "uvx", "args": ["semgrep-mcp"] } } } } ``` -------------------------------- ### Cursor IDE Streamable HTTP MCP Server Configuration Source: https://github.com/semgrep/mcp Configuration for Cursor IDE to connect to a streamable HTTP MCP server, specifically pointing to the hosted Semgrep MCP service. This enables real-time interaction with the server. ```json { "mcpServers": { "semgrep": { "type": "streamable-http", "url": "https://mcp.semgrep.ai/mcp" } } } ``` -------------------------------- ### Claude Desktop MCP Configuration Source: https://github.com/semgrep/mcp JSON configuration for Claude Desktop to connect to the Semgrep MCP server, specifying the command and arguments. ```json { "mcpServers": { "semgrep": { "command": "uvx", "args": ["semgrep-mcp"] } } } ``` -------------------------------- ### GitHub Feature Flags Configuration Source: https://github.com/semgrep/semgrep This snippet shows a JSON object containing feature flags and an API override URL, likely used for configuring GitHub product behavior or experimental features. ```json { "locale": "en", "featureFlags": [ "alternate_user_config_repo", "api_insights_show_missing_data_banner", "attestations_filtering", "attestations_sorting", "client_version_header", "code_scanning_security_configuration_ternary_state", "codespaces_prebuild_region_target_update", "contact_requests_implicit_opt_in", "contentful_lp_copilot_extensions", "contentful_lp_flex_features", "contentful_lp_footnotes", "copilot_activity_report", "copilot_chat_attach_multiple_images", "copilot_chat_floating_sidebar_focus_trap", "copilot_chat_group_notifications", "copilot_chat_vision_in_claude", "copilot_chat_vision_skip_thread_create", "copilot_chat_wholearea_dd", "copilot_custom_copilots_feature_preview", "copilot_custom_copilots_images", "copilot_duplicate_thread", "copilot_free_to_paid_telem", "copilot_ftp_hyperspace_upgrade_prompt", "copilot_ftp_settings_upgrade", "copilot_ftp_upgrade_to_pro_from_models", "copilot_ftp_your_copilot_settings", "copilot_immersive_agent_branch_selection", "copilot_immersive_draft_issue_template_form_ui", "copilot_immersive_structured_model_picker", "copilot_no_floating_button", "copilot_read_shared_conversation", "copilot_spaces_input_menu_select", "copilot_spaces_upsert_reload_in_background", "copilot_spark_allow_empty_commit", "copilot_spark_single_user_iteration", "copilot_spark_use_billing_headers", "copilot_spark_write_iteration_history_to_git", "copilot_task_oriented_assistive_prompts", "copilot_workbench_cache", "copilot_workbench_connection_reload_banner", "copilot_workbench_preview_analytics", "copilot_workbench_refresh_on_wsod", "copilot_workbench_synthetic_generation", "custom_copilots_128k_window", "custom_copilots_capi_mode", "custom_copilots_file_uploads", "direct_to_salesforce", "dotcom_chat_client_side_skills", "failbot_report_error_react_apps_on_page", "ghost_pilot_confidence_truncation_25", "ghost_pilot_confidence_truncation_40", "insert_before_patch", "issue_fields_report_usage", "issues_catch_non_json_graphql_response", "issues_comment_load_user_settings", "issues_label_search_url", "issues_preserve_tokens_in_urls", "issues_react_blur_item_picker_on_close", "issues_react_bots_timeline_pagination", "issues_react_create_milestone", "issues_react_prohibit_title_fallback", "issues_react_remove_placeholders", "issues_template_picker_redirect", "lifecycle_label_name_updates", "link_contact_sales_swp_marketo", "marketing_fullstory_sampling", "marketing_pages_search_explore_provider", "memex_mwl_filter_field_delimiter", "nonreporting_relay_graphql_status_codes", "primer_react_select_panel_with_modern_action_list", "remove_child_patch", "sample_network_conn_type", "scheduled_reminders_updated_limits", "site_homepage_contentful", "site_msbuild_hide_integrations", "site_msbuild_launch", "site_msbuild_webgl_hero", "spark_commit_on_default_branch", "spark_sync_repository_after_iteration", "swp_enterprise_contact_form", "use_paginated_repo_picker_cost_center_form", "viewscreen_sandbox", "workbench_default_sonnet4", "workbench_store_readonly" ], "copilotApiOverrideUrl": null } ``` -------------------------------- ### Run Semgrep MCP Python Package Source: https://github.com/semgrep/mcp Demonstrates how to run the Semgrep MCP Python package. By default, it operates in stdio mode, which means it uses standard input and output streams. This can make the tool appear unresponsive as it waits for input without visible output. ```shell semgrep-mcp ``` -------------------------------- ### Semgrep MCP Python Usage Source: https://github.com/semgrep/mcp Demonstrates how to run the semgrep-mcp Python package with different transport protocols: stdio, streamable-http, and sse. ```python # Default is stdio # semgrep-mcp # Explicitly use stdio # semgrep-mcp -t stdio # Use streamable HTTP # semgrep-mcp -t streamable-http # Use SSE # semgrep-mcp -t sse ``` -------------------------------- ### Semgrep MCP Configuration for VS Code Source: https://github.com/semgrep/mcp This JSON block configures Semgrep as an MCP server within VS Code's settings. It is intended to be added to the User Settings (JSON) file. The configuration specifies the command ('uvx') and arguments ('semgrep-mcp') for the Semgrep MCP server. ```json { "mcp": { "servers": { "semgrep": { "command": "uvx", "args": ["semgrep-mcp"] } } } } ``` -------------------------------- ### Run Semgrep MCP via Docker Container Source: https://github.com/semgrep/mcp Deploy and run the Semgrep MCP using a Docker container. This approach ensures consistent execution across different environments and simplifies dependency management. ```shell docker run -i --rm ghcr.io/semgrep/mcp -t stdio ``` -------------------------------- ### Semgrep MCP Configuration Source: https://github.com/semgrep/mcp Configuration snippet for Semgrep within the Model Context Protocol (MCP) framework. It specifies the command to execute and its arguments, enabling Semgrep to be used as a tool by LLMs. ```json { "mcpServers": { "semgrep": { "command": "uvx", "args": [ "semgrep-mcp" ] } } } ``` -------------------------------- ### VS Code MCP Configuration using Docker Source: https://github.com/semgrep/mcp JSON configuration for VS Code to use Semgrep MCP via Docker, specifying the Docker run command and arguments. ```json { "mcp": { "servers": { "semgrep": { "command": "docker", "args": [ "run", "-i", "--rm", "ghcr.io/semgrep/mcp", "-t", "stdio" ] } } } } ``` -------------------------------- ### Semgrep API and Resource References Source: https://github.com/semgrep/mcp References to Semgrep API endpoints and resources for fetching data like findings, supported languages, and rule schemas. These are conceptual references rather than executable code. ```APIDOC semgrep_findings: description: Fetch Semgrep findings from the Semgrep AppSec Platform API. method: GET endpoint: /findings authentication: Semgrep token required supported_languages: description: Return the list of languages Semgrep supports. method: GET endpoint: /languages semgrep_rule_schema: description: Fetches the latest semgrep rule JSON Schema. method: GET endpoint: /rule/schema semgrep_rule_yaml: description: Retrieve a full Semgrep rule in YAML format from the Semgrep registry. method: GET endpoint: /rule/{rule_id}/yaml parameters: rule_id: The unique identifier of the Semgrep rule. semgrep_rule_schema_json: description: Specification of the Semgrep rule YAML syntax using JSON schema. resource_uri: semgrep://rule/schema ``` -------------------------------- ### Run Semgrep MCP with SSE (Python) Source: https://github.com/semgrep/mcp Initiates the Semgrep MCP tool using Server-Sent Events (SSE) transport when running the Python package in stdio mode. This enables server-to-client streaming. ```shell semgrep-mcp -t sse ``` -------------------------------- ### Docker MCP Execution Configuration Source: https://github.com/semgrep/mcp Configuration for running Semgrep MCP using Docker. This JSON snippet defines the Docker image and the necessary command-line arguments to execute Semgrep MCP in a containerized environment. ```json { "mcp": { "servers": { "semgrep": { "command": "docker", "args": [ "run", "-i", "--rm", "ghcr.io/semgrep/mcp", "-t", "stdio" ] } } } } ``` -------------------------------- ### VS Code Workspace MCP Configuration Source: https://github.com/semgrep/mcp JSON configuration for a VS Code workspace-specific `.vscode/mcp.json` file to connect to Semgrep MCP. ```json { "servers": { "semgrep": { "command": "uvx", "args": ["semgrep-mcp"] } } } ``` -------------------------------- ### Set Semgrep API Token (CLI) Source: https://github.com/semgrep/mcp This snippet shows how to export the Semgrep API token as an environment variable for command-line usage. Ensure you replace '' with your actual generated token. ```bash export SEMGREP_APP_TOKEN= ``` -------------------------------- ### Semgrep MCP Server Configuration Source: https://github.com/semgrep/mcp JSON configuration for setting up Semgrep MCP servers. This defines the 'semgrep' server with its type as 'streamable-http' and provides the corresponding URL. ```json { "mcpServers": { "semgrep": { "type": "streamable-http", "url": "https://mcp.semgrep.ai/mcp" } } } ``` -------------------------------- ### Set Semgrep API Token (Docker) Source: https://github.com/semgrep/mcp This snippet demonstrates how to pass the Semgrep API token as an environment variable when running a Docker container. Replace '' with your actual token. ```bash docker run -e SEMGREP_APP_TOKEN= ``` -------------------------------- ### VS Code MCP Configuration Source: https://github.com/semgrep/mcp Configuration for Semgrep MCP within a VS Code workspace. This JSON file, typically located at `.vscode/mcp.json`, specifies the command and arguments to run Semgrep MCP. ```json { "servers": { "semgrep": { "command": "uvx", "args": [ "semgrep-mcp" ] } } } ``` -------------------------------- ### Run Semgrep MCP with Docker Source: https://github.com/semgrep/mcp Launch Semgrep MCP using a Docker container. This command maps port 8000 on the host to port 0000 in the container. ```shell docker run -p 8000:0000 ghcr.io/semgrep/mcp ``` -------------------------------- ### Semgrep API Token Environment Variable Configuration Source: https://github.com/semgrep/mcp This JSON snippet illustrates the structure for configuring the Semgrep API token within an environment configuration file or object. The SEMGREP_APP_TOKEN key should be set to your valid API token. ```json { "env": { "SEMGREP_APP_TOKEN": "" } } ``` -------------------------------- ### Semgrep AppSec Token Environment Variable Source: https://github.com/semgrep/mcp Demonstrates how to set the SEMGREP_APP_TOKEN environment variable for CLI, Docker, and MCP configuration JSON. ```shell export SEMGREP_APP_TOKEN= ``` -------------------------------- ### Semgrep MCP Stdio Transport (Docker) Source: https://github.com/semgrep/mcp Runs the Semgrep MCP server in Docker using the stdio transport, enabling communication via standard input and output streams. The '-i' flag is required for interactive mode. ```docker docker run -i --rm ghcr.io/semgrep/mcp -t stdio ``` -------------------------------- ### Semgrep Security Rule for Cursor Source: https://github.com/semgrep/mcp This snippet defines a rule to be added to Cursor's `.cursor/rules` directory. It instructs the AI to always scan code generated using Semgrep for security vulnerabilities, enhancing code safety. ```text Always scan code generated using Semgrep for security vulnerabilities ``` -------------------------------- ### Semgrep Metrics Configuration Source: https://github.com/semgrep/semgrep Manage Semgrep's pseudonymous rule metrics reporting. Metrics are collected for remote configurations from the Registry and for local configurations when the user is logged in. Use `--metrics=off` to disable reporting. ```cli semgrep --config=p/ci semgrep --config=xyz.yml semgrep --metrics=off ``` -------------------------------- ### Semgrep MCP Streamable HTTP Transport (Docker) Source: https://github.com/semgrep/mcp Runs the Semgrep MCP server in Docker, exposing the streamable HTTP transport. The server defaults to listening on 127.0.0.1:8000/mcp. Port 8000 is mapped to the host. ```docker docker run -p 8000:8000 ghcr.io/semgrep/mcp ``` -------------------------------- ### FullStory API Source: https://semgrep.dev/registry Provides documentation for the FullStory JavaScript API methods used for user identification, event tracking, and session management. These methods allow for detailed user behavior analysis and debugging. ```APIDOC FullStory API: __init__(namespace: str, scriptUrl: str) Initializes the FullStory SDK with the provided namespace and script URL. identify(uid: any, userVars?: object, callback?: function) Identifies a user with a unique ID and optional user variables. This is crucial for linking sessions to specific users. - uid: The unique identifier for the user. - userVars: An object containing additional properties for the user. - callback: A function to be called after identification. setUserVars(userVars: object, callback?: function) Sets or updates user variables for the current session. - userVars: An object containing user properties. - callback: A function to be called after setting variables. identifyAccount(accountVars?: object, callback?: function) Identifies an account with optional account variables. - accountVars: An object containing account properties. - callback: A function to be called after identification. clearUserCookie() Clears the user cookie, effectively anonymizing the current session. setVars(type: str, properties: object, callback?: function) Sets general properties for the session. - type: The type of property (e.g., 'user'). - properties: An object containing the properties to set. - callback: A function to be called after setting properties. event(name: str, properties?: object, callback?: function) Tracks a custom event with an optional name and properties. - name: The name of the event. - properties: An object containing event-specific properties. - callback: A function to be called after tracking the event. anonymize() Anonymizes the current session. shutdown() Shuts down the FullStory recording. restart() Restarts the FullStory recording. log(level: str, msg: str) Logs a message with a specified level (e.g., 'info', 'error'). - level: The logging level. - msg: The message to log. consent(consent: boolean) Manages user consent for data recording. - consent: A boolean indicating whether consent is granted. ``` -------------------------------- ### Semgrep MCP API - Code Analysis Tools Source: https://github.com/semgrep/mcp Defines the available tools within the Semgrep MCP API for LLMs to perform actions. These include scanning code for security vulnerabilities and generating Abstract Syntax Trees (ASTs). ```APIDOC Tools: security_check: Scan code for security vulnerabilities semgrep_scan: Scan code files for security vulnerabilities with a given config string semgrep_scan_with_custom_rule: Scan code files using a custom Semgrep rule get_abstract_syntax_tree: Output the Abstract Syntax Tree (AST) of code ``` -------------------------------- ### Semgrep API Endpoint Source: https://semgrep.dev/docs/ API documentation for Semgrep's v1 API. This entry details the base URL for accessing the API, which is used for programmatic interaction with Semgrep services. ```APIDOC Semgrep API v1: Base URL: https://semgrep.dev/api/v1/docs ```