agent-browser-mcp

Proxy agent-browser MCP stdio over HTTP/SSE using FastMCP.
git clone https://unitehenry.com/git/agent-browser-mcp.git
Log | Files | Refs | README

commit b77dca90ff05d50eb107a900821eec1e99ee201a
parent 3c3ce04f5c6621dadfe903cb6dc43c009ac36ec8
Author: Henry Unite <unitehenry@gmail.com>
Date:   Sat, 25 Jul 2026 02:04:02 +0000

feat: github oauth

Diffstat:
Mmain.py | 36++++++++----------------------------
1 file changed, 8 insertions(+), 28 deletions(-)

diff --git a/main.py b/main.py @@ -1,5 +1,4 @@ import os -import json from fastmcp import FastMCP from fastmcp.tools import Tool @@ -12,6 +11,7 @@ from fastmcp.exceptions import AuthorizationError from fastmcp.server.auth import OAuthProxy from fastmcp.server.auth.providers.jwt import JWTVerifier from fastmcp.server.dependencies import get_access_token +from fastmcp.server.auth.providers.github import GitHubProvider class AuthMiddleware(Middleware): async def on_request(self, context: MiddlewareContext, call_next): @@ -20,7 +20,8 @@ class AuthMiddleware(Middleware): if token is None: raise AuthorizationError("Unauthorized") - print(token.claims) + if token.claims.get("login") != "unitehenry": + print(token.claims) result = await call_next(context) @@ -32,27 +33,10 @@ if __name__ == "__main__": transport = StdioTransport(command="agent-browser", args=["mcp"]) proxy = create_proxy(transport, name="AgentBrowserProxy") - token_verifier = JWTVerifier( - jwks_uri="https://github.com/login/oauth/.well-known/jwks", - issuer="https://github.com/login/oauth", - audience="agent-browser-mcp" - ) - - # Create the OAuth proxy - auth = OAuthProxy( - # Provider's OAuth endpoints (from their documentation) - upstream_authorization_endpoint="https://github.com/login/oauth/authorize", - upstream_token_endpoint="https://github.com/login/oauth/access_token", - - # Your registered app credentials - upstream_client_id="Ov23liCRP7viT9hrgP0E", - upstream_client_secret="74c442d0b92e762f09891ce5c060032e9e4a1228", - - # Token validation (see Token Verification guide) - token_verifier=token_verifier, - - # Your FastMCP server's public URL - base_url="https://dc92-172-92-31-26.ngrok-free.app", + auth = GitHubProvider( + client_id="Ov23liCRP7viT9hrgP0E", + client_secret="74c442d0b92e762f09891ce5c060032e9e4a1228", + base_url="https://dc92-172-92-31-26.ngrok-free.app" ) mcp = FastMCP("AgentBrowser", auth=auth) @@ -72,11 +56,7 @@ if __name__ == "__main__": ) ) - mcp.add_middleware( - RateLimitingMiddleware(max_requests_per_second=10.0, burst_capacity=20) - ) - - # mcp.add_middleware(AuthMiddleware()) + mcp.add_middleware(AuthMiddleware()) asyncio.run(setup())