다음을 통해 공유


Microsoft Sentinel MCP 서버 시작

중요

이 게시물의 일부 정보는 상용으로 출시되기 전에 실질적으로 수정될 수 있는 사전 릴리스된 제품과 관련이 있습니다. Microsoft는 여기에서 제공하는 정보와 관련하여 명시적이거나 묵시적인 어떠한 보증도 제공하지 않습니다.

Microsoft Sentinel MCP(모델 컨텍스트 프로토콜) 서버의 에이전트 생성 도구 컬렉션을 사용하면 개발자가 자연어를 사용하여 MCP 호환 IDE 내에서 Security Copilot 에이전트를 빌드할 수 있습니다.

이 시작에서는 다음 방법을 알아봅니다.

  • MCP 서버 설정 및 인증

  • GitHub Copilot 에이전트 모드 사용

  • MCP 도구에 대한 컨텍스트 관리

필수 구성 요소

Microsoft Sentinel MCP 서버를 사용하고 도구에 액세스하려면 Microsoft Sentinel 데이터 레이크 온보딩해야 합니다. 자세한 내용은 Microsoft Sentinel 데이터 레이크 온보딩 및 Microsoft Sentinel 그래프(미리 보기)를 참조하세요.

지원되는 코드 편집기

Security Copilot 에이전트 생성 MCP 도구에 대한 Microsoft Sentinel의 지원은 다음 AI 기반 코드 편집기에서 사용할 수 있습니다.

MCP 서버 설정 및 인증

MCP 서버를 설치하는 단계는 다음과 같습니다.

  1. VISUAL STUDIO CODE(VS Code)를 시작합니다.

  2. VS Code에서 MCP 서버 연결을 추가합니다. 키를 입력 Ctrl + Shift + P 하여 명령 팔레트를 엽니다. 기호 >를 입력한 다음 텍스트 MCP: Add server를 입력합니다.

    VS 코드에서 MCP 서버를 추가하는 이미지

  3. 를 선택합니다 HTTP (HTTP or Server-Sent Events).

    VS 코드에서 HTTP SSE 옵션을 선택하는 이미지

  4. 다음 서버 URL을 입력하고 Enter 키를 선택합니다. 이 URL은 대/소문자를 구분합니다.

        https://sentinel.microsoft.com/mcp/security-copilot-agent-creation
    
  5. 친숙한 서버 ID를 입력합니다.

    VS 코드에서 사용자 지정 서버 ID를 추가하는 이미지

  6. 서버를 신뢰 하라는 메시지가 표시됩니다.

    VS 코드에서 트러스트 서버를 선택하는 이미지

  7. 서버 정의를 인증하라는 메시지가 표시되면 허용 을 선택합니다.

    서버가 Security Copilot 인증하도록 허용을 선택하는 이미지

  8. 모든 VS Code 작업 영역에서 서버를 사용할 수 있도록 할지 아니면 현재 작업 영역에서만 사용할 수 있도록 할지 선택합니다.

    VS 코드에서 작업 영역을 선택하는 이미지

  9. 인증되면 서버가 실행을 시작해야 하며 VS Code 작업 영역에서 MCP 서버 구성을 확인하는 라는 mcp.json 파일이 표시됩니다.

    MCP 서버 실행이 시작되었음을 보여 주는 이미지

GitHub Copilot 에이전트 모드 사용

  1. VS Code의 채팅 >보기 메뉴 >채팅 을 열거나 을 누릅니다 CRTL + ALT + I.

  2. 채팅을 에이전트 모드로 설정합니다.

    채팅에서 에이전트 모드를 표시하는 이미지

  3. 프롬프트 표시줄에서 도구 아이콘을 선택합니다.

    채팅에서 에이전트 도구를 표시하는 이미지

  4. GitHub Copilot 사용하는 도구 목록을 볼 수 있습니다. 방금 추가한 MCP 서버의 행을 확장하여 에이전트 빌드를 위한 5가지 도구를 확인합니다.

    MCP 서버 목록 도구를 표시하는 이미지

MCP 도구에 대한 컨텍스트 관리

올바른 컨텍스트를 제공하면 VS Code의 AI로부터 도움을 받아 관련성이 있고 정확한 응답을 제공할 수 있습니다. 이 섹션에서는 컨텍스트를 관리하고 AI 도우미 의도한 대로 더 높은 일관성으로 MCP 도구를 사용하도록 하는 두 가지 옵션을 설명합니다.

다음 옵션 중 하나를 선택하여 컨텍스트를 관리할 수 있습니다.

  1. 사용자 지정 지침

  2. 컨텍스트 파일 추가

사용자 지정 지침

사용자 지정 지침을 사용하면 Markdown 파일에서 일반적인 지침 또는 규칙을 정의하여 작업을 수행하는 방법을 설명할 수 있습니다. 모든 채팅 프롬프트에 컨텍스트를 수동으로 포함하는 대신 Markdown 파일에 사용자 지정 지침을 지정하여 프로젝트 요구 사항에 맞는 일관된 AI 응답을 보장합니다.

모든 채팅 요청 또는 특정 파일에만 자동으로 적용되도록 사용자 지정 지침을 구성할 수 있습니다.

사용자 지정 지침 파일 사용

작업 영역 루트의 단일 .github/copilot-instructions.md Markdown 파일에서 사용자 지정 지침을 정의합니다. VS Code는 이 파일의 지침을 이 작업 영역 내의 모든 채팅 요청에 자동으로 적용합니다.

파일을 사용하는 .github/copilot-instructions.md 단계:

  1. github.copilot.chat.codeGeneration.useInstructionFiles 설정을 사용하도록 설정합니다.

  2. .github/copilot-instructions.md 작업 영역의 루트에 파일을 만듭니다. 필요한 경우 먼저 디렉터리를 만듭니 .github 다.

    VS 코드에서 컨텍스트를 관리하는 사용자 지정 지침을 추가하는 이미지

  3. 자연어를 사용하고 Markdown 형식으로 지침을 설명합니다.

  4. 시작하려면 컨텍스트 파일의 내용을 파일에 scp-mcp-context.md 복사합니다 copilot-instructions.md . MCP 컨텍스트를 참조하세요.

컨텍스트 파일 추가

AI 도우미 의도한 대로 MCP 도구를 더 일관성 있게 사용할 수 있도록 하려면 이 컨텍스트 파일을 IDE에 추가합니다. 메시지를 표시할 때 AI 도우미 이 파일을 참조하는지 확인합니다.

  1. VS Code에 컨텍스트 scp-mcp-context.md 를 추가하거나 작업 영역에 직접 붙여넣습니다. 컨텍스트 파일을 사용하여 MCP 컨텍스트를 참조하세요. 작업 영역은 다음과 같습니다.

    작업 영역에 추가된 MCP 컨텍스트 파일을 표시하는 이미지

  2. 프롬프트 표시줄에서 컨텍스트 추가 를 선택하고 컨텍스트 파일을 선택합니다.

    프롬프트 표시줄에 추가된 MCP 컨텍스트 파일을 표시하는 이미지

MCP 도구에 대한 컨텍스트 파일

scp-mcp-context.md 빠른 시작과 함께 사용할 을 복사합니다.


# MCP Tools Available for Agent Building
    1. **start_agent_creation**
        - **Purpose**: Creates a new Security Copilot session and starts the agent building process.
        - The userQuery input will be the user's problem statement (what they want the agent to do).
        - The output of the tool should be returned IN FULL WITHOUT EDITS.
        - The tool will return an initial agent YAML definition.
    2. **compose_agent**
        - **Purpose**: Continues the session and agent building process created by *start_agent_creation*. Outputs agent definition YAML or can ask clarifying questions to the user.
        - The sessionId input is obtained from the output of *start_agent_creation*
        - The existingDefinition input is optional. If an agent definition YAML has not been created yet, this should be blank (can be an empty string).
    3. **search_for_tools**
        - **Purpose: Discover relevant skills (tools) based on the user's query
        - This will create a new Security Copilot session, but it should not be included in the start_agent/continue_agent flow.
          - A user might want to know about Security Copilot skills they have access to without wanting to create an agent
          - The session ID created should NOT be reused in any capacity
    4. **get_evaluation**
        - **Purpose: Get the results of the evaluations triggered by each of the above tools. You MUST repeatedly activate this tool until the property of the result "state" is equal to "Completed" in order to get the fully processed result. The "state" may equal "Created" or "Running" but again, you must repeat the process until the state is "Completed". There is NO MAXIMUM amount of times you might call this tool in a row.
    5. **deploy_agent**
        - **Purpose: Deploy an agent to Security Copilot.
        - The user must provide the scope as either "User" or "Workspace".
        - Unless they already have an AGENT definition yaml provided, *start_agent_creation* must be run before to generate an agentDefinition
        - "agentSkillsetName" should be COPIED EXACTLY from the value of "Descriptor: Name:" in the agent definition YAML, including any special characters like ".". This will NOT work if the two do not match EXACTLY.
        - DO NOT use *get_evaluation* after this tool.

# Agent Building Execution Flow

## Step 1: Problem Statement Check
- If the user did **not** provide a problem statement, prompt them to do so.
- If the user **did** provide a problem statement, proceed to Step 2.

## Step 2: Start Agent Creation
- Use the `start_agent_creation` tool with `userQuery = <problem statement>`.
  - **DO NOT** include any quotation marks in the userQuery
- Then, use `get_evaluation` to retrieve the initial response.
  - **DO** repeatedly call `get_evaluation` until the `"state"` property of the result equals `"Completed"`.
  - **DO NOT** require the user to ask again to get the results.
  - **DO NOT** edit or reword the response content.

## Step 2.5: Output Handling
- **DO NOT** reformat, summarize, or describe the YAML output.
- **DO** return the YAML output **verbatim**.
- **DO** return the output in **AGENT FORMAT**.

## Step 3: Agent Refinement
- Ask the user if they would like to edit the agent or if they would like to deploy the agent. If they want to deploy, skip to **Step 4**.
- If the user wants to edit the agent definition:
  - If they respond with edits directly, use `compose_agent` with:
    - `sessionId` from `start_agent_creation`
    - `existingDefinition = <previous AGENT YAML>`
      - `\n` MUST be rewritten as `\\n`
    - `userQuery = <user’s new input>`
      - **DO NOT** include any quotation marks in the userQuery
  - If they attach a manually edited YAML file to the context, use the file content as `existingDefinition`.
    - **DO NOT** edit the file directly, you MUST use `compose_agent`
    - `\n` MUST be rewritten as `\\n`

## Step 4: Agent Deployment
- If the user asks to deploy the agent, use `deploy_agent`.
  - You **must confirm the scope**: either `"User"` or `"Workspace"`.
    - If not provided, ask the user to specify.
  - `agentSkillsetName` must **exactly match** the value of `Descriptor: Name:` in the YAML.
    - This includes any special characters.
  - Leave existing instances of `\n` inside `agentDefinition` as-is
- **DO NOT** run `get_evaluation` after deployment.
- **DO** include all of these things in the tool response to the user:
    1. Confirm successful deployment to the user
    2. Direct the user to the Security Copilot portal to test and view the agent with this link: https://securitycopilot.microsoft.com/agents
    3. Direct the user to read more on how to test their agent in Security Copilot with this link: https://learn.microsoft.com/en-us/copilot/security/developer/mcp-quickstart#test-agent

## Step 5: Further Agent Refinement and Redeployment
- After deployment, the user may still want to **edit the agent definition**.
  - If so, you must support calling `compose_agent` again.
  - Follow the same process as described in **Step 3**:
    - If the user asks for edits directly, use the previous AGENT YAML as `existingDefinition`.
    - If the user uploads a manually edited YAML file, use the file content as `existingDefinition`.
- The user may also want to **redeploy the agent** after making refinements.
  - You must run `deploy_agent` again using the updated YAML.
  - Ensure the `agentSkillsetName` matches **exactly** the value of `Descriptor: Name:` in the latest YAML, including any special characters.
  - Leave existing instances of `\n` inside `agentDefinition` as-is
  - Confirm the deployment scope: either `"User"` or `"Workspace"`.
    - If the scope is not provided, prompt the user to specify.
  - Do **not** run `get_evaluation` after deployment.
  - Confirm successful redeployment to the user.
- Alternatively, the user may want to **create a new agent**.
  - Restart the procedure from **Step 1**.
  - When using `start_agent_creation`, a new session ID will be created.
  - **DO** keep track of which session IDs correspond to which problem statements or agents so the user can return to previous sessions if needed.

## Additional Rules
- Only call `compose_agent` **after** the user has provided a response. Do not proceed automatically.
- Agent creation must remain **user-driven**. Do not initiate steps without explicit user input.
- Wait for the user to respond before continuing to the next step.
- Tool responses must be returned **directly to the user** in full.
  - Do **not** alter, reformat, summarize, or reword the content of any tool response.
  - This applies specifically to the `"result": "content"` field in the JSON returned by tool executions.
  - LEAVE OUT any "Grounding Notes"

## Error Handling
- If any tool call fails:
  - Inform the user of the failure.
  - If it is a client error, make an attempt to retry the tools, rewriting inputs based on the error message.
    - Example: If the error indicates invalid JSON characters, escape or remove those characters from the input and retry. Always attempt escaping first.

다음 단계