Introduction to the MCP Server
Building on the foundational concepts covered in the first blog, which introduced Model Context Protocol (MCP) and its role in connecting AI infrastructure and AI assistants to external tools and data, this blog is the second installment of our two-part series on MCP and focuses on a critical aspect for production deployments: authorization.
MCP is gaining momentum with major companies like AWS, Google, Databricks, and Microsoft actively developing and publishing MCP servers on GitHub. The ecosystem now includes:
- 20+ reference servers, which are the built‑in examples demonstrating core MCP protocol features.
- 115+ official integrations that are production‑quality servers maintained by platform vendors.
- 300+ community servers, which are community‑contributed MCP implementations (approximate count).
- 10+ frameworks that include SDKs and tools to help you build servers or clients.
- 15+ additional resources, including guides, registries, and community hubs for MCP.
As MCP adoption expands, one challenge becomes clear: how do we ensure AI infrastructure and AI agents don’t get more access than they need? In our first blog, we explored how MCP servers connect AI assistants to a wide range of tools and sensitive enterprise data, making integration seamless and scalable. But with this power comes risk; if an MCP server is granted full authorization, it could expose confidential information or allow unintended actions by AI agents.
Understanding the Problem
By design, agentic AI and AI agents can operate autonomously and interact with multiple systems. If we hand them unrestricted access, we lose the ability to control what data or actions they can perform, increasing the risk of data leaks, compliance violations, or even malicious behavior.
Why Do We Need Authorization at All?
MCP servers often handle sensitive data and critical actions, making authorization a fundamental aspect of their security. OAuth 2.0 / 2.1 serves as the foundation for MCP’s authorization framework, enabling users to grant AI agents limited access without exposing passwords or API keys.
OAuth in MCP: The Challenge
The MCP specification mandates the use of OAuth 2.0 / 2.1 for authorization but leaves the implementation details to developers. This flexibility can lead to misunderstandings—some teams may assume that every MCP server must operate its own OAuth service.
In reality, OAuth defines distinct roles: the Authorization Server, which issues tokens, and the Resource Server (your MCP API), which validates them. Requiring every MCP server to also function as an authorization server is unnecessary and inefficient.
From a product and operational perspective, this distinction is critical. Forcing every MCP server to manage authorization increases complexity, slows development, and creates scalability challenges. In an ecosystem with many clients and servers, manually registering each client on every server is not scalable.
The MCP specification strongly recommends that MCP Servers (authorization servers) support Dynamic Client Registration. This approach allows new MCP clients to register automatically, reducing friction and enabling a smoother user experience. By embracing this model, teams can focus on building core MCP functionality while ensuring secure, scalable authorization.
MCP Server Example: AUTH Implementation (Client/Server/Auth) (Python)
Security Best Practices
- To secure the Model Context Protocol (MCP), servers must enforce strict authorization and session management.
- They must prevent security attacks by always reconfirming user consent for new clients, especially when acting as a proxy.
- The practice of “token passthrough” is forbidden; servers must validate that any received security token is specifically intended for them.
- To stop session hijacking, every request must be individually authenticated, and servers must use secure, unpredictable session IDs that are bound to specific user information rather than using the session itself for authentication.
- A very good (recommended reading) resource for MCP security best practices is available here
Conclusion
Authorization is a crucial piece in making MCP servers production-ready. While the MCP specification mandates OAuth 2.0 / 2.1 for authorization, it leaves implementation details to developers, which can lead to inconsistent or insecure setups if not carefully addressed.
Separating the Authorization Server from the MCP Resource Server simplifies development and improves scalability. Leveraging external OAuth providers, such as enterprise identity systems or services like Auth0 and Google, offloads complex authentication tasks and enables robust features like SSO, MFA, and auditing.
Supporting Dynamic Client Registration and OAuth Authorization Server Metadata allows MCP clients to register and discover authorization endpoints automatically, eliminating manual client setup and enhancing user experience.
Finally, enforcing fine-grained scopes at the tool or function level ensures agentic AI and AI agents only access what they are explicitly permitted to, reducing security risks and maintaining clear boundaries. By following these best practices, developers can build secure, scalable MCP servers that integrate seamlessly with existing identity infrastructures, making AI integrations both powerful and safe.