Chapter 1: Set up Keycard
This chapter is all Keycard console, no code. The MCP server keeps running exactly as it is. You’ll make one thorough trip through the Keycard console and register everything the rest of the workshop needs: how people sign in, the resources your server will need credentials for, and the application that represents the server itself.
Every chapter after this changes exactly one thing in the codebase. When Chapter 4 requires a Supabase credential or Chapter 6 swaps an API key for Linear OAuth, the console will be ready to go. You’ll see the authorization story come together, because you configured it here and you know what each piece is for.
You don’t need to memorize any Keycard concepts up front. We’ll define each piece as we create it.
Sign up for Keycard
Section titled “Sign up for Keycard”-
Go to the Keycard AIE Workshop Signup page and enter your Keycard beta access code (provided by workshop instructors), then click Sign up with GitHub.
-
Log into GitHub, if you’re not logged in already. Click Authorize on the GitHub consent screen.
-
Go to console.keycard.ai and click “Continue with GitHub” to create your Keycard account.
-
Once logged in, you’ll land on your Keycard console homepage.
Take the tour
Section titled “Take the tour”Your Keycard console isn’t empty. Before adding anything, explore what’s already there. The prepopulated entities demonstrate every concept you’re about to use.
-
Applications has the Keycard CLI and Keycard ID Zone, both marked Keycard provided. Applications are runtimes that access Keycard; the CLI is a runtime that Keycard ships so its own command-line tool can act. The Keycard ID Zone application allows the Keycard Identity Provider to log in SSO users and manages the SSO Provider and credentials. Your MCP servers, agent SDKs, etc. are also applications because they access Keycard to exchange tokens.
-
Resources already lists two: the Events API and OpenID Connect UserInfo. These are Keycard endpoints that return data on logging and Keycard users. Keycard registers them the same way you’ll register everything else. Even the platform’s own APIs play by the resource rules: if an agent wants a token, they have to be registered and governed.
-
People are the users registered with your Keycard. You can change users’ roles and invite users. Each person’s identity provider is also listed.
-
Policies contains one default policy set that allows applications to access resources on behalf of users. You’ll add a second policy set in Chapter 7. Policies are additive, with forbids overriding allows: if any policy forbids a request, it’s rejected, and if all policies allow it, it’s allowed. Since the Keycard platform is “deny by default,” the provided default policy set opens things up so you can get started quickly.
-
Providers lists three items: Keycard ID (Keycard login with username/password), Zone Provider (OAuth providers), and the Zone Vault Provider (secrets vault). A provider issues authentication credentials to users and applications, and issues access credentials that permit users and agents to access resources.
-
Under the Activity heading, you’ll find Sessions and Audit Log. The audit log is empty-ish now. It will not stay that way, and watching it fill up tells the story of progression in this workshop.
Grab your Keycard URLs
Section titled “Grab your Keycard URLs”-
Under the Organization heading in the sidebar, click Settings. Note your OAuth URLs near the bottom of the page.
-
Keycard is an OAuth issuer. An issuer is an authorization server that issues tokens. Keep your Issuer URL handy. In Chapter 2 it becomes
KEYCARD_URL, the issuer your MCP server trusts tokens from. -
You’ll also find your Redirect URL under OAuth. This is the callback your identity provider sends users back to after they sign in. You’ll need it to set up external OAuth providers, like Linear.
Create the Keycard application
Section titled “Create the Keycard application”When we have a collection of resources, something needs to access them. Runtimes that access resources through Keycard are applications, and your MCP server is one. The application is your MCP server’s identity in Keycard. It’s what authenticates to Keycard when the MCP server exchanges tokens, what users grant access to, and what policies constrain.
-
Go to Applications → Add Application.
-
Configure the app:
Application Name:
Keycard Workshop MCP ClientIdentifier:
urn:workshop:mcp:clientConsent: Leave it on Required.
-
Create the application, then open its Application Credentials tab and click Add credential. You’ll be offered four ways an application can prove its identity.
Choose Client ID & Secret.
-
The console shows you the generated
client_idandclient_secretonce. Copy both into your.envnow, at the bottom:.env KEYCARD_CLIENT_ID=<your-client-id>KEYCARD_CLIENT_SECRET=<your-client-secret>After you click “Done,” the console will only show that a credential exists. If you lose the secret, delete the credential and add a new one.
Register the four resources
Section titled “Register the four resources”A resource is anything an agent gets a credential for: your own MCP server, a database, or a third-party service. Registering the resource tells Keycard “you will mint, store, broker, govern, and audit credentials for this entity.”
The server touches four resources, all of which you’ll register in the next several sections:
| Resource | Identifier | Credential provider |
|---|---|---|
| Workshop MCP Server | http://localhost:8000/mcp | Zone Provider |
| Supabase Database | https://tsfavofmgkbyuujubppe.supabase.co | Zone Vault Provider |
| Anthropic API | https://api.anthropic.com | Zone Vault Provider |
| Linear API | https://api.linear.app | Linear (auto-provisioned from the catalog) |
Two of these come from the instructor: the Supabase project URL with its secret API key, and an Anthropic API key. You’ll create your own OAuth app for Linear shortly.
Your MCP server
Section titled “Your MCP server”You’ve already added your MCP server as an application, which gave it an identity and the ability to call other resources. Now you’ll add it as a resource as well, because your coding agent needs to call the MCP server as a resource.
In this workshop, your other components are downstream third party resources. They don’t call any additional resources, so they only play one role. The MCP server is both, which is also what builds the delegation chain correctly (client -> MCP server, MCP server -> downstream resource). If you built your own custom agent and wanted it to call your MCP server, that agent would be configured in Keycard as an application because it calls resources, but doesn’t receive access requests from other clients.
-
Go to Resources → Add Resource → Add Manually. (You’ll use the resource catalog for Linear later.)
-
Set the resource Name:
Workshop MCP ServerIdentifier is your MCP endpoint, including the
/mcppath:http://localhost:8000/mcpThis exact string matters. When your server verifies a token in Chapter 2, it checks that the token’s audience matches this identifier, and Keycard compares it as an exact string.
http://localhost:8000without the path, or with a trailing slash, will not match. Type it exactly as above.Leave Use Gateway off.
-
Set Provided by Application by selecting
Keycard Workshop MCP Clientin the dropdown. Your application provides this resource: the MCP endpoint is the part of your server that clients get tokens to access, and the application is the server. This is the only resource today that gets a provided-by; the other three are external services your app merely uses. -
Set the Credential Provider to the Zone Provider (Keycard STS), and click Protect Workshop MCP Server.
Supabase, in the vault
Section titled “Supabase, in the vault”The support tickets are moving from a static JSON file to a Supabase database in Chapter 4, and reading them will require a credential: the project’s secret API key (the sb_secret_…; Supabase’s older guides call its predecessor the service-role key). That key is exactly the kind of secret that usually ends up in .env. Instead it goes in your Keycard vault. In Chapter 4 your server will obtain it per request, with every retrieval audited. You’re registering the resource and storing the secret (encrypted, in the vault) now; the code catches up later.
-
Click Resources → Add Resource → Add Manually.
Name:
Supabase DatabaseSet Identifier to the workshop’s Supabase project URL:
https://tsfavofmgkbyuujubppe.supabase.co -
Set the Credential Provider to the Zone Vault Provider and click Protect Supabase Database.
-
Open the resource’s Credentials tab and click Add credential.
Name it:
SUPABASE_SECRET_KEYIn the Token field, paste the secret key (provided by workshop instructors).
Click Create.
Anthropic, in the vault
Section titled “Anthropic, in the vault”You’ll add the instructor-provided Anthropic API key to the Keycard vault as well. In Chapter 5 the server uses an LLM to mask PII before it crosses into Linear. The Anthropic API key is another static secret that will never be stored on disk.
-
Click Resources → Add Resource → Add Manually.
Name:
Anthropic APIIdentifier:
https://api.anthropic.com -
Credential Provider: Zone Vault Provider. Protect it.
-
On the Credentials tab, add a credential with the Name:
ANTHROPIC_API_KEYIn the Token field, add the instructor-provided API key. Create the credential.
Linear, behind OAuth
Section titled “Linear, behind OAuth”You’ll set up Linear differently, using OAuth 2.0. The Linear API supports OAuth 2.0: it can mint scoped, short-lived, per-user tokens on demand. So instead of storing a static key, you configure a provider that can negotiate access, and Keycard handles the negotiation every time your server needs a token.
Linear is also in Keycard’s resource catalog, so the Keycard configuration is mostly automatic. However, you do need to create and configure a Linear OAuth app first.
-
Create your Linear OAuth app in the workshop workspace. Go to linear.app/keycard-workshop/settings/api/applications/new.
Set the Application name to:
<your name> OAuth Appso you can tell yours apart from everyone else’s in the shared workspace.
Fill in your Developer name.
In the Redirect URIs field, paste your Keycard Redirect URL, the URL you noted in Keycard Settings earlier.
-
Click Create, then note your Linear Client ID and Client secret.
Everyone’s app lives in one Linear workspace, but each has a different ID and authorizes access from a different Keycard account. Later, we’ll see just how important identity delegation is in a shared space.
-
Back in Keycard: Resources → Add Resource → Explore Resources, and pick Linear API from the catalog. Because the catalog already knows Linear’s endpoints, most of the configuration is done for you.
-
Fill in the Client ID and Client secret from the Linear OAuth app you just created. Click Protect Linear API.
-
On the Linear API resource page, at the bottom you’ll see Active scopes.
readandwriteare pre-populated. Click Add scope and add:issues:createThen click Save Changes.
Connect application dependencies
Section titled “Connect application dependencies”Now that your resources are configured, tell Keycard your MCP application is allowed to ask for them. An application provides its own endpoints and depends on everything it accesses.
-
Open Applications → Keycard Workshop MCP Client → Dependencies → Add dependency.
-
Check: Anthropic API, Linear API, and Supabase Database, then click Connect.
The dependency list is your MCP server’s entire blast radius. It can request credentials for these resources. When you add policy in Chapter 7, you’ll learn how to further restrict access within these providers.