machine-bridge-mcp 0.4.2 → 0.6.0

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.
@@ -34,7 +34,7 @@
34
34
  {
35
35
  "name": "list_roots",
36
36
  "title": "List workspace roots",
37
- "description": "List filesystem roots exposed by the local runtime. Paths are workspace-relative unless absolute-path output is explicitly enabled.",
37
+ "description": "List filesystem roots exposed by the active local policy. The default full profile exposes local filesystem roots and returns absolute paths.",
38
38
  "availability": "always",
39
39
  "annotations": {
40
40
  "readOnlyHint": true,
@@ -100,7 +100,7 @@
100
100
  {
101
101
  "name": "read_file",
102
102
  "title": "Read text file",
103
- "description": "Read a UTF-8 file or an inclusive 1-based line range. Filesystem paths are workspace-scoped unless unrestricted paths are explicitly enabled.",
103
+ "description": "Read a UTF-8 regular file or an inclusive 1-based line range. The server does not block sensitive-looking filenames; access follows the active local policy and operating-system permissions.",
104
104
  "availability": "always",
105
105
  "annotations": {
106
106
  "readOnlyHint": true,
@@ -603,6 +603,504 @@
603
603
  "additionalProperties": false
604
604
  }
605
605
  },
606
+ {
607
+ "name": "diagnose_runtime",
608
+ "title": "Diagnose runtime layers",
609
+ "description": "Run fixed, non-user-controlled local probes to distinguish MCP policy, local filesystem, process-spawn, shell, managed-job storage, and registered-resource failures. A successful response proves the request reached the local daemon; it cannot diagnose a host refusal that blocks the tool call itself.",
610
+ "availability": "always",
611
+ "annotations": {
612
+ "readOnlyHint": true,
613
+ "destructiveHint": false,
614
+ "idempotentHint": true,
615
+ "openWorldHint": false
616
+ },
617
+ "inputSchema": {
618
+ "type": "object",
619
+ "additionalProperties": false
620
+ }
621
+ },
622
+ {
623
+ "name": "list_local_resources",
624
+ "title": "List local resource aliases",
625
+ "description": "List names and validation status for locally registered file resources without returning their paths or contents. Resources are registered only through the local machine-mcp CLI.",
626
+ "availability": "write",
627
+ "annotations": {
628
+ "readOnlyHint": true,
629
+ "destructiveHint": false,
630
+ "idempotentHint": true,
631
+ "openWorldHint": false
632
+ },
633
+ "inputSchema": {
634
+ "type": "object",
635
+ "additionalProperties": false
636
+ }
637
+ },
638
+ {
639
+ "name": "stage_job",
640
+ "title": "Stage managed job for local approval",
641
+ "description": "Validate and persist a managed-job plan without starting any process. Use this when execution tools are unavailable or local operator review is required; launch later with machine-mcp job approve JOB_ID.",
642
+ "availability": "write",
643
+ "annotations": {
644
+ "readOnlyHint": false,
645
+ "destructiveHint": false,
646
+ "idempotentHint": false,
647
+ "openWorldHint": false
648
+ },
649
+ "inputSchema": {
650
+ "type": "object",
651
+ "properties": {
652
+ "name": {
653
+ "type": "string",
654
+ "maxLength": 128
655
+ },
656
+ "steps": {
657
+ "type": "array",
658
+ "minItems": 1,
659
+ "maxItems": 16,
660
+ "items": {
661
+ "type": "object",
662
+ "properties": {
663
+ "name": {
664
+ "type": "string",
665
+ "maxLength": 128
666
+ },
667
+ "argv": {
668
+ "type": "array",
669
+ "minItems": 1,
670
+ "maxItems": 256,
671
+ "items": {
672
+ "type": "string",
673
+ "maxLength": 16384
674
+ }
675
+ },
676
+ "cwd": {
677
+ "type": "string",
678
+ "maxLength": 4096
679
+ },
680
+ "env": {
681
+ "type": "object",
682
+ "maxProperties": 64,
683
+ "additionalProperties": {
684
+ "type": "string",
685
+ "maxLength": 16384
686
+ }
687
+ },
688
+ "env_resources": {
689
+ "type": "object",
690
+ "maxProperties": 32,
691
+ "additionalProperties": {
692
+ "type": "string",
693
+ "pattern": "^[a-z][a-z0-9._-]{0,63}$"
694
+ }
695
+ },
696
+ "stdin": {
697
+ "type": "string",
698
+ "maxLength": 262144
699
+ },
700
+ "stdin_resource": {
701
+ "type": "string",
702
+ "pattern": "^[a-z][a-z0-9._-]{0,63}$"
703
+ },
704
+ "timeout_seconds": {
705
+ "type": "integer",
706
+ "minimum": 1,
707
+ "maximum": 3600,
708
+ "default": 600
709
+ },
710
+ "allow_failure": {
711
+ "type": "boolean",
712
+ "default": false
713
+ },
714
+ "capture_output": {
715
+ "type": "string",
716
+ "enum": [
717
+ "redacted",
718
+ "discard"
719
+ ],
720
+ "default": "redacted"
721
+ }
722
+ },
723
+ "required": [
724
+ "argv"
725
+ ],
726
+ "additionalProperties": false
727
+ }
728
+ },
729
+ "finally_steps": {
730
+ "type": "array",
731
+ "maxItems": 16,
732
+ "items": {
733
+ "type": "object",
734
+ "properties": {
735
+ "name": {
736
+ "type": "string",
737
+ "maxLength": 128
738
+ },
739
+ "argv": {
740
+ "type": "array",
741
+ "minItems": 1,
742
+ "maxItems": 256,
743
+ "items": {
744
+ "type": "string",
745
+ "maxLength": 16384
746
+ }
747
+ },
748
+ "cwd": {
749
+ "type": "string",
750
+ "maxLength": 4096
751
+ },
752
+ "env": {
753
+ "type": "object",
754
+ "maxProperties": 64,
755
+ "additionalProperties": {
756
+ "type": "string",
757
+ "maxLength": 16384
758
+ }
759
+ },
760
+ "env_resources": {
761
+ "type": "object",
762
+ "maxProperties": 32,
763
+ "additionalProperties": {
764
+ "type": "string",
765
+ "pattern": "^[a-z][a-z0-9._-]{0,63}$"
766
+ }
767
+ },
768
+ "stdin": {
769
+ "type": "string",
770
+ "maxLength": 262144
771
+ },
772
+ "stdin_resource": {
773
+ "type": "string",
774
+ "pattern": "^[a-z][a-z0-9._-]{0,63}$"
775
+ },
776
+ "timeout_seconds": {
777
+ "type": "integer",
778
+ "minimum": 1,
779
+ "maximum": 3600,
780
+ "default": 600
781
+ },
782
+ "allow_failure": {
783
+ "type": "boolean",
784
+ "default": false
785
+ },
786
+ "capture_output": {
787
+ "type": "string",
788
+ "enum": [
789
+ "redacted",
790
+ "discard"
791
+ ],
792
+ "default": "redacted"
793
+ }
794
+ },
795
+ "required": [
796
+ "argv"
797
+ ],
798
+ "additionalProperties": false
799
+ }
800
+ },
801
+ "temporary_files": {
802
+ "type": "array",
803
+ "maxItems": 16,
804
+ "items": {
805
+ "type": "object",
806
+ "properties": {
807
+ "name": {
808
+ "type": "string",
809
+ "pattern": "^[a-z][a-z0-9._-]{0,63}$"
810
+ },
811
+ "content": {
812
+ "type": "string",
813
+ "maxLength": 262144
814
+ },
815
+ "executable": {
816
+ "type": "boolean",
817
+ "default": false
818
+ }
819
+ },
820
+ "required": [
821
+ "name",
822
+ "content"
823
+ ],
824
+ "additionalProperties": false
825
+ }
826
+ }
827
+ },
828
+ "required": [
829
+ "steps"
830
+ ],
831
+ "additionalProperties": false
832
+ }
833
+ },
834
+ {
835
+ "name": "start_job",
836
+ "title": "Start managed job",
837
+ "description": "Durably accept a detached argv-based job with ordered steps, job-scoped temporary files, and guaranteed-attempt finally steps. The independent local runner continues if the MCP connection disappears. Use {{temp:name}}, {{resource:name}}, env_resources, or stdin_resource; registered resource contents never enter MCP arguments.",
838
+ "availability": "direct-exec",
839
+ "annotations": {
840
+ "readOnlyHint": false,
841
+ "destructiveHint": true,
842
+ "idempotentHint": false,
843
+ "openWorldHint": true
844
+ },
845
+ "inputSchema": {
846
+ "type": "object",
847
+ "properties": {
848
+ "name": {
849
+ "type": "string",
850
+ "maxLength": 128
851
+ },
852
+ "steps": {
853
+ "type": "array",
854
+ "minItems": 1,
855
+ "maxItems": 16,
856
+ "items": {
857
+ "type": "object",
858
+ "properties": {
859
+ "name": {
860
+ "type": "string",
861
+ "maxLength": 128
862
+ },
863
+ "argv": {
864
+ "type": "array",
865
+ "minItems": 1,
866
+ "maxItems": 256,
867
+ "items": {
868
+ "type": "string",
869
+ "maxLength": 16384
870
+ }
871
+ },
872
+ "cwd": {
873
+ "type": "string",
874
+ "maxLength": 4096
875
+ },
876
+ "env": {
877
+ "type": "object",
878
+ "maxProperties": 64,
879
+ "additionalProperties": {
880
+ "type": "string",
881
+ "maxLength": 16384
882
+ }
883
+ },
884
+ "env_resources": {
885
+ "type": "object",
886
+ "maxProperties": 32,
887
+ "additionalProperties": {
888
+ "type": "string",
889
+ "pattern": "^[a-z][a-z0-9._-]{0,63}$"
890
+ }
891
+ },
892
+ "stdin": {
893
+ "type": "string",
894
+ "maxLength": 262144
895
+ },
896
+ "stdin_resource": {
897
+ "type": "string",
898
+ "pattern": "^[a-z][a-z0-9._-]{0,63}$"
899
+ },
900
+ "timeout_seconds": {
901
+ "type": "integer",
902
+ "minimum": 1,
903
+ "maximum": 3600,
904
+ "default": 600
905
+ },
906
+ "allow_failure": {
907
+ "type": "boolean",
908
+ "default": false
909
+ },
910
+ "capture_output": {
911
+ "type": "string",
912
+ "enum": [
913
+ "redacted",
914
+ "discard"
915
+ ],
916
+ "default": "redacted"
917
+ }
918
+ },
919
+ "required": [
920
+ "argv"
921
+ ],
922
+ "additionalProperties": false
923
+ }
924
+ },
925
+ "finally_steps": {
926
+ "type": "array",
927
+ "maxItems": 16,
928
+ "items": {
929
+ "type": "object",
930
+ "properties": {
931
+ "name": {
932
+ "type": "string",
933
+ "maxLength": 128
934
+ },
935
+ "argv": {
936
+ "type": "array",
937
+ "minItems": 1,
938
+ "maxItems": 256,
939
+ "items": {
940
+ "type": "string",
941
+ "maxLength": 16384
942
+ }
943
+ },
944
+ "cwd": {
945
+ "type": "string",
946
+ "maxLength": 4096
947
+ },
948
+ "env": {
949
+ "type": "object",
950
+ "maxProperties": 64,
951
+ "additionalProperties": {
952
+ "type": "string",
953
+ "maxLength": 16384
954
+ }
955
+ },
956
+ "env_resources": {
957
+ "type": "object",
958
+ "maxProperties": 32,
959
+ "additionalProperties": {
960
+ "type": "string",
961
+ "pattern": "^[a-z][a-z0-9._-]{0,63}$"
962
+ }
963
+ },
964
+ "stdin": {
965
+ "type": "string",
966
+ "maxLength": 262144
967
+ },
968
+ "stdin_resource": {
969
+ "type": "string",
970
+ "pattern": "^[a-z][a-z0-9._-]{0,63}$"
971
+ },
972
+ "timeout_seconds": {
973
+ "type": "integer",
974
+ "minimum": 1,
975
+ "maximum": 3600,
976
+ "default": 600
977
+ },
978
+ "allow_failure": {
979
+ "type": "boolean",
980
+ "default": false
981
+ },
982
+ "capture_output": {
983
+ "type": "string",
984
+ "enum": [
985
+ "redacted",
986
+ "discard"
987
+ ],
988
+ "default": "redacted"
989
+ }
990
+ },
991
+ "required": [
992
+ "argv"
993
+ ],
994
+ "additionalProperties": false
995
+ }
996
+ },
997
+ "temporary_files": {
998
+ "type": "array",
999
+ "maxItems": 16,
1000
+ "items": {
1001
+ "type": "object",
1002
+ "properties": {
1003
+ "name": {
1004
+ "type": "string",
1005
+ "pattern": "^[a-z][a-z0-9._-]{0,63}$"
1006
+ },
1007
+ "content": {
1008
+ "type": "string",
1009
+ "maxLength": 262144
1010
+ },
1011
+ "executable": {
1012
+ "type": "boolean",
1013
+ "default": false
1014
+ }
1015
+ },
1016
+ "required": [
1017
+ "name",
1018
+ "content"
1019
+ ],
1020
+ "additionalProperties": false
1021
+ }
1022
+ }
1023
+ },
1024
+ "required": [
1025
+ "steps"
1026
+ ],
1027
+ "additionalProperties": false
1028
+ }
1029
+ },
1030
+ {
1031
+ "name": "list_jobs",
1032
+ "title": "List managed jobs",
1033
+ "description": "List recent detached managed jobs and their lifecycle status without returning step output.",
1034
+ "availability": "write",
1035
+ "annotations": {
1036
+ "readOnlyHint": true,
1037
+ "destructiveHint": false,
1038
+ "idempotentHint": true,
1039
+ "openWorldHint": false
1040
+ },
1041
+ "inputSchema": {
1042
+ "type": "object",
1043
+ "properties": {
1044
+ "limit": {
1045
+ "type": "integer",
1046
+ "minimum": 1,
1047
+ "maximum": 50,
1048
+ "default": 20
1049
+ }
1050
+ },
1051
+ "additionalProperties": false
1052
+ }
1053
+ },
1054
+ {
1055
+ "name": "read_job",
1056
+ "title": "Read managed job",
1057
+ "description": "Return one managed job status plus bounded, resource-redacted step results. Registered resource paths and contents are never returned.",
1058
+ "availability": "direct-exec",
1059
+ "annotations": {
1060
+ "readOnlyHint": true,
1061
+ "destructiveHint": false,
1062
+ "idempotentHint": true,
1063
+ "openWorldHint": false
1064
+ },
1065
+ "inputSchema": {
1066
+ "type": "object",
1067
+ "properties": {
1068
+ "job_id": {
1069
+ "type": "string",
1070
+ "pattern": "^job_[A-Za-z0-9_-]{24,}$"
1071
+ }
1072
+ },
1073
+ "required": [
1074
+ "job_id"
1075
+ ],
1076
+ "additionalProperties": false
1077
+ }
1078
+ },
1079
+ {
1080
+ "name": "cancel_job",
1081
+ "title": "Cancel managed job",
1082
+ "description": "Request cancellation of a detached managed job. The runner terminates the active process tree and still attempts declared finally steps and local resource cleanup.",
1083
+ "availability": "write",
1084
+ "annotations": {
1085
+ "readOnlyHint": false,
1086
+ "destructiveHint": true,
1087
+ "idempotentHint": true,
1088
+ "openWorldHint": true
1089
+ },
1090
+ "inputSchema": {
1091
+ "type": "object",
1092
+ "properties": {
1093
+ "job_id": {
1094
+ "type": "string",
1095
+ "pattern": "^job_[A-Za-z0-9_-]{24,}$"
1096
+ }
1097
+ },
1098
+ "required": [
1099
+ "job_id"
1100
+ ],
1101
+ "additionalProperties": false
1102
+ }
1103
+ },
606
1104
  {
607
1105
  "name": "exec_command",
608
1106
  "title": "Execute shell command",
@@ -1,10 +1,11 @@
1
1
  import { DurableObject } from "cloudflare:workers";
2
2
  import toolCatalog from "../shared/tool-catalog.json";
3
+ import serverMetadata from "../shared/server-metadata.json";
3
4
 
4
- const SERVER_NAME = "machine-bridge-mcp";
5
- const SERVER_VERSION = "0.4.2";
6
- const MCP_PROTOCOL_VERSION = "2025-11-25";
7
- const MCP_SUPPORTED_PROTOCOL_VERSIONS = ["2025-11-25", "2025-06-18", "2025-03-26"] as const;
5
+ const SERVER_NAME = String(serverMetadata.name);
6
+ const SERVER_VERSION = "0.6.0";
7
+ const MCP_PROTOCOL_VERSION = String(serverMetadata.protocolVersion);
8
+ const MCP_SUPPORTED_PROTOCOL_VERSIONS = serverMetadata.supportedProtocolVersions.map((value) => String(value));
8
9
  const JSONRPC_VERSION = "2.0";
9
10
  const DEFAULT_MAX_BODY_BYTES = 8 * 1024 * 1024;
10
11
  const MAX_BODY_BYTES = 16 * 1024 * 1024;
@@ -121,13 +122,8 @@ const allCatalogTools = toolCatalog as ToolDefinition[];
121
122
  const serverInfoTool = publicTool(allCatalogTools.find((tool) => tool.name === "server_info")!);
122
123
  const workspaceTools = allCatalogTools.filter((tool) => tool.name !== "server_info").map(publicTool);
123
124
 
124
- const MCP_INSTRUCTIONS = [
125
- "You are connected to a local workspace through machine-bridge-mcp.",
126
- "The Cloudflare Worker authenticates and relays calls; file and command operations execute on the user's local runtime.",
127
- "Relative paths use the configured workspace. Direct filesystem tools are workspace-scoped unless unrestricted paths are explicitly enabled.",
128
- "run_process avoids shell parsing but is not an OS sandbox. exec_command is only exposed in shell mode and has the local user's authority.",
129
- "Prefer read_file line ranges, edit_file, or apply_patch over whole-file replacement, and report commands that were run.",
130
- ].join("\n");
125
+ const MCP_INSTRUCTIONS = serverMetadata.instructions.map((value) => String(value)).join("\n");
126
+
131
127
 
132
128
  function publicTool(tool: ToolDefinition): ToolDefinition {
133
129
  const { availability: _availability, ...definition } = tool;
@@ -1001,8 +997,14 @@ function daemonPolicyAllows(availability: unknown, policy: Record<string, unknow
1001
997
  function sanitizeDaemonPolicy(value: unknown): Record<string, unknown> {
1002
998
  const policy = asObject(value);
1003
999
  const execMode = policy.execMode === "shell" || policy.execMode === "direct" ? policy.execMode : "off";
1000
+ const origin = sanitizeMetadataText(policy.origin, 32);
1001
+ const revision = Number.isInteger(policy.revision) && Number(policy.revision) > 0
1002
+ ? Math.min(Number(policy.revision), 1_000_000)
1003
+ : 1;
1004
1004
  return {
1005
1005
  profile: sanitizeMetadataText(policy.profile, 32) ?? "custom",
1006
+ origin: ["default", "explicit", "custom", "migrated", "legacy-preserved"].includes(origin ?? "") ? origin : "custom",
1007
+ revision,
1006
1008
  allowWrite: policy.allowWrite === true,
1007
1009
  allowExec: execMode !== "off",
1008
1010
  execMode,