Authentication with an MCP server. A quick demo.

Simon Willison (underfitted) · Intermediate ·📐 ML Fundamentals ·1y ago

Key Takeaways

The video demonstrates how to implement authentication with an MCP server using AuthKit by WorkOS, showcasing a live example with the MCP Shop project, a TypeScript application that requires users to authenticate before accessing the API.

Full Transcript

I've had so far 2,000 conversations about MCP for a good reason. That's the future. That's where we're going. If we want to connect AI agents to the external world, to tools all over the place, we need MCP. But there has been one question that's been really hard to answer, and is how do you create an MCP server that protects the information behind that MCP server? and requires users to authenticate. So obviously the MCP team, the team behind the specification has been putting a lot of work towards it and today I want to show you full source code, full example of how to do that using OKIT by work OS. That is how you will manage the authentication. So basically, you can have an API now and and don't allow anyone to access that API unless they first either create an account or sign in using their credentials. So to do that, we're not going to go into the code, but I'm going to show you and I'm going to leave somewhere below uh a link to this project here, this opensource project, which is pretty fun. It's called the NCP shop. And this project is a TypeScript application that shows how to build that authentication. Okay, so this is the project deployed. It's just a fun little store that sells one t-shirt. Okay, this MCPT. And the idea here is that you can connect an assistant, your AI assistant, cursor, cloth, whatever. you can connect it to this MCP store and put orders like order t-shirts through MCP and in order to do that you will first need to authenticate or create an account using a third party provider signing provider like I don't know Google or Apple or GitHub or whatever it is. So they implemented it all. It's in this uh repo here. you will see all of the you know the entire app everything that's going on like if you go here transport and you go to this route here you will see this is the entire MCP server implementation so you get full access here to do that and it's pretty fun so let me show you this is the store and there is a button here in the store by the way you can just see all of the t-shirts and whatnot or all of the images there is a view ordering instructions button if you open that you will get instructions to connect to cursor or cloud integrations or a local MCP. This is the one that I'm using. So I took this configuration and I pasted it in my cloud desktop configuration. So now my local cloud application has access to this NCP shop. And the first time you do that, so as soon as you configure your cloud application, and I hope you know how to do that, uh, in case you don't know, uh, you go to the settings of cloud. Let me see if I can show you. You go to cloud settings and there is a developer section and here is my MCP shop. If you click on edit config, that will take you to the location of the file that you have to edit and enter your configuration. So now that this MCP shop is running, the first time you do this, a browser will open and we ask you to sign up for the MCP shop server. That is the authentication from work OS playing here. Okay, you're going to sign up using your Google account for example. Uh and that's it. And now you get your you get access to uh the MCP shop through an assistant. So you can ask something like are there any size L t-shirts the MCP shop? Okay. So you can ask a question like this and now cloud will connect to the MCP server and will answer your question. By the way the fun part here is and but all of this is going to happen after you authenticate. Obviously, the fun part is that you can say, "Okay, I want to order one." Okay, so I want to order one. And now Cloud is going to put in an order. It's going to ask you some information that the MCP shop is telling Cloud to ask. Uh it's saying, "Okay, so in order to to order one, you need to enter your company name and your US mailing address." I recommend you do this. See what happens after that. But the important thing here is if you have an API and you want to create an MCP server and you want to make sure your users authenticate before they access that MCP server, like your AI agent will need to have authentication in order to do anything with that MCP server. Check this source code. I'm going to leave a link below. Hope this helps and I'll see you in the next one. Bye-bye.

Original Description

Here is the GitHub Repository with the code you need to make this work: https://github.com/workos/mcp.shop The authentication is implemented with AuthKit. Here is the GitHub Repository: https://github.com/workos/authkit I teach a live, interactive program that'll help you build production-ready Machine Learning systems from the ground up. Check it out here: https://www.ml.school To keep up with my content: • Twitter/X: https://www.twitter.com/svpino • LinkedIn: https://www.linkedin.com/in/svpino 🔔 Subscribe for more stories: https://www.youtube.com/@underfitted?sub_confirmation=1
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Underfitted · Underfitted · 0 of 60

← Previous Next →
1 Test-Time Augmentation In Machine Learning.
Test-Time Augmentation In Machine Learning.
Underfitted
2 Don't Replace Missing Values In Your Dataset.
Don't Replace Missing Values In Your Dataset.
Underfitted
3 Introduction to Adversarial Validation In Machine Learning.
Introduction to Adversarial Validation In Machine Learning.
Underfitted
4 Introduction To Autoencoders In Machine Learning.
Introduction To Autoencoders In Machine Learning.
Underfitted
5 Active Learning. The Secret of Training Models Without Labels.
Active Learning. The Secret of Training Models Without Labels.
Underfitted
6 Early Stopping. The Most Popular Regularization Technique In Machine Learning.
Early Stopping. The Most Popular Regularization Technique In Machine Learning.
Underfitted
7 The Confusion Matrix in Machine Learning
The Confusion Matrix in Machine Learning
Underfitted
8 3 Tips to Build a Career in Machine Learning (Unconventional Advice)
3 Tips to Build a Career in Machine Learning (Unconventional Advice)
Underfitted
9 I can predict cars CRASHING. And it's 99% accurate!
I can predict cars CRASHING. And it's 99% accurate!
Underfitted
10 A Critical Skill People Learn Too LATE: Learning Curves In Machine Learning.
A Critical Skill People Learn Too LATE: Learning Curves In Machine Learning.
Underfitted
11 The BEST Machine Learning Interview Strategy.
The BEST Machine Learning Interview Strategy.
Underfitted
12 OpenAI’s Whisper is AMAZING!
OpenAI’s Whisper is AMAZING!
Underfitted
13 5 Lessons You’re NOT Taught in School
5 Lessons You’re NOT Taught in School
Underfitted
14 TensorFlow On Apple Silicon. Step-by-Step Instructions
TensorFlow On Apple Silicon. Step-by-Step Instructions
Underfitted
15 Generating Images From Text. Stable Diffusion, Explained
Generating Images From Text. Stable Diffusion, Explained
Underfitted
16 The Wrong Batch Size Will Ruin Your Model
The Wrong Batch Size Will Ruin Your Model
Underfitted
17 8 Mistakes Holding Your Career Back | Machine Learning
8 Mistakes Holding Your Career Back | Machine Learning
Underfitted
18 AI Just Solved a 53-Year-Old Problem! | AlphaTensor, Explained
AI Just Solved a 53-Year-Old Problem! | AlphaTensor, Explained
Underfitted
19 Bias and Variance, Simplified
Bias and Variance, Simplified
Underfitted
20 Should You Stop Splitting Your Data Like This?
Should You Stop Splitting Your Data Like This?
Underfitted
21 The Function That Changed Everything
The Function That Changed Everything
Underfitted
22 This Model Caused A Nuclear Disaster
This Model Caused A Nuclear Disaster
Underfitted
23 Will Your Code Write Itself?
Will Your Code Write Itself?
Underfitted
24 The Simplest Encoding You’ve Never Heard Of
The Simplest Encoding You’ve Never Heard Of
Underfitted
25 Superhuman AI Cracked An Impossible Game! | DeepNash, Explained
Superhuman AI Cracked An Impossible Game! | DeepNash, Explained
Underfitted
26 Can you become a Data Scientist without a Ph.D?
Can you become a Data Scientist without a Ph.D?
Underfitted
27 How to 10x your productivity with ChatGPT?
How to 10x your productivity with ChatGPT?
Underfitted
28 Cheating the Prisoner's Dilemma
Cheating the Prisoner's Dilemma
Underfitted
29 We integrated OpenAI's Whisper with Spot
We integrated OpenAI's Whisper with Spot
Underfitted
30 The Machine Learning School program
The Machine Learning School program
Underfitted
31 We integrated ChatGPT with our robots
We integrated ChatGPT with our robots
Underfitted
32 Solving complex tasks using a Large Language Model (LLM)
Solving complex tasks using a Large Language Model (LLM)
Underfitted
33 5 problems when using a Large Language Model
5 problems when using a Large Language Model
Underfitted
34 We just discovered faster sorting algorithms!
We just discovered faster sorting algorithms!
Underfitted
35 The 3 most important updates to OpenAI's API.
The 3 most important updates to OpenAI's API.
Underfitted
36 People are divided! Does GPT-4 understand what it says?
People are divided! Does GPT-4 understand what it says?
Underfitted
37 How much should you charge hourly as a Machine Learning freelancer?
How much should you charge hourly as a Machine Learning freelancer?
Underfitted
38 Building a RAG application from scratch using Python, LangChain, and the OpenAI API
Building a RAG application from scratch using Python, LangChain, and the OpenAI API
Underfitted
39 Building a RAG application using open-source models (Asking questions from a PDF using Llama2)
Building a RAG application using open-source models (Asking questions from a PDF using Llama2)
Underfitted
40 How to evaluate an LLM-powered RAG application automatically.
How to evaluate an LLM-powered RAG application automatically.
Underfitted
41 Step by step no-code RAG application using Langflow.
Step by step no-code RAG application using Langflow.
Underfitted
42 I built a simple game using Langchain. Here is a step by step tutorial.
I built a simple game using Langchain. Here is a step by step tutorial.
Underfitted
43 I used the first AI Software Engineer for a week. This is happening.
I used the first AI Software Engineer for a week. This is happening.
Underfitted
44 I deployed a recommendation model. Testing Models In Production using Interleaving Experiments.
I deployed a recommendation model. Testing Models In Production using Interleaving Experiments.
Underfitted
45 How to run PyTorch, TensorFlow, and JAX on your Mac (Apple Silicon)
How to run PyTorch, TensorFlow, and JAX on your Mac (Apple Silicon)
Underfitted
46 How to train a model to generate image embeddings from scratch
How to train a model to generate image embeddings from scratch
Underfitted
47 Building an AI assistant that listens and sees the world (Step by step tutorial)
Building an AI assistant that listens and sees the world (Step by step tutorial)
Underfitted
48 Why are vector databases so FAST?
Why are vector databases so FAST?
Underfitted
49 A Machine Learning roadmap (the one I recommend to my students)
A Machine Learning roadmap (the one I recommend to my students)
Underfitted
50 How to build a real-time AI assistant (with voice and vision)
How to build a real-time AI assistant (with voice and vision)
Underfitted
51 An introduction to Mojo (for Python developers)
An introduction to Mojo (for Python developers)
Underfitted
52 How does Lexical Scoping in Mojo 🔥 works (under 3 minutes)
How does Lexical Scoping in Mojo 🔥 works (under 3 minutes)
Underfitted
53 Building a CI workflow for those who hate it (using GitHub Actions)
Building a CI workflow for those who hate it (using GitHub Actions)
Underfitted
54 How to run Python Code in Mojo 🔥
How to run Python Code in Mojo 🔥
Underfitted
55 AI will not take your job. Here is what I think will happen instead.
AI will not take your job. Here is what I think will happen instead.
Underfitted
56 How to fine-tune a model using LoRA (step by step)
How to fine-tune a model using LoRA (step by step)
Underfitted
57 Late initialization in Mojo🔥 (Python doesn't support this)
Late initialization in Mojo🔥 (Python doesn't support this)
Underfitted
58 The $1,000,000 problem AI can't solve
The $1,000,000 problem AI can't solve
Underfitted
59 A gentle introduction to RAG (using open-source models)
A gentle introduction to RAG (using open-source models)
Underfitted
60 Automating feedback using ChatGPT and Zapier
Automating feedback using ChatGPT and Zapier
Underfitted

This video teaches how to implement authentication with an MCP server using AuthKit, showcasing a live example with the MCP Shop project. It covers the importance of authentication in API security and demonstrates how to configure authentication using AuthKit.

Key Takeaways
  1. Clone the MCP Shop repository
  2. Install dependencies
  3. Configure AuthKit
  4. Implement authentication in the MCP server
  5. Test authentication with a browser
  6. Integrate with an AI assistant
💡 Authentication is crucial for securing APIs, and AuthKit provides a straightforward way to implement authentication with an MCP server.

Related Reads

Up next
What is Deep Learning Explained with Examples
VLR Software Training
Watch →