Add MCP Server to search repository content using VS Code
I’m very happy GitHub Copilot exists and lately with the Agent-mode it’s even better. It’s making sure I can focus on the relevant pieces of my solutions and not have to worry too much about the plumbing part.
The models it’s using are quite powerful and contains a lot of (old) data. When using new libraries or versions of already existing libraries, the LLMs used under the hood often don’t provide useful suggestions or edits. Currently, telling GitHub Copilot to check the repository of the library to as reference material doesn’t work the way I’d like it to.
I’ve tried this, but it only fetched the contents of the readme file of the repository and didn’t traverse all files and searching for relevant bits.
What I’d like is for GitHub Copilot to index the entire repository/repositories of my libraries of choice and provide me suggestions or edits based on the codebase or documentation.
I figured this can be achieved by adding this capability as an MCP server. Turns out, I’m not the only one who wants this. Leonid Bugaev has created an MCP server solution, docs-mcp, that can be used to search through repositories. It’s powered by Probe, also created by him.
Create an MCP server to search in repositories
The readme of the docs-mcp
repository contains all the information to set up your MCP server.
I want it to search through the Semantic Kernel repository, so the syntax will be this:
npx -y @buger/docs-mcp@latest --gitUrl https://github.com/microsoft/semantic-kernel
Don’t add a trailing slash to the gitUrl
, or you’ll get an error
Add the MCP server to VS Code
Adding this to VS Code is also fairly straightforward and the documentation helps a bit.
Create a file .vscode\mcp.json
in your repository (if you don’t have this already) and add the following.
{
"servers": {
"search_sk_repo": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@buger/docs-mcp@latest",
"--gitUrl",
"https://github.com/microsoft/semantic-kernel",
"--toolName",
"search_sk_repo",
"--toolDescription",
"Search Semantic Kernel repository"
]
}
}
}
When starting this service your GitHub Copilot chat is able to invoke this tool.
Checking the tools available, you’ll see it listed and enabled.
You are now able to invoke this tool when running prompts.
I think it should invoke it automatically, but from my experience it works better if you explicitly add it to your prompt context.
When running this prompt, it will figure out the tool should be used to perform certain actions, like searching how code should be written with the latest Semantic Kernel version. From my experience, doing this with the GPT-4.1 model isn’t working that good. Switching to Claude Sonnet 4 works much better. It’s also searching multiple times in the repository to learn specific things.
This is an excerpt from running one of my prompts, as you can see it’s invoking the tool multiple times.
2025-06-27 11:34:19.454 [warning] [server stderr] Search: query="ChatCompletionAgent InvokeAsync response handling" path="C:\Users\jandevries\AppData\Local\npm-cache\_npx\6836e08c2900d844\node_modules\@buger\docs-mcp\data" maxTokens=10000 timeout=600
2025-06-27 11:35:15.418 [warning] [server stderr]
2025-06-27 11:35:15.418 [warning] [server stderr] Search results: 52 matches, 5078 tokens, 21072 bytes
2025-06-27 12:22:50.171 [warning] [server stderr] Received request for tool: search_sk_repo
2025-06-27 12:22:50.171 [warning] [server stderr] Request arguments: {"query":"Step03_Chat AgentGroupChat sample"}
2025-06-27 12:22:50.171 [warning] [server stderr] Executing search with options: {
2025-06-27 12:22:50.171 [warning] [server stderr] "timeout": 600,
2025-06-27 12:22:50.171 [warning] [server stderr] "path": "C:\\Users\\jandevries\\AppData\\Local\\npm-cache\\_npx\\6836e08c2900d844\\node_modules\\@buger\\docs-mcp\\data",
2025-06-27 12:22:50.172 [warning] [server stderr] "query": "Step03_Chat AgentGroupChat sample",
2025-06-27 12:22:50.172 [warning] [server stderr] "maxTokens": 10000
2025-06-27 12:22:50.172 [warning] [server stderr] }
2025-06-27 12:22:50.172 [warning] [server stderr]
2025-06-27 12:22:50.172 [warning] [server stderr] Search: query="Step03_Chat AgentGroupChat sample" path="C:\Users\jandevries\AppData\Local\npm-cache\_npx\6836e08c2900d844\node_modules\@buger\docs-mcp\data" maxTokens=10000 timeout=600
2025-06-27 12:24:16.622 [warning] [server stderr]
2025-06-27 12:24:16.622 [warning] [server stderr] Search results: 64 matches, 3552 tokens, 14655 bytes
2025-06-27 12:24:27.866 [warning] [server stderr] Received request for tool: search_sk_repo
2025-06-27 12:24:27.866 [warning] [server stderr] Request arguments: {"query":"AgentGroupChat ExecutionSettings TerminationStrategy C#"}
2025-06-27 12:24:27.866 [warning] [server stderr] Executing search with options: {
2025-06-27 12:24:27.866 [warning] [server stderr] "timeout": 600,
2025-06-27 12:24:27.866 [warning] [server stderr] "path": "C:\\Users\\jandevries\\AppData\\Local\\npm-cache\\_npx\\6836e08c2900d844\\node_modules\\@buger\\docs-mcp\\data",
2025-06-27 12:24:27.866 [warning] [server stderr] "query": "AgentGroupChat ExecutionSettings TerminationStrategy C#",
2025-06-27 12:24:27.867 [warning] [server stderr] "maxTokens": 10000
2025-06-27 12:24:27.867 [warning] [server stderr] }
2025-06-27 12:24:27.867 [warning] [server stderr]
2025-06-27 12:24:27.867 [warning] [server stderr] Search: query="AgentGroupChat ExecutionSettings TerminationStrategy C#" path="C:\Users\jandevries\AppData\Local\npm-cache\_npx\6836e08c2900d844\node_modules\@buger\docs-mcp\data" maxTokens=10000 timeout=600
Because the tools are running code on your system, security measures need to be in place. The first time a tool is invoked VS Code asks if it’s allowed.
I think this is a great way to be aware of is happening.
Error executing docs search: Error: Search operation timed out after 30 seconds
The first time I ran this tool I ran into some timeout issue.
At the time of writing this post, there’s an open GitHub issue on this. Searching a relatively small repository, Semantic Kernel which is about 40MB size on disk, takes about 90 seconds.
To solve this, just set the timeout to a higher number in the index.js
file of the mcp-docs
tool. I’ve requested for this to be solved as an input parameter for the tool itself.
For completeness, this is the piece of code you need to change.
// Create a clean options object
const options = {
timeout: 600, // <---- Added this to the options.
path: searchPath,
query: args.query,
maxTokens: 10000 // Set default maxTokens
// Removed filesOnly, maxResults, session
};
This version of [path]\node_modules@buger\probe\bin\probe.exe is not compatible with the version of Windows you’re running.
I’ve also had this error:
2025-06-27 09:29:14.152 [warning] [server stderr] This version of C:\Users\jandevries\AppData\Local\npm-cache\_npx\6836e08c2900d844\node_modules\@buger\probe\bin\probe.exe is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher.
It looks like the downloaded version of probe.exe
is not (always) compatible with your Windows system, as mentioned in this GitHub issue: https://github.com/buger/probe/issues/20.
To solve this, download the latest version in the Releases and use this to overwrite the version installed in the mentioned path.
To conclude
Adding MCP servers to VS Code is quite straightforward and really enhances the capabilities of the Copilot Chat experience.
I’ve seen there are also MS Learn servers you can add, making sure you’re always working with the latest version of the documentation. I’ll definitely be using these more from now on as it’s making development with the latest libraries and frameworks much easier.