# Visual Studio and MCP Setup This guide covers two related workflows: 1. Running Cortex integration tests from Visual Studio Test Explorer. 2. Connecting an MCP-capable Copilot client to the Cortex MCP server. ## Visual Studio Test Explorer Visual Studio can run the integration tests because they are ordinary xUnit tests. ### Steps 1. Open `Cortex.slnx`. 2. Start the isolated test stack: ```powershell .\scripts\deploy-test.ps1 ``` 3. In Visual Studio, open Test Explorer. 4. Run tests under `Cortex.IntegrationTests`. The tests connect to: ```text http://localhost:5217 ``` Override that by setting: ```powershell $env:CORTEX_TEST_BASE_URL = "http://localhost:5217" ``` ## Connecting a Copilot MCP Client Cortex uses Streamable HTTP MCP. The Blazor web UI is not needed for this. It is only a browser-based helper for local testing and memory inspection. Dev endpoint: ```text http://localhost:5117/mcp ``` Test endpoint: ```text http://localhost:5217/mcp ``` ## Visual Studio Full IDE As of this documentation pass, Microsoft has clear public documentation for MCP server configuration in Visual Studio Code. I did not find equivalent official full Visual Studio IDE documentation for a stable `mcp.json` location. If your Visual Studio installation exposes MCP server configuration through GitHub Copilot or an agent customization UI, use the same Streamable HTTP server details: ```json { "servers": { "cortex": { "type": "http", "url": "http://localhost:5117/mcp" } } } ``` If Visual Studio asks for a URL directly, enter: ```text http://localhost:5117/mcp ``` If your Visual Studio build does not expose MCP server configuration, use Visual Studio for normal coding and Test Explorer, and use Visual Studio Code or another MCP-capable client for Cortex tool calls. ## Visual Studio Code MCP Setup VS Code supports workspace-level MCP configuration through `.vscode/mcp.json`. Create: ```text .vscode/mcp.json ``` Add: ```json { "servers": { "cortex": { "type": "http", "url": "http://localhost:5117/mcp" } } } ``` The same example is available at `docs/examples/vscode-mcp.dev.json`. Then: 1. Start Cortex: ```powershell .\scripts\deploy-all.ps1 ``` 2. Open the VS Code command palette. 3. Run `MCP: List Servers`. 4. Start or enable `cortex`. 5. Open Chat and select/configure tools. For the test instance: ```json { "servers": { "cortex-test": { "type": "http", "url": "http://localhost:5217/mcp" } } } ``` The same example is available at `docs/examples/vscode-mcp.test.json`. ## Example Prompts After connecting an MCP client: ```text Create a Cortex project named Home. ``` ```text Remember in the Home project as a location: my USB-C charging brick is in the blue backpack. ``` ```text Find Home memories about the charging brick. ``` ```text Add a todo in the Home project: buy a replacement USB-C cable. ``` ## Trust and Safety Cortex is local and currently unauthenticated. Treat the endpoint as trusted-local only: - Keep it bound to localhost for development. - Do not expose it to the public internet. - Review MCP tool calls before approving them in a client. - Use explicit projects to avoid accidental memory mixing. ## References - [VS Code MCP server configuration](https://code.visualstudio.com/docs/agent-customization/mcp-servers) - [MCP C# SDK transport documentation](https://csharp.sdk.modelcontextprotocol.io/concepts/transports/transports.html)