Test Spring MCP Server with VS Code
Overview
This page shows how to connect VS Code to the Spring sample MCP server so you can test source-generated MCP tools (for example, open_account, deposit_funds, and projection read tools) from chat.
Spring exposes MCP in Spring.Gateway with:
builder.Services.AddMcpServer().WithHttpTransport().WithGeneratedMcpTools().WithTools<SpringGatewayPingMcpTools>();app.MapMcp("/mcp");(mapped in Development environment only)
Reference: Spring.Gateway Program.cs
Before You Begin
- VS Code with GitHub Copilot Chat enabled
- This repository checked out locally
- .NET SDK installed
Step 1: Start Spring Locally
From the repository root, run:
pwsh ./run-spring.ps1
This script builds samples.slnx and starts samples/Spring/Spring.AppHost/Spring.AppHost.csproj, which launches the Spring services for local development.
When Spring is running from run-spring.ps1, Spring uses these default endpoints from launch settings:
Spring.GatewayHTTP:http://localhost:5101Spring.GatewayHTTPS:https://localhost:7101Spring.RuntimeHTTP health:http://localhost:5300/health- Aspire dashboard:
https://localhost:17272
For MCP over HTTP, use http://localhost:5101/mcp.
Step 2: Add the MCP Server to VS Code
Open (or create) .vscode/mcp.json in the workspace root and add a server entry:
{
"servers": {
"springBank": {
"type": "http",
"url": "http://localhost:5101/mcp"
}
}
}
Notes:
- Keep the server name in camelCase (
springBank). - If you change launch settings, update this URL to match your
Spring.GatewayHTTP port. - MCP client behavior and UI workflows can change across VS Code releases; use the official MCP documentation linked in References.
Verify
- Open Chat in VS Code.
- Open the tools picker and ensure tools from
springBankare enabled. - Ask a prompt that should use Spring tools, for example:
Use the springBank tools to open a bank account for Ada Lovelace with an initial deposit of 100.
- Ask a follow-up read prompt, for example:
Use the springBank tools to fetch the balance projection for that account.
- Ask a quick connectivity prompt for the manually registered ping tool:
Use the springBank tools to call spring_gateway_ping.
Troubleshooting
- Server not listed or not starting: verify
.vscode/mcp.jsonis valid JSON and the URL is reachable. - No tools discovered: confirm Spring is running and that
/mcpis mapped inSpring.Gateway. - Tools mismatch after code changes: restart Spring with
pwsh ./run-spring.ps1so regenerated tools are loaded.
Summary
Spring exposes MCP tools at http://localhost:5101/mcp in Development, with both generated domain tools and a manual spring_gateway_ping tool.
Next Steps
- Run through Building an Aggregate and test generated command tools over MCP.
- Run through Building Projections and test projection read tools over MCP.
- Extend your local MCP prompts using the Spring tool names validated in this page.
- Host Architecture - Revisit how the MCP surface fits into the Spring gateway host.
- Key Concepts - Revisit the domain-modeling vocabulary behind the generated tools.
- Domain Registration Generators - Look up how the host registration surface is generated.