You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 19d3637
Browse filesBrowse the repository at this point in the historyBrowse files
Add tk.* guard, HttpPipeline DI, and hosted-endpoint docs for token elicitation
- Reject token creation up front when the server's access token is a
temporary tk.* token (used by the hosted MCP endpoint), instead of
letting the Mapbox API round-trip fail. The elicitation dialog now
omits "create"/"auto-create" in that case and only offers "provide
an existing token".
- Move token-listing/creation off raw fetch() onto the shared
HttpPipeline (constructor-injected httpRequest), consistent with
other Mapbox API tools.
- Document the hosted-endpoint limitation in README and CHANGELOG.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,14 @@
1
1
## Unreleased
2
2
3
+
### New Features
4
+
5
+
-**Secure token elicitation for `preview_style_tool` / `style_comparison_tool`** (#57): `accessToken` is now optional on both tools. When omitted, the tool uses MCP elicitation to ask for a public token instead — either pasting an existing `pk.*` token, creating a new one with optional URL restrictions, or auto-creating a minimally-scoped one (`styles:read`, `styles:tiles`, `fonts:read`). This keeps your server's `sk.*`/`pk.*` access token out of chat history and preview URLs. Falls back to requiring `accessToken` directly on clients without elicitation support (Claude Desktop, Claude Code). A chosen/created token is cached in memory per account for the session; pass `useCustomToken: true` to force re-selection.
6
+
- On servers authenticated with a temporary `tk.*` token — notably the hosted MCP endpoint — Mapbox's Tokens API cannot create new tokens, so the "create a new token" and "auto-create" options are automatically omitted from the elicitation dialog rather than being offered and failing.
7
+
8
+
### Changed
9
+
10
+
-**`preview_style_tool` / `style_comparison_tool`**: token-listing and token-creation HTTP calls now go through the shared `HttpPipeline` (constructor-injected `httpRequest`) instead of a bare `fetch`, consistent with the rest of the API-calling tools.
Copy file name to clipboardExpand all lines: README.md
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -69,6 +69,8 @@ Get started by integrating with your preferred AI development environment:
69
69
-**Claude Desktop**: ⚠️ Not yet supported (Claude will fall back to creating tokens via chat)
70
70
-**Claude Code**: ⚠️ Not yet supported (provide `accessToken` parameter directly)
71
71
72
+
**Note on the hosted MCP endpoint**: even on a client with full elicitation support, the [hosted endpoint](#hosted-mcp-endpoint) only offers **"I have a token to provide"** — see below for why.
73
+
72
74
### DXT Package Distribution
73
75
74
76
This MCP server can be packaged as a DXT (Desktop Extension) file for easy distribution and installation. DXT is a standardized format for distributing local MCP servers, similar to browser extensions.
@@ -105,6 +107,13 @@ For quick access, you can use our hosted MCP endpoint:
105
107
106
108
For detailed setup instructions for different clients and API usage, see the [Hosted MCP Server Guide](https://github.com/mapbox/mcp-server/blob/main/docs/hosted-mcp-guide.md). Note: This guide references the standard MCP endpoint - you'll need to update the endpoint URL to use the devkit endpoint above.
107
109
110
+
**Token creation is unavailable on the hosted endpoint**: the hosted server authenticates each request with a short-lived, per-session token (`tk.*`), not your own Mapbox account token. Mapbox's Tokens API never grants `tokens:write` to a `tk.*` token, so it cannot be used to create new tokens. As a result, on the hosted endpoint:
111
+
112
+
-`preview_style_tool` / `style_comparison_tool`'s elicitation dialog only offers **"I have a token to provide"** — the "create a new token" and "auto-create" options are hidden automatically, rather than being offered and then failing.
113
+
-`create_token_tool` will fail with a permissions error if called directly.
114
+
115
+
Paste an existing public token (`pk.*`, with `styles:read` scope) when prompted, or create one ahead of time from your [Mapbox Account page](https://account.mapbox.com/). Running this server **locally** with your own `pk.*`/`sk.*` access token (which can carry `tokens:write`) restores all three elicitation options, including create and auto-create.
116
+
108
117
### Getting Your Mapbox Access Token
109
118
110
119
**A Mapbox access token is required to use this MCP server.**
@@ -194,6 +203,7 @@ Complete set of tools for managing Mapbox styles via the Styles API:
194
203
3.**Auto-create a basic token** - Let the tool create a simple preview token for you
195
204
-**Goose**: ⚠️ Known bug - Form displays after timeout ([goose#6471](https://github.com/block/goose/issues/6471))
196
205
-**Claude Desktop, Claude Code**: ⚠️ Not yet supported - Provide `accessToken` parameter directly, or Claude will intelligently offer to create a token for you using `create_token_tool`
206
+
-**Hosted MCP endpoint**: ⚠️ Only "provide an existing token" is offered, regardless of client — see [Token creation is unavailable on the hosted endpoint](#hosted-mcp-endpoint)
197
207
-**Alternative**: Provide `accessToken` parameter directly for backward compatibility with any client
198
208
-**Session Storage**: Your token choice is cached for the session, so you only need to provide it once (when elicitation is supported)
199
209
-**Best Practice**: Use URL-restricted tokens to further limit token usage to specific domains. While public tokens in URLs are read-only, URL restrictions add an extra layer of security by ensuring tokens only work on your specified domains
@@ -216,6 +226,7 @@ Complete set of tools for managing Mapbox styles via the Styles API:
216
226
3.**Auto-create a basic token** - Let the tool create a simple preview token for you
217
227
-**Goose**: ⚠️ Known bug - Form displays after timeout ([goose#6471](https://github.com/block/goose/issues/6471))
218
228
-**Claude Desktop, Claude Code**: ⚠️ Not yet supported - Provide `accessToken` parameter directly, or Claude will intelligently offer to create a token for you using `create_token_tool`
229
+
-**Hosted MCP endpoint**: ⚠️ Only "provide an existing token" is offered, regardless of client — see [Token creation is unavailable on the hosted endpoint](#hosted-mcp-endpoint)
219
230
-**Alternative**: Provide `accessToken` parameter directly for backward compatibility with any client
220
231
-**Session Storage**: Your token choice is cached for the session, so you only need to provide it once (when elicitation is supported)
221
232
-**Best Practice**: Use URL-restricted tokens to further limit token usage to specific domains. While public tokens in URLs are read-only, URL restrictions add an extra layer of security by ensuring tokens only work on your specified domains
0 commit comments