Commit 5a21aff
Olivier Gintrand
feat(gateway): add tools_include and tools_exclude filters
Add fnmatch glob-based tool filtering to gateways. When a gateway is
refreshed, registered, updated or activated, the discovered tools are
filtered against optional include/exclude patterns:
- tools_include: whitelist – only tools matching at least one pattern
are kept
- tools_exclude: blacklist – tools matching any pattern are removed
- When both are set, include is applied first, then exclude
This enables splitting a single MCP backend into multiple gateways with
different tool subsets (e.g. one gateway for ticket tools, another for
project tools) without requiring upstream server changes.
Changes:
- db.py: tools_include/tools_exclude JSON columns on Gateway model
- schemas.py: fields on GatewayCreate, GatewayUpdate, GatewayRead
- gateway_service.py: _apply_tool_filters() helper + 4 call sites
- export_service.py / import_service.py: export/import support
- admin.py: form parsing for create and edit flows
- admin_ui JS: comma-separated input → JSON array conversion
- templates/admin.html: input fields in create and edit forms
- Alembic migration for the new columns
Signed-off-by: Olivier Gintrand <olivier.gintrand@forterro.com>1 parent a2aa82a commit 5a21aff
File tree
10 files changed
+325
-0
lines changed- mcpgateway
- admin_ui
- alembic/versions
- services
- templates
10 files changed
+325
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12153 | 12153 | | |
12154 | 12154 | | |
12155 | 12155 | | |
| 12156 | + | |
| 12157 | + | |
| 12158 | + | |
| 12159 | + | |
| 12160 | + | |
| 12161 | + | |
| 12162 | + | |
| 12163 | + | |
| 12164 | + | |
| 12165 | + | |
| 12166 | + | |
| 12167 | + | |
| 12168 | + | |
| 12169 | + | |
| 12170 | + | |
| 12171 | + | |
| 12172 | + | |
| 12173 | + | |
12156 | 12174 | | |
12157 | 12175 | | |
12158 | 12176 | | |
| |||
12203 | 12221 | | |
12204 | 12222 | | |
12205 | 12223 | | |
| 12224 | + | |
| 12225 | + | |
12206 | 12226 | | |
12207 | 12227 | | |
12208 | 12228 | | |
| |||
12349 | 12369 | | |
12350 | 12370 | | |
12351 | 12371 | | |
| 12372 | + | |
| 12373 | + | |
| 12374 | + | |
| 12375 | + | |
| 12376 | + | |
| 12377 | + | |
| 12378 | + | |
| 12379 | + | |
| 12380 | + | |
| 12381 | + | |
| 12382 | + | |
| 12383 | + | |
| 12384 | + | |
| 12385 | + | |
| 12386 | + | |
| 12387 | + | |
| 12388 | + | |
| 12389 | + | |
12352 | 12390 | | |
12353 | 12391 | | |
12354 | 12392 | | |
| |||
12454 | 12492 | | |
12455 | 12493 | | |
12456 | 12494 | | |
| 12495 | + | |
| 12496 | + | |
12457 | 12497 | | |
12458 | 12498 | | |
12459 | 12499 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
790 | 790 | | |
791 | 791 | | |
792 | 792 | | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
793 | 815 | | |
794 | 816 | | |
795 | 817 | | |
| |||
884 | 906 | | |
885 | 907 | | |
886 | 908 | | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
887 | 931 | | |
888 | 932 | | |
889 | 933 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
576 | 576 | | |
577 | 577 | | |
578 | 578 | | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
579 | 599 | | |
580 | 600 | | |
581 | 601 | | |
| |||
Lines changed: 48 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4668 | 4668 | | |
4669 | 4669 | | |
4670 | 4670 | | |
| 4671 | + | |
| 4672 | + | |
| 4673 | + | |
| 4674 | + | |
| 4675 | + | |
| 4676 | + | |
| 4677 | + | |
4671 | 4678 | | |
4672 | 4679 | | |
4673 | 4680 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2815 | 2815 | | |
2816 | 2816 | | |
2817 | 2817 | | |
| 2818 | + | |
| 2819 | + | |
| 2820 | + | |
| 2821 | + | |
2818 | 2822 | | |
2819 | 2823 | | |
2820 | 2824 | | |
| |||
3151 | 3155 | | |
3152 | 3156 | | |
3153 | 3157 | | |
| 3158 | + | |
| 3159 | + | |
| 3160 | + | |
| 3161 | + | |
3154 | 3162 | | |
3155 | 3163 | | |
3156 | 3164 | | |
| |||
3520 | 3528 | | |
3521 | 3529 | | |
3522 | 3530 | | |
| 3531 | + | |
| 3532 | + | |
| 3533 | + | |
| 3534 | + | |
3523 | 3535 | | |
3524 | 3536 | | |
3525 | 3537 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
512 | 512 | | |
513 | 513 | | |
514 | 514 | | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
515 | 521 | | |
516 | 522 | | |
517 | 523 | | |
| |||
938 | 944 | | |
939 | 945 | | |
940 | 946 | | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
941 | 953 | | |
942 | 954 | | |
943 | 955 | | |
| |||
0 commit comments