---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.6
alternate:
  - https://sourcecraft.dev/portal/docs/en/code-assistant/operations/agent/mcp/work-with-mcp.md
  - https://sourcecraft.dev/portal/docs/ru/code-assistant/operations/agent/mcp/work-with-mcp.md
title: Working with MCP in SourceCraft Code Assistant
description: How to work with a SourceCraft MCP server to perform repository tasks via the Code Assistant chat.
---
> **Documentation Index:** Fetch the complete configuration index at https://sourcecraft.dev/portal/docs/en/llms.txt


<!-- source: en/_includes/code-assistant/work-with-mcp.md -->
# Working with an MCP server SourceCraft

<!-- source: en/_includes/code-assistant/only-in-vscode.md -->
{% note warning %}

This feature is only available in Visual Studio Code.

{% endnote %}
<!-- endsource: en/_includes/code-assistant/only-in-vscode.md -->

With [SourceCraft MCP](https://sourcecraft.dev/portal/docs/en/code-assistant/operations/agent/mcp/recommended-mcp-servers.md#src), you can manage SourceCraft entities though the Code Assistant chat interface, e.g., search for and complete [issues](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/index.md#issues), create [pull requests](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/index.md#pr), and more.

In this guide, we will use Code Assistant and SourceCraft MCP to find an issue in a repository, make the necessary changes, push them to the repository, and then close the issue.

The example uses the SourceCraft Code Assistant plugin to manage the MCP server, but you can [select](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/connect-to-mcp.md) any other IDE plugin that supports MCP.

<!-- source: en/_includes/code-assistant/recommended-mcp-servers.md -->
{% note info %}

You can view the list of Yandex Cloud and SourceCraft MCP servers, as well as recommended MCP servers, in [MCP servers](https://sourcecraft.dev/portal/docs/en/code-assistant/operations/agent/mcp/recommended-mcp-servers.md#servers).

{% endnote %}
<!-- endsource: en/_includes/code-assistant/recommended-mcp-servers.md -->

## Set up your environment {#prepare}

For this tutorial, you will need the following tools:
* [Visual Studio Code](https://code.visualstudio.com/download)
* [SourceCraft Code Assistant plugin for Visual Studio Code](https://sourcecraft.dev/portal/docs/en/code-assistant/index.md)
* [Git](https://git-scm.com/downloads)
* [Python](https://www.python.org/downloads/)

## Install MCP {#install-mcp}

1. In VSCode, click the plugin icon <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16"><g fill="#000" clip-path="url(#svg-5hnt4uqg__clip0_1068_334)"><path fill-rule="evenodd" d="M5.2 1A1.2 1.2 0 0 0 4 2.2v10.299a.5.5 0 0 0 .853.354L6.706 11H14.8A1.2 1.2 0 0 0 16 9.8V2.2A1.2 1.2 0 0 0 14.8 1H5.2Zm5.273 1.5L8 9.5h1.527L12 2.5h-1.527Z" clip-rule="evenodd"/><path d="M1.2 3H3v1H1.2a.2.2 0 0 0-.2.2v9.6c0 .11.09.2.2.2h11.6a.2.2 0 0 0 .2-.2V12h1v1.8a1.2 1.2 0 0 1-1.2 1.2H1.2A1.2 1.2 0 0 1 0 13.8V4.2A1.2 1.2 0 0 1 1.2 3Z"/></g><defs><clipPath id="svg-5hnt4uqg__clip0_1068_334"><path fill="#fff" d="M0 0h16v16H0z"/></clipPath></defs></svg> in the left-hand panel.
1. In the panel that opens, select <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="currentColor" fill-rule="evenodd" d="M7.199 2H8.8a.2.2 0 0 1 .2.2c0 1.808 1.958 2.939 3.524 2.034a.2.2 0 0 1 .271.073l.802 1.388a.2.2 0 0 1-.073.272c-1.566.904-1.566 3.164 0 4.069a.2.2 0 0 1 .073.271l-.802 1.388a.2.2 0 0 1-.271.073C10.958 10.863 9 11.993 9 13.8a.2.2 0 0 1-.199.2H7.2a.2.2 0 0 1-.2-.2c0-1.808-1.958-2.938-3.524-2.034a.2.2 0 0 1-.272-.073l-.8-1.388a.2.2 0 0 1 .072-.271c1.566-.905 1.566-3.165 0-4.07a.2.2 0 0 1-.073-.27l.801-1.389a.2.2 0 0 1 .272-.072C5.042 5.138 7 4.007 7 2.199c0-.11.089-.199.199-.199M5.5 2.2c0-.94.76-1.7 1.699-1.7H8.8c.94 0 1.7.76 1.7 1.7a.85.85 0 0 0 1.274.735 1.7 1.7 0 0 1 2.32.622l.802 1.388c.469.813.19 1.851-.622 2.32a.85.85 0 0 0 0 1.472 1.7 1.7 0 0 1 .622 2.32l-.802 1.388a1.7 1.7 0 0 1-2.32.622.85.85 0 0 0-1.274.735c0 .939-.76 1.7-1.699 1.7H7.2a1.7 1.7 0 0 1-1.699-1.7.85.85 0 0 0-1.274-.735 1.7 1.7 0 0 1-2.32-.622l-.802-1.388a1.7 1.7 0 0 1 .622-2.32.85.85 0 0 0 0-1.471 1.7 1.7 0 0 1-.622-2.32l.801-1.389a1.7 1.7 0 0 1 2.32-.622A.85.85 0 0 0 5.5 2.2m4 5.8a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M11 8a3 3 0 1 1-6 0 3 3 0 0 1 6 0" clip-rule="evenodd"/></svg> **Settings**.
1. Go to **MCP servers**.
1. Select **Enable MCP servers** and click **MCP Marketplace**.
1. Find **SourceCraft** and then click **Install**.

## Prepare a repository {#create-repo}

1. [Create an empty repository](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/repo-create.md#create-empty), e.g., `mcp-test`.
1. [Add](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/add-file-repo.md) to the created repository a file named `hello.py` with the following contents:

   ```python
   print("Hello, World")
   ```

1. [Create](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/issue-create.md) an issue titled _Add a version in Russian_ with the following description:

   ```text
   Add an alternative option in Russian to the hello.py file. The user will select the language when running the file.
   ```

## Send your requests to the chat {#send-requests}

In this example, we used the `mcp-test` public repository in the [organization](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/index.md#org) named `orgname`. Use your own names for requests to Code Assistant.

The results may vary depending on the model and selected behavior mode.

1. In VSCode, click the plugin icon <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16"><g fill="#000" clip-path="url(#svg-c7rpzl2w__clip0_1068_334)"><path fill-rule="evenodd" d="M5.2 1A1.2 1.2 0 0 0 4 2.2v10.299a.5.5 0 0 0 .853.354L6.706 11H14.8A1.2 1.2 0 0 0 16 9.8V2.2A1.2 1.2 0 0 0 14.8 1H5.2Zm5.273 1.5L8 9.5h1.527L12 2.5h-1.527Z" clip-rule="evenodd"/><path d="M1.2 3H3v1H1.2a.2.2 0 0 0-.2.2v9.6c0 .11.09.2.2.2h11.6a.2.2 0 0 0 .2-.2V12h1v1.8a1.2 1.2 0 0 1-1.2 1.2H1.2A1.2 1.2 0 0 1 0 13.8V4.2A1.2 1.2 0 0 1 1.2 3Z"/></g><defs><clipPath id="svg-c7rpzl2w__clip0_1068_334"><path fill="#fff" d="M0 0h16v16H0z"/></clipPath></defs></svg> in the left-hand panel.

1. In the chat that opens, ask Code Assistant to display a list of issues:

   ```text
   Show a list of issues in the mcp-test repository of the organization named orgname.
   ```

   The assistant will use the `ListRepositoryIssues` tool to display the list of issues. Depending on your plugin settings, you may need to approve the request.

1. Clone the repository using Code Assistant:

   ```text
   Now clone the repository.
   ```

   The assistant will get the clone link using the `GetRepository` tool and then run the `git clone` command.

1. Ask Code Assistant to complete the issue in a new repository branch:

   ```text
   Create a new repository branch and complete the previously mentioned issue of adding a version in Russian.
   ```

   The assistant will edit the `hello.py` file and add a commit with the changes using `git`.

1. If Code Assistant did not test the edited code in the previous step, ask it to do so:

   ```text
   Test the code.
   ```

   The assistant will test the updated code and display the test results.

1. Create a new pull request in the repository using the assistant:

   ```text
   Create a new pull request from the branch in the repository and link it to the previously mentioned issue.
   ```

   The assistant will get the issue information in the repository using the `GetRepository` and `GetIssue` tools, push the changes to the remote repository via `git`, create a pull request using `CreatePullRequest`, and link it to the original issue via `AddLinkedPRs`.

1. Find the new pull request in the [SourceCraft interface](https://sourcecraft.dev), review it, and [merge it](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/pr-work.md#merge) into the main branch.

1. Ask Code Assistant to write a comment and close the issue:

   ```text
   In the issue, leave a comment stating the issue is complete and then close it.
   ```

   The assistant will open the issue using the `GetIssue` tool and then update it using the `CreateIssueComment` and `UpdateIssue` tools.

   To review the Code Assistant work, open the repository in a browser and make sure that the changes have been made and the task is closed.

{% note tip %}

This tutorial describes step-by-step commands for Code Assistant when working with SourceCraft MCP for more granular control over the agent's actions.

You can also describe all actions for Code Assistant to perform in a single general command and adjust the assistant as it proceeds.

{% endnote %}
<!-- endsource: en/_includes/code-assistant/work-with-mcp.md -->

#### Useful links {#see-also}

* [What is MCP](https://sourcecraft.dev/portal/docs/en/code-assistant/operations/agent/mcp/what-is-mcp.md)
* [MCP overview in SourceCraft Code Assistant](https://sourcecraft.dev/portal/docs/en/code-assistant/operations/agent/mcp/overview.md)
* [Using MCP in SourceCraft Code Assistant](https://sourcecraft.dev/portal/docs/en/code-assistant/operations/agent/mcp/using-mcp-in-ca.md)
* [MCP server transports: STDIO, Streamable HTTP, and SSE](https://sourcecraft.dev/portal/docs/en/code-assistant/operations/agent/mcp/server-transports.md)
* [What makes MCP different from the REST API](https://sourcecraft.dev/portal/docs/en/code-assistant/operations/agent/mcp/mcp-vs-api.md)
* [Recommended MCP servers](https://sourcecraft.dev/portal/docs/en/code-assistant/operations/agent/mcp/recommended-mcp-servers.md)