PTENES
MODULE 2.3

🔧 Install and authenticate

The safe step-by-step process: get the key, store it in .env, start the server, test it. The rule that never changes — the key goes through the file, never through the conversation.

6
Topics
30
Minutes
Beginner
Level
Practice
Type
0 of 60%
1

🗝️ Step 1 — get the key from the service's website

New here? One API key (API key, short for application programming interface — “application programming interface,” the door through which two programs communicate) is a unique code, usually a long string of letters and numbers, that the service uses to identify who’s making the request and charge for (or limit) usage appropriately. Think of it as a visitor badge: without one, the front desk (the service’s server) won’t let you in. You get this key by creating an account on the service’s website—for example, on Firecrawl, there’s a “Get API key” button in the dashboard after a quick signup, usually with a free plan that’s enough to try it out.

Each server MCP (the “connector” that gives your agent hands, explained in earlier modules) talks to a different service out there, and each service has its own key. Firecrawl (which scrapes web pages) has a key; if you later connect an email or spreadsheet MCP server, each one will ask for its own. These keys don’t get mixed up—each one opens only its own service’s door.

💡 Practical Tip

Copy the key as soon as it appears on the screen—many services show it only once for security. If you lose it, you can generate another one—no problem.

🔍 See inside

Signing up on the service’s website is free—it’s the use which may have a cost. Most MCP services have a monthly free quota (for example, “500 pages scraped for free per month”) and only charge after you exceed it. Keep an eye on the service dashboard to see how much you’ve used; it shows this clearly, without needing any extra tools.

2

📄 Step 2 — store the key in a .env file

New here? A file .env is a plain text file inside your project folder that stores secrets — keys, passwords — outside the code and outside the conversation. It should never be shared or uploaded to the GitHub (the site where your project’s code is stored and versioned—the Trail 0 already covered how to organize your folder; the .env goes alongside it, but gets special treatment).

The filename starts with a dot on purpose: on Unix-like systems (Mac and Linux), files with a dot at the front are “hidden” by default — they don’t appear in a regular list of files, which lowers the chance you’ll accidentally drag one somewhere public. Even so, the real protection isn’t the name; it’s the .gitignore — a second text file that tells git "never track these files."

# Inside the .env file, at the project root:
FIRECRAWL_API_KEY=<your-copied-key>

Objective: keep the key out of the chat and version control. How to verify: open the file .gitignore from the project and confirm that the line .env it’s there — so git will never try to upload this file.

where the key lives — and where it should never go the service’s sitegenerates the key .env fileonly place where the key is storedfor real, in text agent reads it when needednever typed again GitHubblocked by the.gitignore conversation with the agentthe key never appearstyped here

Caption: the key is created on the service’s website, goes only in the .env file, and that’s where the agent reads it when needed — .gitignore and the habit of never typing the key in chat close the two most common leak paths.

3

🚫 Golden rule: never put a key in chat

Never paste an API key directly into a conversation with Claude Code. The conversation may be saved in logs, reviewed later, or even exposed in a screenshot shared by mistake. The file .env exists specifically to isolate that secret — the agent reads it from there when needed, so you don't have to type it again in every session.

This rule applies even when it seems faster to "just paste it here to test." The time saved is a few seconds; the risk is that the key gets recorded somewhere you no longer control. If you ever need to show your conversation history to someone — technical support, a coworker, a screenshot of an error — you want to be absolutely sure there are no secrets in it.

💡 Practical Tip

Tell the agent directly: "install and configure using the key in my .env" — never "here's my key: ...". The agent can read the file on its own; you never need to type the value.

✓ Do

  • ✓Paste the key only in the .env file
  • ✓Check that .env is in .gitignore

✗ Avoid

  • ✗Typing "my key is abc123..." in the conversation
  • ✗Upload the .env to the project repository
4

🔌 Step 3 — connect the MCP server

install and authenticate in 4 steps 1get the keyon the service's website 2store in .envnever in chat 3start the servera single command 4testsimple request

Caption: the four standard steps for securely connecting any MCP server — the key never passes through the conversation, only through the .env file.

With the key already in .env, starting the server is usually a single command in Claude Code—the agent can run it for you if you ask it to “install and configure the Firecrawl MCP server.” It reads the key from .env automatically, so you don’t have to copy and paste it again.

# Paste into the conversation with Claude Code:
Install and configure the Firecrawl MCP server using the key in my .env

Objective: get the MCP server ready to use. How to verify: run /mcp in Claude Code and check whether "firecrawl" appears in the list with a connected status.

🔍 See inside

Connecting the server saves a local configuration — a record saying “when I need Firecrawl, use this command and read the key from this .env variable.” No actual call happens at this step. Only in Step 4, when you request real work, does the agent call the server, the server send the key to Firecrawl, and Firecrawl return the scraping results — all of this travels outside your conversation, between the MCP server (running on your computer) and the service on the internet.

If the installation command returns an error, the most common causes are a missing system dependency (the agent usually tells you what’s missing and how to install it) or a variable name in .env that doesn’t match what the server expects—check that you wrote it exactly FIRECRAWL_API_KEY, with no space before or after the equals sign.

5

✅ Step 4 — test with a simple request

Before trusting the server with a big task, test it with a small, easy-to-check request—for example, ask for the title of a page you know. If the result matches what you expect, the server is working properly.

# Test request:
Use Firecrawl to get me the title of the inema.club page

Objective: confirm that authentication and the connection work end to end. How to verify: the agent should return the page's actual title, without an authentication error or timeout.

🔍 Inside

If authentication fails, it’s almost always because the key is wrong or wasn’t saved in the right place—check the .env file before suspecting something more complicated.

Not every test error is about the key. Some come from the service; others come from the site you’re trying to access. Knowing which is which saves time — and keeps you from changing the .env when the problem is somewhere else.

✓ Sign that everything is OK

  • ✓Quick response (a few seconds) with the actual page title
  • ✓"firecrawl" appears connected in /mcp

✗ Common mistakes and what to do

  • ✗Invalid key — check the .env file for extra spaces
  • ✗Site blocks scraping — test another page to confirm the server works
  • ✗Empty result — it may be a page that requires login; try a public one
  • ✗Usage limit exceeded — check the service dashboard for your quota
6

🔁 Replacing or revoking a key

If you suspect a key has leaked (for example, it accidentally appeared in a screenshot or public repository), replace it immediately: generate a new one in the service dashboard, revoke (cancel) the old one, and update only the file .env — nothing else in the project changes.

New here? Revoke means revoking the validity of that specific key — the service starts rejecting any request made with it, even if the person who copied it still has it saved somewhere. This is different from “deleting your account”: you still have normal access to the service, just with a new key.

1. distrustscreenshot, public repo... 2. generate newin the service dashboard 3. revoke the old oneshuts the door for good 4. update .envonly this file changes

Caption: step 3 (revoke) is the only one that actually shuts off access to the leaked key — generating a new key without revoking the old one leaves both valid at the same time.

⚠️ Attention

A leaked key that hasn’t been revoked still works for anyone who has seen it — revoking it is the only way to truly close that door.

💡 Practical Tip

After changing the key, run the same test request from Step 4 again—if it works normally, that means .env was updated correctly and the server is reading the new key.

✅ Module Summary

✓
API key: unique code that identifies you to the service.
✓
.env: secret file outside the code and outside the chat.
✓
Golden rule: key never pasted into the conversation.
✓
Test: always make a small request before trusting it with a big job.

Next module:

2.4 — The cheat sheet pattern