Skip to main content
Glama
JainamDosi

mcp-server

by JainamDosi
README.md
# mcp-server

FastMCP server with pluggable multi-provider authentication (Google OAuth + custom JWT).

## Setup

```bash
cd mcp-server
uv venv
# Windows:
.venv\Scripts\activate
# Linux/macOS:
source .venv/bin/activate

uv add fastmcp authlib pyjwt python-dotenv google-auth fastapi uvicorn
```

Copy `.env` and fill in your credentials:
```
GOOGLE_CLIENT_ID=...
GOOGLE_CLIENT_SECRET=...
JWT_SECRET=...
JWT_ALGORITHM=HS256
```

## Run

```bash
uv run src/server.py
```

## Tools

| Tool | Description |
|------|-------------|
| `echo(text)` | Returns the text as-is |
| `add(a, b)` | Returns a + b |
| `get_server_time()` | Returns current UTC time |

## Auth

Pass a `Authorization: Bearer <token>` header. The server tries all registered providers in order:
1. **Google** — verifies Google ID tokens via `google-auth`
2. **JWT** — verifies JWTs signed with `JWT_SECRET`

## Extending

Add a new provider:
1. Implement `AuthProvider` in `src/auth/your_provider.py`
2. Register it in `server.py`: `registry.register("name", YourProvider())`

No other changes needed.