Skip to content

How to Pass and Retrive env for authentication in MCP dotnet #176

Answered by rude-seagull
taimurlak asked this question in Q&A

You must be logged in to vote

You could also try this (did not work for me but maybe this will do the trick for you)

await using IMcpClient mcpClient = await McpClientFactory.CreateAsync(
            new()
            {
                Id = "github",
                Name = "GitHub",
                TransportType = "stdio",
                Location = null,
                TransportOptions = new()
                {
                    ["command"] = "npx",
                    ["arguments"] = "-y @modelcontextprotocol/server-github",
                    ["env:GITHUB_PERSONAL_ACCESS_TOKEN"] = ""
                },
            },

Replies: 1 comment 13 replies

You must be logged in to vote
13 replies
@taimurlak

@rude-seagull

Answer selected by taimurlak
@taimurlak

@rude-seagull

@taimurlak

@taimurlak

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants