概要
What is MCP Server Template with Internet Identity Authentication?
This project is a Model Context Protocol (MCP) server template that demonstrates an authentication flow using Internet Identity. It is intended for developers building AI clients that require secure, delegated identity verification via the Internet Identity system on the Internet Computer.
How to use MCP Server Template with Internet Identity Authentication?
Configure environment variables for both the MCP server and the React web app, start the MCP server, then start the React web application, and connect your AI client to the MCP server. The AI client begins by calling the authenticate tool to initiate the flow.
Key features of MCP Server Template with Internet Identity Authentication
- Internet Identity based authentication flow
- Delegation chain creation with public key and expiration
- Protected MCP tools accessible only after authentication
- React web app (Auth UI) for user login
- Handles pubkey and expiration in authentication URL
Use cases of MCP Server Template with Internet Identity Authentication
- AI client that needs to authenticate a human user via Internet Identity before accessing sensitive tools
- Prototyping MCP servers with delegated identity on the Internet Computer
- Demonstrating how to integrate a web-based auth UI with an MCP server
- Building AI workflows where the server must verify the user’s identity for each session
FAQ from MCP Server Template with Internet Identity Authentication
How does the authentication flow work?
The AI client calls the authenticate tool, the MCP server opens a browser window with an authentication URL containing a public key and expiration. The user authenticates via Internet Identity, the web app creates a delegation chain and sends it back to the server, which then responds to the client with the authentication result.
What is the authenticate tool?
It is an MCP tool provided by the server that initiates the authentication process. It causes the server to open the authentication URL and wait for the user to complete identity verification.
What are the project’s components?
The project consists of two parts: mcp-server (the MCP server implementation that handles tool registration, authentication state, and delegation processing) and mcp-server-wallet-connect (a React web application that connects to Internet Identity, creates delegations, and sends them back to the server).
Do I need to run the React web app?
Yes, the React web app is required as the authentication UI. It handles the user’s login via Internet Identity and transmits the resulting delegation to the MCP server.
What parameters are included in the authentication URL?
The authentication URL includes pubkey (the public key for the delegation) and expiration (the expiration time for the delegation in milliseconds).