How should the env parameter be passed in stdio mode? #1855
Unanswered
Apple-Blossom23
asked this question in
Q&A
Replies: 2 comments 1 reply
-
|
Hello @Fs1114508. from fastmcp import Client
from fastmcp.client.transports import StdioTransport
transport = StdioTransport(
command="python",
args=["fast_mcp_server.py"],
env={"API_KEY": "secret", "DEBUG": "true"}
)
client = Client(transport) |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Thank you, I understand.
…------------------ Original ------------------
From: Sebastian Kalisz ***@***.***>
Date: Fri,Sep 19,2025 7:11 PM
To: jlowin/fastmcp ***@***.***>
Cc: Fs1114508 ***@***.***>, Mention ***@***.***>
Subject: Re: [jlowin/fastmcp] How should the env parameter be passed in stdiomode? (Discussion #1855)
Hello @Fs1114508. env keyword is an attribute of StdioTransport class, not Client. Example below should work:
from fastmcp import Client from fastmcp.client.transports import StdioTransport transport = StdioTransport( command="python", args=["fast_mcp_server.py"], env={"API_KEY": "secret", "DEBUG": "true"} ) client = Client(transport)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
from fastmcp import Client
client = Client(
"fast_mcp_server.py",
env={"API_KEY": "secret", "DEBUG": "true"}
)
TypeError: Client.init() got an unexpected keyword argument 'env'
my fastmcp version is 2.12.3
Beta Was this translation helpful? Give feedback.
All reactions