mcp-compress-router 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +89 -5
- package/build/cli/router-runner.js +3 -1
- package/build/tools/get-tool-schema.js +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
- [OAuth](#oauth)
|
|
30
30
|
- [Redirect URL](#redirect-url)
|
|
31
31
|
- [GitHub MCP (special case)](#github-mcp-special-case)
|
|
32
|
+
- [Figma MCP (special case)](#figma-mcp-special-case)
|
|
32
33
|
- [Custom Headers](#custom-headers)
|
|
33
34
|
- [Secrets and Variable Expansion](#secrets-and-variable-expansion)
|
|
34
35
|
- [Connecting Coding Agents](#connecting-coding-agents)
|
|
@@ -429,6 +430,89 @@ organizations you want the MCP to access.
|
|
|
429
430
|
> login will succeed, and its client secret is generated under *General*
|
|
430
431
|
> → *Generate a new client secret*.
|
|
431
432
|
|
|
433
|
+
#### Figma MCP (special case)
|
|
434
|
+
|
|
435
|
+
The official Figma MCP server at `https://mcp.figma.com/mcp` does **not**
|
|
436
|
+
support Dynamic Client Registration through the standard MCP flow.
|
|
437
|
+
Instead you register an OAuth client via Figma's REST API using a
|
|
438
|
+
Personal Access Token, then pass the resulting credentials through the
|
|
439
|
+
`oauth` block. Figma also requires the redirect URI to use a **fixed
|
|
440
|
+
port** — the port you register is reused on every `login`, so you must
|
|
441
|
+
pin it with `oauth.callbackPort`.
|
|
442
|
+
|
|
443
|
+
1. **Create a Figma Personal Access Token.**
|
|
444
|
+
Follow
|
|
445
|
+
<https://developers.figma.com/docs/rest-api/personal-access-tokens/>
|
|
446
|
+
to generate a PAT and export it as `FIGMA_PERSONAL_ACCESS_TOKEN`. It
|
|
447
|
+
is only used to register the MCP client in the next step.
|
|
448
|
+
|
|
449
|
+
2. **Register the MCP client via Figma's API.**
|
|
450
|
+
The redirect URI must use `127.0.0.1` on a fixed port — **the port
|
|
451
|
+
matters**, it is reused on every `login`. This example uses `19876`:
|
|
452
|
+
|
|
453
|
+
```bash
|
|
454
|
+
curl -X POST https://api.figma.com/v1/oauth/mcp/register \
|
|
455
|
+
-H "Content-Type: application/json" \
|
|
456
|
+
-H "X-Figma-Token: $FIGMA_PERSONAL_ACCESS_TOKEN" \
|
|
457
|
+
-d '{
|
|
458
|
+
"client_name": "Claude Code (figma)",
|
|
459
|
+
"redirect_uris": ["http://127.0.0.1:19876/mcp-compress-router/oauth-callback"],
|
|
460
|
+
"grant_types": ["authorization_code", "refresh_token"],
|
|
461
|
+
"response_types": ["code"],
|
|
462
|
+
"token_endpoint_auth_method": "none"
|
|
463
|
+
}'
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
Save the `client_id` and `client_secret` from the response (also note
|
|
467
|
+
the `scope` is `mcp:connect`):
|
|
468
|
+
|
|
469
|
+
```json
|
|
470
|
+
{
|
|
471
|
+
"client_id": "CLIENTID",
|
|
472
|
+
"client_secret": "CLIENTSECRET",
|
|
473
|
+
"client_name": "Claude Code (figma)",
|
|
474
|
+
"redirect_uris": ["http://127.0.0.1:19876/mcp-compress-router/oauth-callback"],
|
|
475
|
+
"token_endpoint_auth_method": "none",
|
|
476
|
+
"scope": "mcp:connect"
|
|
477
|
+
}
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
3. **Add the Figma MCP server by URL.**
|
|
481
|
+
|
|
482
|
+
```bash
|
|
483
|
+
npx mcp-compress-router add --transport http figma https://mcp.figma.com/mcp
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
4. **Set `oauth` credentials in `mcp.json`.**
|
|
487
|
+
Put the client ID and secret from step 2 in the server entry, using
|
|
488
|
+
the `mcp:connect` scope and the **same fixed port** you registered as
|
|
489
|
+
`callbackPort`:
|
|
490
|
+
|
|
491
|
+
```jsonc
|
|
492
|
+
"figma": {
|
|
493
|
+
"type": "http",
|
|
494
|
+
"url": "https://mcp.figma.com/mcp",
|
|
495
|
+
"oauth": {
|
|
496
|
+
"clientId": "${FIGMA_CLIENT_ID}",
|
|
497
|
+
"clientSecret": "${FIGMA_CLIENT_SECRET}",
|
|
498
|
+
"scope": "mcp:connect",
|
|
499
|
+
"callbackPort": 19876
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
Put the actual values in your `.env` file (see
|
|
505
|
+
[Secrets and Variable Expansion](#secrets-and-variable-expansion)).
|
|
506
|
+
|
|
507
|
+
5. **Run the login command.**
|
|
508
|
+
|
|
509
|
+
```bash
|
|
510
|
+
npx mcp-compress-router login figma
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
Your browser opens to authorize. After you approve, tokens are stored
|
|
514
|
+
in `credentials.json` and the router can call Figma MCP tools.
|
|
515
|
+
|
|
432
516
|
Other OAuth commands:
|
|
433
517
|
|
|
434
518
|
```bash
|
|
@@ -512,7 +596,7 @@ Add the router to your `opencode.json` under `mcp`:
|
|
|
512
596
|
{
|
|
513
597
|
"$schema": "https://opencode.ai/config.json",
|
|
514
598
|
"mcp": {
|
|
515
|
-
"compress-router": {
|
|
599
|
+
"mcp-compress-router": {
|
|
516
600
|
"type": "local",
|
|
517
601
|
"command": ["npx", "-y", "mcp-compress-router"],
|
|
518
602
|
"enabled": true
|
|
@@ -533,7 +617,7 @@ your user-level config (applies to every project):
|
|
|
533
617
|
```json
|
|
534
618
|
{
|
|
535
619
|
"mcpServers": {
|
|
536
|
-
"compress-router": {
|
|
620
|
+
"mcp-compress-router": {
|
|
537
621
|
"command": "npx",
|
|
538
622
|
"args": ["-y", "mcp-compress-router"]
|
|
539
623
|
}
|
|
@@ -543,14 +627,14 @@ your user-level config (applies to every project):
|
|
|
543
627
|
|
|
544
628
|
### Codex
|
|
545
629
|
|
|
546
|
-
Add a `[mcp_servers.compress-router]` table to your Codex config (note
|
|
630
|
+
Add a `[mcp_servers.mcp-compress-router]` table to your Codex config (note
|
|
547
631
|
the snake_case key). The config path is `~/.codex/config.toml` on
|
|
548
632
|
macOS/Linux, or `%USERPROFILE%\.codex\config.toml` on Windows; you can
|
|
549
633
|
also scope it to a single project via `.codex/config.toml` in trusted
|
|
550
634
|
projects.
|
|
551
635
|
|
|
552
636
|
```toml
|
|
553
|
-
[mcp_servers.compress-router]
|
|
637
|
+
[mcp_servers.mcp-compress-router]
|
|
554
638
|
command = "npx"
|
|
555
639
|
args = ["-y", "mcp-compress-router"]
|
|
556
640
|
enabled = true
|
|
@@ -568,7 +652,7 @@ merged, with project-level taking precedence.
|
|
|
568
652
|
```json
|
|
569
653
|
{
|
|
570
654
|
"servers": {
|
|
571
|
-
"compress-router": {
|
|
655
|
+
"mcp-compress-router": {
|
|
572
656
|
"command": "npx",
|
|
573
657
|
"args": ["-y", "mcp-compress-router"]
|
|
574
658
|
}
|
|
@@ -38,7 +38,9 @@ async function startRouterServer(catalog, clients, logger) {
|
|
|
38
38
|
const invokeFn = (server, tool, args) => invokeDownstreamTool(clients, server, tool, args, logger);
|
|
39
39
|
router.registerTool('invoke_tool', {
|
|
40
40
|
title: 'Invoke Tool',
|
|
41
|
-
description: 'Invoke a specific tool on a connected MCP server.
|
|
41
|
+
description: 'Invoke a specific tool on a connected MCP server. ' +
|
|
42
|
+
'You MUST first use get_tool_schema to retrieve the required parameters ' +
|
|
43
|
+
'for this tool before calling invoke_tool.',
|
|
42
44
|
inputSchema: InvokeToolInputSchema,
|
|
43
45
|
}, createInvokeToolHandler(catalog, invokeFn, logger));
|
|
44
46
|
const transport = new StdioServerTransport();
|
|
@@ -55,5 +55,7 @@ export function createGetToolSchemaHandler(catalog, logger) {
|
|
|
55
55
|
*/
|
|
56
56
|
export function buildGetToolSchemaDescription(catalog) {
|
|
57
57
|
const compact = renderCompactCatalog(catalog.servers);
|
|
58
|
-
return 'Get the JSON schema for one or more tools from a connected MCP server
|
|
58
|
+
return ('Get the JSON schema for one or more tools from a connected MCP server. ' +
|
|
59
|
+
'You MUST call this for a tool before you can invoke it with invoke_tool.\n\n' +
|
|
60
|
+
compact);
|
|
59
61
|
}
|