Przejdź do treści
Biblioteka skilli
AI i agenci · Integracja z narzędziem

refresh-okf-mcp-token

/refresh-okf-mcp-token

Pobiera lub odświeża token dostępu OAuth2 do serwera MCP wiki OKF Data, gdy pojawiają się błędy 401 lub 403 albo wygasły token.

Licencja
MIT
Ostatnia zmiana repozytorium
27.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
3
Przestarzałość

Brak sygnałów. Repozytorium zmienione 27.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Pobiera lub odświeża token dostępu OAuth2 do serwera MCP wiki OKF Data, gdy pojawiają się błędy 401 lub 403 albo wygasły token.

Oryginalny opis (EN)

Fetch or refresh an OAuth2 access token for the OKF Data wiki consumption MCP server. Use when the OKF MCP server returns 401/403/unauthorized/expired-token errors, when the user asks to refresh, renew, or get a new OKF MCP token, or when setting up authentication to call the okf-mcp / okf_consumption MCP runtime.

Jak działa

  1. Server details (defaults)
  2. Configuration
  3. Steps
  4. How it all fits together
  5. Notes
Sekcje z nagłówków SKILL.md, w oryginale · 103 linii, 520 słów
Podgląd SKILL.md
---
name: refresh-okf-mcp-token
description: Fetch or refresh an OAuth2 access token for the OKF Data wiki consumption MCP server. Use when the OKF MCP server returns 401/403/unauthorized/expired-token errors, when the user asks to refresh, renew, or get a new OKF MCP token, or when setting up authentication to call the okf-mcp / okf_consumption MCP runtime.
---

# Refresh OKF MCP Token

Fetches a short-lived (~1 hour) OAuth2 access token for the OKF Data wiki
consumption MCP server using the `client_credentials` grant.

**Normal operation:** The token is fetched and cached automatically by the
`headersHelper` script (`scripts/okf-headers-helper.sh`) on every MCP
connection. Claude Code also re-runs it on 401/403 and retries, so manual
refresh should rarely be needed.

**When to use this skill:** If you need to debug token issues, force a fresh
token from Cognito, or use the token outside of Claude Code.

## Server details (defaults)

| Field | Value |
|---|---|
| Token endpoint | `https://okf-<AWS_ACCOUNT_ID>.auth.<AWS_REGION>.amazoncognito.com/oauth2/token` |
| Scope | `okf-mcp/invoke` |
| AWS region | `<AWS_REGION>` |
| MCP runtime ARN | `arn:aws:bedrock-agentcore:<AWS_REGION>:<AWS_ACCOUNT_ID>:runtime/okf_consumption-<RUNTIME_ID>` |
| MCP endpoint | `https://bedrock-agentcore.<AWS_REGION>.amazonaws.com/runtimes/<url-encoded-ARN>/invocations?qualifier=DEFAULT` |

## Configuration

Credentials are read from (in order):
1. Environment variables (`OKF_MCP_CLIENT_ID`, `OKF_MCP_CLIENT_SECRET`)
2. The credentials file: `~/.okf/credentials` (env-style KEY=VALUE lines)
3. Interactive prompt (only when a TTY is attached)

Run the `setup` skill to create `~/.okf/credentials` for the first time.

| Variable | Required | Purpose |
|---|---|---|
| `OKF_MCP_CLIENT_ID` | — | OAuth2 client id (or read from credentials file) |
| `OKF_MCP_CLIENT_SECRET` | — | OAuth2 client secret (or read from credentials file) |
| `OKF_MCP_CREDENTIALS_FILE` | — | Override path to credentials file (default `~/.okf/credentials`) |
| `OKF_MCP_TOKEN_CACHE` | — | Override path to cached token (default `~/.okf/token-cache.json`) |
| `OKF_MCP_URL` | — | Override the MCP endpoint URL |
| `OKF_MCP_TOKEN_ENDPOINT` | — | Override the Cognito token endpoint |
| `OKF_MCP_SCOPE` | — | Override the OAuth2 scope (default `okf-mcp/invoke`) |

## Steps

1. Check credentials are available (env, `~/.okf/credentials`, or prompt). If
   not and the run is non-interactive, ask the user to run the `setup` skill
   first.

2. Run the bundled token helper (lives in the plugin's `scripts/` folder):

   ```bash
   python3 "${CLAUDE_PLUGIN_ROOT}/scripts/okf-mcp-token.py"
   ```

   Output modes (first positional argument):
   - `token` (default) — prints the raw access token
   - `export` — prints `export OKF_TOKEN=<token>` (for `eval`)
   - `headers` — prints `{"Authorization": "Bearer <token>"}` (what `headersHelper` uses)

   To force a fresh token (ignore cache):

   ```bash
   rm -f ~/.okf/token-cache.json
   python3 "${CLAUDE_PLUGIN_ROOT}/scripts/okf-mcp-token.py"
   ```

3. `curl` fallback (no script):

   ```bash
   curl -s -X POST "${OKF_MCP_TOKEN_ENDPOINT:-https://okf-<AWS_ACCOUNT_ID>.auth.<AWS_REGION>.amazoncognito.com/oauth2/token}" \
     -u "$OKF_MCP_CLIENT_ID:$OKF_MCP_CLIENT_SECRET" \
     -H "Content-Type: application/x-www-form-urlencoded" \
     -d "grant_type=client_credentials&scope=${OKF_MCP_SCOPE:-okf-mcp/invoke}"
   ```

   The response is JSON:
   `{"access_token": "…", "expires_in": 3600, "token_type": "Bearer"}`.

## How it all fits together

```
.mcp.json (headersHelper)
   └── scripts/okf-headers-helper.sh
         └── scripts/okf-mcp-token.py headers
               ├── reads ~/.okf/credentials (client id/secret)
               ├── fetches token from Cognito (or returns cached)
               ├── caches to ~/.okf/token-cache.json
               └── prints {"Authorization": "Bearer <token>"}
```

Claude Code calls the `headersHelper` on every connection and on 401/403, so
token refresh is fully automatic. No `OKF_TOKEN` env var is needed anymore.

## Notes

- **Do not print or log the full token** in shared output unless asked; truncate
  it (e.g. first 24 chars) as the helper's stderr hint does.
- Tokens are short-lived (~1 hour). On a 401/403 from the MCP server, Claude
  Code automatically re-runs the helper and retries the call once.
- `scripts/okf-mcp-token.py` uses only the Python standard library — no dependencies.
- The token cache and credentials are stored in `~/.okf/` (outside the repo).

Wersje

W bazie nie ma innych skilli o nazwie refresh-okf-mcp-token.

Migawka bazy z 13.11.2026 · wersja paczki a74c11e33815 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 1 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100okf-wiki
    Buduje bazę wiedzy w Open Knowledge Format (OKF) z istniejących dokumentów, notatek lub repozytorium i tworzy szkielet wiki OKF.
  • 100okf-agent-memory
    Obsługuje CLI w Go i serwer MCP pamięci projektu w formacie OKF v0.2 zapisanej w Gicie, z wyszukiwaniem i walidacją wpisów.
  • 100setup
    Podaje instrukcję utworzenia pliku z danymi OAuth2 dla wtyczki OKF MCP, gdy brakuje poświadczeń.
  • 100memory-okf
    Przygotowuje projekt Basic Memory do eksportu OKF v0.2, znajdując i naprawiając to, co go blokuje, przy publikacji, przekazaniu lub sprawdzaniu paczki OKF.
  • 100okf
    Tworzy, sprawdza i czyta paczki Google Open Knowledge Format v0.1, czyli atomy wiedzy w Markdownie z frontmatterem YAML.
  • 100okf-maintain-knowledge
    Tworzy i aktualizuje paczki wiedzy OKF o usługach, API, schematach i decyzjach, gdy zmienia się kod lub dokumentacja projektu.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.