baolongt/mcp-server-template-ic
If you are the rightful owner of mcp-server-template-ic 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.
This project demonstrates a Model Context Protocol (MCP) server with Internet Identity authentication flow.
MCP Server Template with Internet Identity Authentication
This project demonstrates a Model Context Protocol (MCP) server with Internet Identity authentication flow.
Authentication Flow
ββββββββββββββββββ (1) Use authenticate tool ββββββββββββββββββ
β β ββββββββββββββββββββββββββββββββ> β β
β β β β
β AI Client β β MCP Server β
β with MCP β β β
β Support β β β
β β <β β β β β β β β β β β β β β β β β β
ββββββββββββββββββ (6) Authentication result ββββββββββββββββββ
β β
β β (2) Open authentication URL
β β with pubkey & expiration
β βΌ
β ββββββββββββββββββ
β β β
β β React Web App β
β β (Auth UI) β
β β β
β ββββββββββββββββββ
β β
β β (3) User authenticates
β β with Internet Identity
β βΌ
β ββββββββββββββββββ
β β β
β β Internet β
β β Identity β
β β β
β ββββββββββββββββββ
β β
β β (4) Return delegation
β βΌ
β ββββββββββββββββββ
β β β
β β React Web App β
β β (Auth UI) β
β β β
β ββββββββββββββββββ
β β
β β (5) Send delegation
β β to MCP Server
βΌ βΌ
ββββββββββββββββββ (7) Call other MCP tools ββββββββββββββββββ
β β ββββββββββββββββββββββββββββββββ> β β
β β β β
β AI Client β β MCP Server β
β with MCP β β (Authenticated)β
β Support β β β
β β <β β β β β β β β β β β β β β β β β β
ββββββββββββββββββ (8) Tool responses ββββββββββββββββββ
How It Works
-
Request Authentication: The AI client calls the MCP server using the
authenticate
tool. -
Open Authentication URL: The MCP server opens a browser window with the authentication URL, including:
pubkey
: The public key for the delegationexpiration
: The expiration time for the delegation in milliseconds
-
User Authentication: The React web app (Auth UI) presents an interface for the user to authenticate using Internet Identity or other supported identity providers.
-
Delegation Creation: After successful authentication, the web app creates a delegation chain for the MCP server using the provided public key and expiration time.
-
Send Delegation to Server: The web app sends the delegation chain to the MCP server at the configured endpoint.
-
Authentication Result: The MCP server responds to the AI client with the authentication result.
-
Access Protected Tools: If authentication is successful, the AI client can now call other MCP tools that require authentication.
-
Protected Responses: The authenticated MCP server responds to tool calls with the requested data.
Project Structure
-
mcp-server/
: The MCP server implementation- Handles MCP tool registration and requests
- Manages authentication state
- Processes delegations from the web app
-
mcp-server-wallet-connect/
: The React web application for authentication- Connects to Internet Identity
- Creates delegations for the MCP server
- Sends delegations back to the server
Setup Instructions
- Configure environment variables for both projects
- Start the MCP server
- Start the React web application
- Connect your AI client to the MCP server
For detailed setup instructions, see the README files in each project directory.