mcp-server-outh2

kamarthiparamesh/mcp-server-outh2

3.1

If you are the rightful owner of mcp-server-outh2 and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The Model Context Protocol (MCP) server is a test implementation designed to facilitate secure interactions between clients and server resources using OAuth 2.0 authentication.

The MCP server is a pivotal component in the Model Context Protocol ecosystem, providing a secure and structured way to expose tools, resources, and prompts to authorized clients. By leveraging OAuth 2.0, the server ensures that only authenticated users can access its offerings, thereby maintaining the integrity and confidentiality of the data and services it provides. The integration with Affinidi Login as the external authorization provider exemplifies a real-world application of OAuth 2.0, showcasing how third-party authentication can be seamlessly incorporated into a server-client architecture. This setup not only enhances security but also simplifies the user experience by allowing users to authenticate using a trusted external provider. The MCP server is particularly useful for developers looking to implement secure resource access in their applications, providing a reference implementation that can be adapted to various use cases. Despite a known issue with the SDK's handling of the authorization code exchange flow, a local modification has been made to ensure compliance with the OAuth 2.0 specification, thereby ensuring the flow operates as intended.

Features

  • OAuth 2.0 Authentication: Ensures secure access to server resources by requiring user authentication.
  • Integration with Affinidi Login: Utilizes a trusted external provider for user authentication.
  • Resource and Tool Exposure: Provides a structured way to expose tools, resources, and prompts to clients.
  • Real-world Simulation: Offers a practical example of client-server authentication flow using OAuth 2.0.
  • SDK Modification: Includes a local fix to ensure compliance with OAuth 2.0 specifications.

Usages

usage with mcp server

python
# Example of running MCP Server with OAuth 2.0
mcp.run(transport='http', host='0.0.0.0', port=8000, auth='oauth2')

usage with mcp host client

javascript
// Example of connecting to MCP Server using Vite
import { createMCPClient } from '@modelcontextprotocol/sdk';

const client = createMCPClient({
  baseUrl: 'http://localhost:8000',
  authProvider: 'affinidi'
});

client.connect().then(() => {
  console.log('Connected to MCP Server');
}).catch((error) => {
  console.error('Connection failed', error);
});