Skip to content

Commit 2c85c66

Browse files
committed
switch to localhost
1 parent 8ddf7f7 commit 2c85c66

File tree

1 file changed

+5
-3
lines changed
  • examples/servers/simple-auth/mcp_simple_auth

1 file changed

+5
-3
lines changed

examples/servers/simple-auth/mcp_simple_auth/server.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class ServerSettings(BaseSettings):
3535
model_config = SettingsConfigDict(env_prefix="MCP_GITHUB_")
3636

3737
# Server settings
38-
host: str = "0.0.0.0"
38+
host: str = "localhost"
3939
port: int = 8000
4040
server_url: AnyHttpUrl = AnyHttpUrl("http://localhost:8000")
4141

@@ -196,7 +196,9 @@ async def exchange_authorization_code(
196196
(
197197
token
198198
for token, data in self.tokens.items()
199-
if token.startswith("gho_") and data.client_id == client.client_id
199+
# see https://github.blog/engineering/platform-security/behind-githubs-new-authentication-token-formats/
200+
# which you get depends on your GH app setup.
201+
if (token.startswith("ghu_") or token.startswith('gho_')) and data.client_id == client.client_id
200202
),
201203
None,
202204
)
@@ -341,7 +343,7 @@ async def get_user_profile() -> dict[str, Any]:
341343

342344
@click.command()
343345
@click.option("--port", default=8000, help="Port to listen on")
344-
@click.option("--host", default="0.0.0.0", help="Host to bind to")
346+
@click.option("--host", default="localhost", help="Host to bind to")
345347
def main(port: int, host: str) -> int:
346348
"""Run the simple GitHub MCP server."""
347349
logging.basicConfig(level=logging.INFO)

0 commit comments

Comments
 (0)