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
Discussion options

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

Comment options

You must be logged in to vote
13 replies
@taimurlak
Comment options

@rude-seagull
Comment options

Answer selected by taimurlak
@taimurlak
Comment options

@rude-seagull
Comment options

@taimurlak
Comment options

@taimurlak
Comment options

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