Commit 7875f55
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 860ef3f commit 7875f55
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 | |
|---|---|---|---|
| |||
12008 | 12008 | | |
12009 | 12009 | | |
12010 | 12010 | | |
| 12011 | + | |
| 12012 | + | |
| 12013 | + | |
| 12014 | + | |
| 12015 | + | |
| 12016 | + | |
| 12017 | + | |
| 12018 | + | |
| 12019 | + | |
| 12020 | + | |
| 12021 | + | |
| 12022 | + | |
| 12023 | + | |
| 12024 | + | |
| 12025 | + | |
| 12026 | + | |
| 12027 | + | |
| 12028 | + | |
12011 | 12029 | | |
12012 | 12030 | | |
12013 | 12031 | | |
| |||
12058 | 12076 | | |
12059 | 12077 | | |
12060 | 12078 | | |
| 12079 | + | |
| 12080 | + | |
12061 | 12081 | | |
12062 | 12082 | | |
12063 | 12083 | | |
| |||
12204 | 12224 | | |
12205 | 12225 | | |
12206 | 12226 | | |
| 12227 | + | |
| 12228 | + | |
| 12229 | + | |
| 12230 | + | |
| 12231 | + | |
| 12232 | + | |
| 12233 | + | |
| 12234 | + | |
| 12235 | + | |
| 12236 | + | |
| 12237 | + | |
| 12238 | + | |
| 12239 | + | |
| 12240 | + | |
| 12241 | + | |
| 12242 | + | |
| 12243 | + | |
| 12244 | + | |
12207 | 12245 | | |
12208 | 12246 | | |
12209 | 12247 | | |
| |||
12309 | 12347 | | |
12310 | 12348 | | |
12311 | 12349 | | |
| 12350 | + | |
| 12351 | + | |
12312 | 12352 | | |
12313 | 12353 | | |
12314 | 12354 | | |
| |||
| 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 | |
|---|---|---|---|
| |||
4667 | 4667 | | |
4668 | 4668 | | |
4669 | 4669 | | |
| 4670 | + | |
| 4671 | + | |
| 4672 | + | |
| 4673 | + | |
| 4674 | + | |
| 4675 | + | |
| 4676 | + | |
4670 | 4677 | | |
4671 | 4678 | | |
4672 | 4679 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2706 | 2706 | | |
2707 | 2707 | | |
2708 | 2708 | | |
| 2709 | + | |
| 2710 | + | |
| 2711 | + | |
| 2712 | + | |
2709 | 2713 | | |
2710 | 2714 | | |
2711 | 2715 | | |
| |||
3042 | 3046 | | |
3043 | 3047 | | |
3044 | 3048 | | |
| 3049 | + | |
| 3050 | + | |
| 3051 | + | |
| 3052 | + | |
3045 | 3053 | | |
3046 | 3054 | | |
3047 | 3055 | | |
| |||
3411 | 3419 | | |
3412 | 3420 | | |
3413 | 3421 | | |
| 3422 | + | |
| 3423 | + | |
| 3424 | + | |
| 3425 | + | |
3414 | 3426 | | |
3415 | 3427 | | |
3416 | 3428 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
511 | 511 | | |
512 | 512 | | |
513 | 513 | | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
514 | 520 | | |
515 | 521 | | |
516 | 522 | | |
| |||
937 | 943 | | |
938 | 944 | | |
939 | 945 | | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
940 | 952 | | |
941 | 953 | | |
942 | 954 | | |
| |||
0 commit comments