Working with an MCP server in SourceCraft

Warning

This feature is only available in Visual Studio Code.

With SourceCraft MCP, you can manage SourceCraft entities though the Code Assistant chat interface, e.g., search for and complete issues, create pull requests, 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 any other IDE plugin that supports MCP.

Set up your environment

For this tutorial, you will need the following tools:

Install MCP

  1. In VSCode, click the plugin icon in the left-hand panel.
  2. In the panel that opens, select Settings.
  3. Go to MCP servers.
  4. Select Enable MCP servers and click MCP Marketplace.
  5. Find SourceCraft and then click Install.

Prepare a repository

  1. Create an empty repository, e.g., mcp-test.

  2. Add to the created repository a file named hello.py with the following contents:

    print("Hello, World")
    
  3. Create an issue titled Add a version in Russian with the following description:

    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

In this example, we used the mcp-test public repository in the organization 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 in the left-hand panel.

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

    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.

  3. Clone the repository using Code Assistant:

    Now clone the repository.
    

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

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

    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.

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

    Test the code.
    

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

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

    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.

  7. Find the new pull request in the SourceCraft interface, review it, and merge it into the main branch.

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

    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.

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.

See also