Skip to content

Commit

Permalink
Merge pull request #28 from jlowin/env
Browse files Browse the repository at this point in the history
Remove top level env var
  • Loading branch information
jlowin authored Dec 1, 2024
2 parents ce8e4d7 + abbbd53 commit 4383027
Showing 1 changed file with 2 additions and 41 deletions.
43 changes: 2 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,11 @@ FastMCP handles all the complex protocol details and server management, so you c
- [Prompts](#prompts)
- [Images](#images)
- [Context](#context)
- [Environment Variables](#environment-variables)
- [Claude Desktop](#claude-desktop)
- [Development Mode](#development-mode)
- [Deployment](#deployment)
- [Development](#development)
- [Environment Variables](#environment-variables)
- [Claude Desktop](#claude-desktop)
- [Environment Variables](#environment-variables-1)
- [Claude Desktop](#claude-desktop-1)
- [Environment Variables](#environment-variables-2)
- [Examples](#examples)
- [Echo Server](#echo-server)
- [SQLite Explorer](#sqlite-explorer)
Expand Down Expand Up @@ -282,42 +279,6 @@ The Context object provides:
- Resource access through `read_resource()`
- Request metadata via `request_id` and `client_id`

## Environment Variables

MCP servers run in isolated environments and do not inherit environment variables from your system. Here's how to handle environment variables in different contexts:

### Claude Desktop

When installing a server in Claude Desktop, provide environment variables using the CLI:

```bash
# Single env var
fastmcp install server.py -e API_KEY=abc123

# Multiple env vars
fastmcp install server.py -e API_KEY=abc123 -e OTHER_VAR=value

# Load from .env file
fastmcp install server.py -f .env
```

Environment variables persist across reinstalls and are only updated when new values are provided:

```bash
# First install
fastmcp install server.py -e FOO=bar -e BAZ=123

# Second install - FOO and BAZ are preserved
fastmcp install server.py -e NEW=value

# Third install - FOO gets new value, others preserved
fastmcp install server.py -e FOO=newvalue
```

### Development Mode

The MCP Inspector also runs servers in an isolated environment. Environment variables must be set through the Inspector UI and are not inherited from your system. The Inspector does not currently support setting environment variables via command line (see [Issue #94](https://github.com/modelcontextprotocol/inspector/issues/94)).

## Deployment

The FastMCP CLI helps you develop and deploy MCP servers.
Expand Down

0 comments on commit 4383027

Please sign in to comment.