From abbbd53539706cee690aeeb712c5c2278d4aba32 Mon Sep 17 00:00:00 2001 From: Jeremiah Lowin <153965+jlowin@users.noreply.github.com> Date: Sat, 30 Nov 2024 22:25:49 -0500 Subject: [PATCH] Remove top level env var --- README.md | 43 ++----------------------------------------- 1 file changed, 2 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index 094bba8f9..2e8ccd1fb 100644 --- a/README.md +++ b/README.md @@ -51,14 +51,11 @@ That's it! FastMCP handles all the complex protocol details and server managemen - [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) @@ -272,42 +269,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.