Quick revision
The short answer
Spring AI provides MCP client and server starters, so a team can expose @Tool methods from a Spring Boot service as an MCP server over the transports its version supports, such as stdio or HTTP-based ones. I would have each MCP server expose a narrow set of tools owned by the team that owns the capability, authenticate and authorise every call as the end user rather than with shared service credentials, review tool descriptions and side effects with destructive tools marked and confirmed, and keep a central registry of approved servers with audit logs of every call.
What to remember
In this answer, we recapped MCP's hosts, clients, servers, tools and transports, and built a server with Spring AI's MCP starter by exposing @Tool methods through a ToolCallbackProvider. We gave each capability team its own narrow server, authenticated and authorised every call as the end user with OAuth tokens rather than shared credentials, reviewed descriptions and side effects with destructive tools confirmed and limited, and governed everything through a central registry of approved servers and common audit logs.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
Spring AI provides MCP client and server starters, so a team can expose @Tool methods from a Spring Boot service as an MCP server over the transports its version supports, such as stdio or HTTP-based ones. I would have each MCP server expose a narrow set of tools owned by the team that owns the capability, authenticate and authorise every call as the end user rather than with shared service credentials, review tool descriptions and side effects with destructive tools marked and confirmed, and keep a central registry of approved servers with audit logs of every call.
Why this question is asked
The Model Context Protocol, MCP, is an open protocol that lets AI assistants discover and call tools offered by separate servers, so one capability, such as looking up a customer, can serve every assistant in the company instead of being rebuilt in each. That reuse is the attraction and also the risk: an MCP server is a new kind of API whose client is a model that can be steered by anything it reads. Interviewers ask this design question to see whether we treat MCP servers as real production APIs with ownership, security and governance. In this answer, we will recap what MCP is, build a server with Spring AI, decide what each server should expose, secure it per user, govern tools with side effects, and set up the registry and audit.
1A Quick Recap of MCP
MCP defines how an AI application, the host, connects through an MCP client to an MCP server. The server advertises tools, each with a name, a description and an input schema, and can also offer resources, such as documents, and prompts. The client lists the tools, the model chooses one, and the client calls it on the server and returns the result. Messages use JSON-RPC.
Transports define how client and server talk. Stdio runs the server as a local process, which suits developer tools on a laptop. For shared company services, servers run over HTTP; the protocol moved from an earlier HTTP plus server-sent events transport to a streamable HTTP transport, and Spring AI's support has followed. Check your Spring AI version for the transports and starters available.
2Building an MCP Server With Spring AI
With Spring AI's MCP server starter, an existing Spring Boot service can expose @Tool methods as MCP tools. We write the tools as we would for a ChatClient, and register them through a ToolCallbackProvider bean.
Notice that the tool checks access itself with the caller's identity. The MCP layer makes the tool reachable; it does not make it safe. On the consuming side, Spring AI's MCP client starter connects to configured servers and offers their tools to a ChatClient like local tools.
3Narrow Servers Owned by Capability Teams
A tempting shortcut is one big company MCP server that wraps every internal API. It becomes a bottleneck that no single team understands, and it holds broad credentials to everything. Instead, the team that owns a capability owns its MCP server: billing exposes billing tools, the CRM team exposes customer lookup. Each server offers a small, deliberate set of tools, perhaps 3 to 10, designed for model use: clear names, precise descriptions, small results and safe defaults. A thin wrapper that exposes every REST endpoint as a tool gives models too many choices, wastes tokens on descriptions and exposes operations nobody reviewed.
4Authenticating and Authorising Per User
The most important design rule is that a tool call runs with the permissions of the human on whose behalf the assistant acts, not with a powerful shared service account. If the billing MCP server used one service credential that can read every invoice, any assistant connected to it, and anyone who can steer that assistant, can read every invoice.
MCP's authorisation for HTTP transports is based on OAuth: the client obtains an access token for the user, and the MCP server validates it like any OAuth resource server, which in Spring Boot is Spring Security's resource server support. The token carries the user and the scopes granted to this client. The tool then applies the same authorisation as the normal API, ideally by calling the same service layer. Tokens should be scoped to the MCP server as their audience, so a token issued for one server cannot be replayed against another.
8 messages in order. Play them, or step through them one at a time.
The server acts with the user's rights, never with a shared all-powerful credential.
5Reviewing Tools With Side Effects
Read-only tools and tools that change things carry very different risks. Every tool goes through a short review before its server is approved: what it reads or changes, its description, its worst-case misuse, and whether it is reversible. The MCP specification lets servers annotate tools with hints such as read-only and destructive, which clients can use to decide whether to ask the user first. Hints come from the server, so clients should rely on them only for approved servers, and the server itself must still enforce the rule. Destructive tools, such as issuing a refund or deleting data, prepare an action and require explicit user confirmation through the host application, with limits like maximum amounts enforced in the service. Descriptions are reviewed too, because a description is effectively an instruction to every model that loads it.
6A Central Registry and Audit Logs
Governance ties it together. A central registry lists the approved MCP servers with their owner, version, data classification, tools and review status. Assistants are configured to connect only to registered servers, so a developer cannot quietly attach an unknown server that sees company data. Every server writes audit logs in a common format, user, client, tool, arguments, result status and time, to a central store, which security can search and alert on. A version change that adds or modifies tools goes back through review before the registry marks it approved.
- Owning team builds servernarrow tools, OAuth resource server
- Tool reviewdescriptions, side effects, data class
- Any destructive tool?YesRequire confirmation and limitsNoRead-only path
- Register in the catalogueowner, version, approved clients
- Audit logs to central storeuser, tool, arguments, result
- Changed tools?on each new versionYesBack to reviewNoStay approved
6 steps in order. Play them, or step through them one at a time.
7Follow-up questions
Should an MCP server call internal APIs with its own service account?
Only for operations that are genuinely not user-specific, and even then with the narrowest possible rights. For user data, the server should act with the user's identity, by exchanging the user's token for a downstream token or by passing verified user identity to services that enforce it.
How do you stop a malicious or compromised MCP server from harming assistants?
By connecting only to registered servers, pinning versions, reviewing tool descriptions for instructions aimed at the model, and treating everything a server returns as untrusted data. A tool result can contain prompt injection just like a document.
What is the difference between exposing a REST API and an MCP server?
The REST API stays the source of truth and keeps its own authorisation. The MCP server is an adapter for AI clients: fewer, task-shaped operations, descriptions written for models, small results and stronger confirmation rules, sitting on top of the same service layer.
8Conclusion
In this answer, we recapped MCP's hosts, clients, servers, tools and transports, and built a server with Spring AI's MCP starter by exposing @Tool methods through a ToolCallbackProvider. We gave each capability team its own narrow server, authenticated and authorised every call as the end user with OAuth tokens rather than shared credentials, reviewed descriptions and side effects with destructive tools confirmed and limited, and governed everything through a central registry of approved servers and common audit logs.
Open with
MCP lets AI assistants discover and call tools from separate servers, so I would treat each MCP server as a production API. On the build side, Spring AI has MCP server and client starters.
Then, if they want more
A team writes @Tool methods, registers them through a ToolCallbackProvider, and the starter exposes them over the transports the version supports, stdio for local tools and HTTP-based transports for shared services; I would check the current version for those.
For design, each capability team owns its own server with a small set of task-shaped tools and precise descriptions, instead of one central server wrapping every API with broad credentials.
Security is per user: the assistant obtains an OAuth token for the user with the MCP server as audience, the server validates it as a resource server with Spring Security, and the tool authorises with the same service layer as the normal API, so no shared service account can read everything.
Every tool is reviewed for side effects and description wording; destructive tools are marked, prepare an action, require user confirmation in the host and have limits enforced in the service.
Finally, a central registry lists approved servers with owner, version and data classification, assistants may connect only to registered servers, tool changes go back through review, and every server writes audit logs of user, tool, arguments and result to a central store.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Spring AI reference
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Your company wants to expose internal capabilities to AI assistants using the Model...": https://scrivio-interview-library.netlify.app/spring-boot/spring-ai/20694b926e/