xytara 3.1.0 → 3.1.2
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/.env.example +67 -58
- package/ADAPTER_START_HERE.md +56 -56
- package/CARRIED_HANDOFF_DEMO.md +60 -60
- package/EXAMPLE_PATHS.md +53 -53
- package/FINAL_CONTRACT.md +498 -498
- package/LICENSE +201 -201
- package/NOTICE +3 -3
- package/PARTNER_READY_PATH.md +71 -71
- package/PUBLIC_DEMO_SCRIPT.md +78 -78
- package/README.md +6 -1
- package/REAL_PAYMENT_SETUP.md +32 -3
- package/RELEASE_NOTES.md +14 -14
- package/SERVICE_CONTRACT.md +419 -419
- package/START_HERE.md +1 -1
- package/SUPABASE_RUNTIME_STATE_SETUP.md +61 -61
- package/TERMINOLOGY.md +50 -50
- package/WHY_XYTARA_XOONYA.md +63 -63
- package/XT1_EXECUTION_TRUTH_STANDARD.md +78 -78
- package/XYTARA_ADAPTER_PROTOCOL_TRUTH_MODEL.md +75 -75
- package/XYTARA_AUTONOMOUS_ENTRY_MODEL.md +124 -124
- package/XYTARA_DEFAULT_PATH_MODEL.md +84 -84
- package/XYTARA_EXECUTION_TRUTH_MODEL.md +171 -171
- package/XYTARA_PAYMENT_RAIL_TRUTH_MODEL.md +68 -68
- package/adapters/AUTHORING_GUIDE.md +243 -243
- package/adapters/ONBOARDING_POSTURE.md +61 -61
- package/adapters/THIRD_PARTY_SUBMISSION_PROCESS.md +84 -84
- package/adapters/adapter-manifest.schema.json +283 -283
- package/adapters/examples/example-execution-adapter.js +61 -61
- package/adapters/examples/example-execution-adapter.manifest.json +81 -81
- package/adapters/examples/example-settlement-adapter.js +55 -55
- package/adapters/examples/example-settlement-adapter.manifest.json +78 -78
- package/adapters/examples/example-third-party-acp-registration.submission-bundle.json +124 -124
- package/adapters/examples/example-third-party-erc8004-registration.submission-bundle.json +121 -121
- package/adapters/examples/example-third-party-identity-registration.certification-pack.json +22 -22
- package/adapters/examples/example-third-party-identity-registration.record.json +26 -26
- package/adapters/examples/example-third-party-identity-registration.submission-bundle.json +126 -126
- package/adapters/examples/example-third-party-langchain-registration.submission-bundle.json +124 -124
- package/adapters/examples/example-third-party-mpp-registration.submission-bundle.json +120 -120
- package/adapters/examples/example-third-party-registration.certification-pack.json +22 -22
- package/adapters/examples/example-third-party-registration.record.json +28 -28
- package/adapters/examples/example-third-party-registration.submission-bundle.json +126 -126
- package/adapters/examples/example-third-party-settlement-registration.certification-pack.json +22 -22
- package/adapters/examples/example-third-party-settlement-registration.record.json +26 -26
- package/adapters/examples/example-third-party-settlement-registration.submission-bundle.json +127 -127
- package/adapters/examples/langchain-reference-execution-adapter.js +81 -81
- package/adapters/examples/langchain-reference-execution-adapter.manifest.json +79 -79
- package/adapters/examples/langgraph-reference-execution-adapter.js +81 -81
- package/adapters/examples/langgraph-reference-execution-adapter.manifest.json +79 -79
- package/adapters/examples/minimal-third-party-execution-adapter.js +61 -61
- package/adapters/examples/minimal-third-party-execution-adapter.manifest.json +79 -79
- package/adapters/examples/minimal-third-party-execution-registration.record.json +26 -26
- package/adapters/examples/minimal-third-party-execution.certification-pack.json +22 -22
- package/adapters/examples/minimal-third-party-execution.submission-bundle.json +126 -126
- package/adapters/integration-certification-pack.schema.json +82 -82
- package/adapters/integration-registration-record.schema.json +114 -114
- package/adapters/integration-submission-bundle-set.schema.json +39 -39
- package/adapters/integration-submission-bundle.schema.json +34 -34
- package/adapters/interfaces.js +56 -56
- package/bin/xytara-first-run.js +244 -244
- package/bin/xytara-release.js +1429 -1429
- package/bin/xytara-run.js +186 -186
- package/bin/xytara.js +80 -80
- package/client.js +3 -3
- package/examples/_demo_env.js +40 -0
- package/examples/adapter_review_walkthrough.js +54 -53
- package/examples/export_carried_handoff.js +81 -80
- package/examples/funded_runtime_walkthrough.js +71 -70
- package/examples/generated.carried-handoff.json +30 -0
- package/examples/partner_launch_walkthrough.js +44 -43
- package/examples/quickstart.js +3256 -3255
- package/fixtures/catalog.js +1134 -1134
- package/index.js +395 -395
- package/integrations/dispatch.js +276 -276
- package/integrations/registry-snapshot.schema.json +36 -36
- package/integrations/registry.js +2261 -2261
- package/integrations/views.js +28 -28
- package/lib/a2a_lane_contract.js +104 -104
- package/lib/a2c_lane_contract.js +111 -111
- package/lib/account_auth.js +518 -518
- package/lib/acp_lane_contract.js +54 -54
- package/lib/activity_audit_contract.js +322 -322
- package/lib/adapter_certification_contract.js +130 -130
- package/lib/adapter_depth_contract.js +156 -156
- package/lib/adapter_pack.js +118 -118
- package/lib/adapter_partner_pack.js +89 -89
- package/lib/adapter_promotion_pack.js +89 -89
- package/lib/adapter_protocol_truth_contract.js +229 -229
- package/lib/announcement_pack.js +61 -61
- package/lib/artifact_distribution_lane_contract.js +54 -54
- package/lib/asyncapi_contract.js +150 -150
- package/lib/auth_interop_contract.js +80 -80
- package/lib/authority_binding_lifecycle_contract.js +182 -182
- package/lib/autonomous_entry_contract.js +409 -409
- package/lib/bolt_lane_contract.js +55 -55
- package/lib/bolt_payment_front.js +172 -172
- package/lib/business_cockpit.js +378 -378
- package/lib/capability_execution_truth.js +272 -272
- package/lib/capability_registry.js +633 -633
- package/lib/catalog_contract.js +966 -966
- package/lib/catalog_family_model.js +193 -193
- package/lib/catalog_views.js +55 -55
- package/lib/checkout_event_security.js +142 -142
- package/lib/cloudevents_contract.js +80 -80
- package/lib/command_flow.js +411 -406
- package/lib/commerce_artifacts.js +503 -503
- package/lib/commerce_authority.js +449 -449
- package/lib/commerce_cases.js +317 -317
- package/lib/commerce_checkout.js +509 -509
- package/lib/commerce_client.js +7687 -7676
- package/lib/commerce_coordination.js +346 -346
- package/lib/commerce_economics.js +4017 -4016
- package/lib/commerce_identity.js +578 -578
- package/lib/commerce_quotes.js +237 -237
- package/lib/commerce_reports.js +14461 -14461
- package/lib/commerce_runtime.js +315 -315
- package/lib/commerce_shell.js +257 -257
- package/lib/crypto_agility_matrix.js +125 -125
- package/lib/default_path_contract.js +412 -412
- package/lib/delivery_summary_contract.js +95 -95
- package/lib/ecosystem_entry.js +64 -64
- package/lib/erc8004_lane_contract.js +65 -65
- package/lib/event_system_lane_contract.js +75 -75
- package/lib/execution_truth_contract.js +234 -234
- package/lib/external_credit_bridge.js +142 -142
- package/lib/external_execution_runtime.js +132 -132
- package/lib/feature_control_lane_contract.js +54 -54
- package/lib/first_run_conversion_contract.js +290 -290
- package/lib/framework_lane_contract.js +89 -89
- package/lib/framework_provider_promotion.js +235 -235
- package/lib/full_catalog_contract.js +525 -525
- package/lib/go_live_operator_pack.js +391 -391
- package/lib/http_transport.js +73 -73
- package/lib/identity_auth.js +175 -175
- package/lib/identity_interop_contract.js +82 -82
- package/lib/integration_matrix_contract.js +102 -102
- package/lib/l402_lane_contract.js +55 -55
- package/lib/l402_payment_front.js +192 -192
- package/lib/launch_narrative.js +53 -53
- package/lib/lifecycle_continuity_contract.js +115 -115
- package/lib/machine_identity_registry_contract.js +199 -199
- package/lib/major_rails_lane_contract.js +150 -150
- package/lib/market_lane_contract.js +467 -467
- package/lib/market_lane_depth_contract.js +182 -182
- package/lib/market_lane_promotion_contract.js +210 -210
- package/lib/market_lane_trace_contract.js +278 -278
- package/lib/mcp_lane_contract.js +137 -137
- package/lib/network_transport.js +110 -110
- package/lib/offline_verifiability_recovery_contract.js +155 -155
- package/lib/openapi_contract.js +296 -296
- package/lib/operational_receipt_contract.js +165 -165
- package/lib/operator_intelligence.js +407 -407
- package/lib/outreach_copy_pack.js +51 -51
- package/lib/outreach_message_pack.js +71 -71
- package/lib/outreach_proof.js +71 -71
- package/lib/outreach_target_pack.js +60 -60
- package/lib/partner_intelligence.js +105 -105
- package/lib/payment_config.js +239 -191
- package/lib/payment_front_registry.js +53 -53
- package/lib/payment_protocol_contract.js +165 -165
- package/lib/payment_rail_truth_contract.js +324 -324
- package/lib/payment_verification.js +312 -264
- package/lib/phase_10_closeout_pack.js +45 -45
- package/lib/phase_10_completion_pack.js +76 -76
- package/lib/phase_10_decision_record_pack.js +54 -54
- package/lib/phase_10_decision_resolution_pack.js +53 -53
- package/lib/phase_10_demand_signal_adapters_runtime_pack.js +74 -74
- package/lib/phase_10_ecosystem_backlog_triage_runtime_pack.js +74 -74
- package/lib/phase_10_freeze_baseline_pack.js +67 -67
- package/lib/phase_10_freeze_review_pack.js +64 -64
- package/lib/phase_10_gate_pack.js +57 -57
- package/lib/phase_10_long_tail_continuity_pack.js +80 -80
- package/lib/phase_10_long_tail_ecosystem_pack.js +66 -66
- package/lib/phase_10_niche_extension_registry_runtime_pack.js +74 -74
- package/lib/phase_1_claude_mcp_pack.js +60 -60
- package/lib/phase_1_claude_mcp_runtime_pack.js +52 -52
- package/lib/phase_1_ecosystem_pack.js +67 -67
- package/lib/phase_1_openai_codex_pack.js +60 -60
- package/lib/phase_1_openai_codex_runtime_pack.js +52 -52
- package/lib/phase_2_base_runtime_pack.js +71 -71
- package/lib/phase_2_base_usdc_runtime_pack.js +72 -72
- package/lib/phase_2_closeout_pack.js +65 -65
- package/lib/phase_2_completion_pack.js +113 -113
- package/lib/phase_2_decision_record_pack.js +66 -66
- package/lib/phase_2_decision_resolution_pack.js +69 -69
- package/lib/phase_2_eth_runtime_pack.js +70 -70
- package/lib/phase_2_evm_base_runtime_pack.js +73 -73
- package/lib/phase_2_evm_runtime_pack.js +71 -71
- package/lib/phase_2_flip_preview_pack.js +60 -60
- package/lib/phase_2_freeze_review_pack.js +99 -99
- package/lib/phase_2_gate_pack.js +77 -77
- package/lib/phase_2_payment_rails_pack.js +71 -71
- package/lib/phase_2_usdc_runtime_pack.js +71 -71
- package/lib/phase_3_brc_runtime_pack.js +81 -81
- package/lib/phase_3_bsv_teranode_runtime_pack.js +83 -83
- package/lib/phase_3_closeout_pack.js +62 -62
- package/lib/phase_3_completion_pack.js +94 -94
- package/lib/phase_3_decision_record_pack.js +64 -64
- package/lib/phase_3_decision_resolution_pack.js +69 -69
- package/lib/phase_3_freeze_baseline_pack.js +67 -67
- package/lib/phase_3_freeze_review_pack.js +80 -80
- package/lib/phase_3_gate_pack.js +76 -76
- package/lib/phase_3_metanet_runtime_pack.js +81 -81
- package/lib/phase_3_native_bsv_pack.js +91 -91
- package/lib/phase_3_native_continuity_pack.js +82 -82
- package/lib/phase_4_attestation_runtime_pack.js +75 -75
- package/lib/phase_4_closeout_pack.js +45 -45
- package/lib/phase_4_completion_pack.js +94 -94
- package/lib/phase_4_decision_record_pack.js +54 -54
- package/lib/phase_4_decision_resolution_pack.js +45 -45
- package/lib/phase_4_erc8004_runtime_pack.js +76 -76
- package/lib/phase_4_freeze_baseline_pack.js +67 -67
- package/lib/phase_4_freeze_review_pack.js +68 -68
- package/lib/phase_4_gate_pack.js +58 -58
- package/lib/phase_4_identity_registry_runtime_pack.js +75 -75
- package/lib/phase_4_identity_trust_pack.js +73 -73
- package/lib/phase_4_trust_continuity_pack.js +86 -86
- package/lib/phase_5_antelope_runtime_pack.js +76 -76
- package/lib/phase_5_closeout_pack.js +44 -44
- package/lib/phase_5_completion_pack.js +82 -82
- package/lib/phase_5_constellation_dag_runtime_pack.js +76 -76
- package/lib/phase_5_decision_record_pack.js +54 -54
- package/lib/phase_5_decision_resolution_pack.js +45 -45
- package/lib/phase_5_digibyte_dgb_runtime_pack.js +76 -76
- package/lib/phase_5_freeze_baseline_pack.js +67 -67
- package/lib/phase_5_freeze_review_pack.js +68 -68
- package/lib/phase_5_gate_pack.js +58 -58
- package/lib/phase_5_hedera_hbar_runtime_pack.js +76 -76
- package/lib/phase_5_kaspa_kas_runtime_pack.js +76 -76
- package/lib/phase_5_major_rails_continuity_pack.js +86 -86
- package/lib/phase_5_major_rails_pack.js +110 -110
- package/lib/phase_5_metal_runtime_pack.js +76 -76
- package/lib/phase_5_polkadot_dot_runtime_pack.js +76 -76
- package/lib/phase_5_proton_xpr_runtime_pack.js +76 -76
- package/lib/phase_5_solana_runtime_pack.js +76 -76
- package/lib/phase_6_autogen_runtime_pack.js +72 -72
- package/lib/phase_6_closeout_pack.js +46 -46
- package/lib/phase_6_completion_pack.js +77 -77
- package/lib/phase_6_decision_record_pack.js +54 -54
- package/lib/phase_6_decision_resolution_pack.js +53 -53
- package/lib/phase_6_framework_continuity_pack.js +81 -81
- package/lib/phase_6_framework_runtime_pack.js +68 -68
- package/lib/phase_6_freeze_baseline_pack.js +68 -68
- package/lib/phase_6_freeze_review_pack.js +65 -65
- package/lib/phase_6_gate_pack.js +59 -59
- package/lib/phase_6_langchain_runtime_pack.js +72 -72
- package/lib/phase_6_langgraph_runtime_pack.js +72 -72
- package/lib/phase_6_semantic_kernel_runtime_pack.js +72 -72
- package/lib/phase_7_closeout_pack.js +45 -45
- package/lib/phase_7_completion_pack.js +85 -85
- package/lib/phase_7_decision_record_pack.js +53 -53
- package/lib/phase_7_decision_resolution_pack.js +53 -53
- package/lib/phase_7_event_system_continuity_pack.js +89 -89
- package/lib/phase_7_event_system_pack.js +76 -76
- package/lib/phase_7_freeze_baseline_pack.js +74 -74
- package/lib/phase_7_freeze_review_pack.js +65 -65
- package/lib/phase_7_gate_pack.js +58 -58
- package/lib/phase_7_kafka_runtime_pack.js +74 -74
- package/lib/phase_7_mqtt_runtime_pack.js +74 -74
- package/lib/phase_7_nats_runtime_pack.js +74 -74
- package/lib/phase_7_webhook_event_bus_runtime_pack.js +74 -74
- package/lib/phase_8_closeout_pack.js +46 -46
- package/lib/phase_8_completion_pack.js +82 -82
- package/lib/phase_8_decision_record_pack.js +54 -54
- package/lib/phase_8_decision_resolution_pack.js +53 -53
- package/lib/phase_8_external_receipt_import_runtime_pack.js +74 -74
- package/lib/phase_8_external_result_import_runtime_pack.js +74 -74
- package/lib/phase_8_freeze_baseline_pack.js +71 -71
- package/lib/phase_8_freeze_review_pack.js +64 -64
- package/lib/phase_8_gate_pack.js +58 -58
- package/lib/phase_8_proof_bridge_continuity_pack.js +86 -86
- package/lib/phase_8_proof_bridges_pack.js +72 -72
- package/lib/phase_8_proof_bundle_normalization_runtime_pack.js +74 -74
- package/lib/phase_9_closeout_pack.js +46 -46
- package/lib/phase_9_completion_pack.js +82 -82
- package/lib/phase_9_custody_refs_runtime_pack.js +74 -74
- package/lib/phase_9_decision_record_pack.js +54 -54
- package/lib/phase_9_decision_resolution_pack.js +53 -53
- package/lib/phase_9_freeze_baseline_pack.js +71 -71
- package/lib/phase_9_freeze_review_pack.js +64 -64
- package/lib/phase_9_gate_pack.js +58 -58
- package/lib/phase_9_operator_accounting_bridges_runtime_pack.js +74 -74
- package/lib/phase_9_treasury_connectivity_pack.js +72 -72
- package/lib/phase_9_treasury_continuity_pack.js +86 -86
- package/lib/phase_9_treasury_destinations_runtime_pack.js +74 -74
- package/lib/phase_program_pack.js +120 -120
- package/lib/pricing_optimization_contract.js +775 -775
- package/lib/protocol_lane_contract.js +117 -117
- package/lib/provenance_lane_contract.js +54 -54
- package/lib/provider_lane_contract.js +240 -240
- package/lib/provider_runtime_journey_contract.js +183 -183
- package/lib/public_surface_policy_contract.js +111 -111
- package/lib/publish_plan.js +51 -51
- package/lib/record_queries.js +48 -48
- package/lib/release_candidate.js +50 -50
- package/lib/release_center.js +1093 -1093
- package/lib/release_history.js +205 -205
- package/lib/release_manifest.js +113 -113
- package/lib/release_pack.js +453 -453
- package/lib/request_rate_limit.js +144 -144
- package/lib/resource_views.js +31 -31
- package/lib/revenue_launch_path_contract.js +326 -326
- package/lib/route_matchers.js +34 -34
- package/lib/route_params.js +19 -19
- package/lib/runtime_bridge.js +124 -124
- package/lib/runtime_operations_worker.js +282 -282
- package/lib/runtime_state_store.js +354 -354
- package/lib/settlement_lane_contract.js +111 -111
- package/lib/shared_signals_lane_contract.js +54 -54
- package/lib/signed_audit_provenance_contract.js +83 -83
- package/lib/soft_launch_pack.js +78 -78
- package/lib/stablecoin_lane_contract.js +76 -76
- package/lib/stripe_mpp_lane_contract.js +96 -96
- package/lib/stripe_mpp_payment_front.js +158 -158
- package/lib/telemetry_lane_contract.js +54 -54
- package/lib/treasury_destinations_contract.js +764 -764
- package/lib/treasury_egress_policy_contract.js +91 -91
- package/lib/treasury_lane_contract.js +84 -84
- package/lib/trust_portability_boundary_contract.js +72 -72
- package/lib/x402_facilitator.js +155 -0
- package/lib/x402_lane_contract.js +118 -118
- package/package.json +106 -105
- package/scripts/registry_cli.js +275 -275
- package/scripts/verify_adapters.js +554 -554
- package/scripts/verify_all.js +4962 -4962
- package/scripts/verify_control_plane_contracts.js +34 -34
- package/scripts/verify_control_plane_routes.js +70 -70
- package/scripts/verify_delivery_summary.js +112 -112
- package/scripts/verify_examples.js +19 -19
- package/scripts/verify_first_run_conversions.js +81 -81
- package/scripts/verify_framework_provider_promotion.js +152 -152
- package/scripts/verify_full_catalog.js +174 -174
- package/scripts/verify_integrations.js +620 -620
- package/scripts/verify_lifecycle_continuity.js +96 -96
- package/scripts/verify_market_lane_depth.js +94 -94
- package/scripts/verify_market_lane_promotion.js +103 -103
- package/scripts/verify_market_lane_traces.js +98 -98
- package/scripts/verify_market_lanes.js +102 -102
- package/scripts/verify_operator_observability_boundary.js +83 -83
- package/scripts/verify_pricing_experiment_plan.js +124 -124
- package/scripts/verify_provider_runtime_breadth.js +109 -109
- package/scripts/verify_provider_runtime_journeys.js +111 -111
- package/scripts/verify_revenue_launch_paths.js +105 -105
- package/scripts/verify_runtime_durability.js +52 -52
- package/scripts/verify_service.js +15410 -15250
- package/scripts/verify_tooling.js +1412 -1412
- package/scripts/verify_treasury_public_boundary.js +97 -97
- package/scripts/verify_x402_facilitator.js +174 -0
- package/server.js +11117 -11006
- package/.env.production.checklist +0 -77
- package/.env.production.template +0 -54
- package/.github/workflows/publish-mcp-executor.yml +0 -43
- package/ADAPTER_PARTNER_PATH.md +0 -47
- package/ADAPTER_PROMOTION_START_HERE.md +0 -44
- package/BOLT_BINDINGS.production.worksheet.json +0 -31
- package/EXECUTION_TARGETS.production.worksheet.json +0 -73
- package/GO_LIVE_OPERATOR_PACK.md +0 -412
- package/L402_BINDINGS.production.worksheet.json +0 -30
- package/OPERATIONS_RUNBOOK.md +0 -115
- package/OPERATOR_START_HERE.md +0 -63
- package/OUTREACH_MESSAGES.md +0 -19
- package/OUTREACH_START_HERE.md +0 -36
- package/PRODUCTION_MANUAL_CLOSEOUT_SEQUENCE.md +0 -172
- package/PROGRAM_COMPLETE_RELEASE.md +0 -63
- package/PROGRAM_STATUS.md +0 -57
- package/PUBLISH_PLAN.md +0 -26
- package/RELEASE_CHECKLIST.md +0 -16
- package/SOFT_LAUNCH_KIT.md +0 -47
- package/services/mcp-execution-target/DISCOVERY_REGISTRY_PLAYBOOK.md +0 -141
- package/services/mcp-execution-target/README.md +0 -319
- package/services/mcp-execution-target/package.json +0 -14
- package/services/mcp-execution-target/server.js +0 -1031
- package/services/mcp-execution-target/server.json +0 -16
- package/services/mcp-execution-target/verify.js +0 -308
|
@@ -1,1031 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const crypto = require("crypto");
|
|
4
|
-
const dns = require("dns").promises;
|
|
5
|
-
const http = require("http");
|
|
6
|
-
const { URL } = require("url");
|
|
7
|
-
|
|
8
|
-
const DEFAULT_PORT = 4415;
|
|
9
|
-
const DEFAULT_HOST = process.env.RENDER ? "0.0.0.0" : "127.0.0.1";
|
|
10
|
-
const MAX_BODY_BYTES = Math.max(1024, Number(process.env.MCP_EXECUTOR_MAX_BODY_BYTES || 1024 * 256) || 1024 * 256);
|
|
11
|
-
const MCP_PROTOCOL_VERSION = "2025-03-26";
|
|
12
|
-
const MCP_SERVER_NAME = "com.naxytra/xytara-mcp-executor";
|
|
13
|
-
const MCP_SERVER_TITLE = "xytara MCP Executor";
|
|
14
|
-
const MCP_SERVER_DESCRIPTION = "Public MCP server for deterministic summarization, DNS zone lookup, tool cataloging, reply drafting, and JSON validation.";
|
|
15
|
-
const MCP_SERVER_VERSION = process.env.MCP_EXECUTOR_VERSION || "3.1.0";
|
|
16
|
-
|
|
17
|
-
function normalizeString(value, fallback = "") {
|
|
18
|
-
const raw = typeof value === "string" ? value.trim() : "";
|
|
19
|
-
return raw || fallback;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function loadToolAllowlist() {
|
|
23
|
-
const raw = normalizeString(process.env.MCP_EXECUTOR_ALLOWED_TOOLS_JSON);
|
|
24
|
-
if (!raw) return ["summarize", "zones.lookup", "catalog", "reply.draft", "json.validate"];
|
|
25
|
-
try {
|
|
26
|
-
const parsed = JSON.parse(raw);
|
|
27
|
-
return Array.isArray(parsed)
|
|
28
|
-
? parsed.map((entry) => normalizeString(entry)).filter(Boolean)
|
|
29
|
-
: ["summarize", "zones.lookup", "catalog", "reply.draft", "json.validate"];
|
|
30
|
-
} catch (_) {
|
|
31
|
-
return ["summarize", "zones.lookup", "catalog", "reply.draft", "json.validate"];
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function loadConfig() {
|
|
36
|
-
return {
|
|
37
|
-
port: Math.max(1, Number(process.env.PORT || process.env.MCP_EXECUTOR_PORT || DEFAULT_PORT) || DEFAULT_PORT),
|
|
38
|
-
host: normalizeString(process.env.MCP_EXECUTOR_HOST, DEFAULT_HOST),
|
|
39
|
-
bearerToken: normalizeString(process.env.MCP_EXECUTOR_BEARER_TOKEN),
|
|
40
|
-
mcpTransportAuthMode: normalizeString(
|
|
41
|
-
process.env.MCP_EXECUTOR_MCP_TRANSPORT_AUTH_MODE,
|
|
42
|
-
process.env.RENDER ? "x402" : "public"
|
|
43
|
-
),
|
|
44
|
-
enabledTools: loadToolAllowlist(),
|
|
45
|
-
dnsServers: normalizeString(process.env.MCP_EXECUTOR_DNS_SERVERS),
|
|
46
|
-
maxTextLength: Math.max(256, Number(process.env.MCP_EXECUTOR_SUMMARY_MAX_TEXT || 4000) || 4000),
|
|
47
|
-
publicBaseUrl: normalizeString(process.env.MCP_EXECUTOR_PUBLIC_BASE_URL, normalizeString(process.env.RENDER_EXTERNAL_URL)),
|
|
48
|
-
websiteUrl: normalizeString(process.env.MCP_EXECUTOR_WEBSITE_URL, "https://www.naxytra.com/v1/agent-discovery-index"),
|
|
49
|
-
documentationUrl: normalizeString(process.env.MCP_EXECUTOR_DOCUMENTATION_URL, "https://www.naxytra.com/v1/agent-discovery-index/summary"),
|
|
50
|
-
supportUrl: normalizeString(process.env.MCP_EXECUTOR_SUPPORT_URL, "https://www.naxytra.com/support")
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const runtimeConfig = loadConfig();
|
|
55
|
-
const executionCache = new Map();
|
|
56
|
-
const executionMetrics = {
|
|
57
|
-
request_count: 0,
|
|
58
|
-
completed_count: 0,
|
|
59
|
-
failed_count: 0,
|
|
60
|
-
cache_hit_count: 0,
|
|
61
|
-
latest_execution_at_iso: null,
|
|
62
|
-
tool_counts: {}
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
if (runtimeConfig.dnsServers) {
|
|
66
|
-
const servers = runtimeConfig.dnsServers.split(",").map((entry) => entry.trim()).filter(Boolean);
|
|
67
|
-
if (servers.length > 0) dns.setServers(servers);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function jsonResponse(response, statusCode, payload) {
|
|
71
|
-
const body = JSON.stringify(payload);
|
|
72
|
-
response.writeHead(statusCode, {
|
|
73
|
-
"content-type": "application/json; charset=utf-8",
|
|
74
|
-
"content-length": Buffer.byteLength(body)
|
|
75
|
-
});
|
|
76
|
-
response.end(body);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function jsonResponseWithHeaders(response, statusCode, payload, headers) {
|
|
80
|
-
const body = JSON.stringify(payload);
|
|
81
|
-
response.writeHead(statusCode, {
|
|
82
|
-
"content-type": "application/json; charset=utf-8",
|
|
83
|
-
"content-length": Buffer.byteLength(body),
|
|
84
|
-
...(headers || {})
|
|
85
|
-
});
|
|
86
|
-
response.end(body);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function buildPaymentRequiredHeaders(paymentRequiredPayload) {
|
|
90
|
-
const encoded = Buffer.from(JSON.stringify(paymentRequiredPayload), "utf8").toString("base64url");
|
|
91
|
-
return {
|
|
92
|
-
"PAYMENT-REQUIRED": encoded,
|
|
93
|
-
"WWW-Authenticate": "x402",
|
|
94
|
-
"Cache-Control": "no-store"
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function writePaymentRequiredChallenge(response, paymentRequiredPayload) {
|
|
99
|
-
jsonResponseWithHeaders(
|
|
100
|
-
response,
|
|
101
|
-
402,
|
|
102
|
-
paymentRequiredPayload,
|
|
103
|
-
buildPaymentRequiredHeaders(paymentRequiredPayload)
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function readJsonBody(request) {
|
|
108
|
-
return new Promise((resolve, reject) => {
|
|
109
|
-
const chunks = [];
|
|
110
|
-
let total = 0;
|
|
111
|
-
request.on("data", (chunk) => {
|
|
112
|
-
total += chunk.length;
|
|
113
|
-
if (total > MAX_BODY_BYTES) {
|
|
114
|
-
reject(new Error("request_body_too_large"));
|
|
115
|
-
request.destroy();
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
chunks.push(chunk);
|
|
119
|
-
});
|
|
120
|
-
request.on("end", () => {
|
|
121
|
-
if (chunks.length < 1) {
|
|
122
|
-
resolve({});
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
try {
|
|
126
|
-
resolve(JSON.parse(Buffer.concat(chunks).toString("utf8")));
|
|
127
|
-
} catch (error) {
|
|
128
|
-
reject(error);
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
request.on("error", reject);
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
function unauthorized(response) {
|
|
136
|
-
jsonResponse(response, 401, {
|
|
137
|
-
ok: false,
|
|
138
|
-
reason: "unauthorized"
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
function isAuthorized(request, authMode = "execute") {
|
|
143
|
-
if (authMode === "mcp" && runtimeConfig.mcpTransportAuthMode === "public") return true;
|
|
144
|
-
if (!runtimeConfig.bearerToken) return true;
|
|
145
|
-
const authorization = normalizeString(request.headers.authorization);
|
|
146
|
-
const match = authorization.match(/^Bearer\s+(.+)$/i);
|
|
147
|
-
return Boolean(match && match[1] === runtimeConfig.bearerToken);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
function buildBaseUrl(request) {
|
|
151
|
-
const explicit = normalizeString(runtimeConfig.publicBaseUrl);
|
|
152
|
-
if (explicit) return explicit.replace(/\/$/, "");
|
|
153
|
-
const host = normalizeString(request && request.headers && request.headers.host, `127.0.0.1:${runtimeConfig.port}`);
|
|
154
|
-
const forwardedProto = normalizeString(request && request.headers && request.headers["x-forwarded-proto"]);
|
|
155
|
-
const protocol = forwardedProto || (process.env.RENDER ? "https" : "http");
|
|
156
|
-
return `${protocol}://${host}`.replace(/\/$/, "");
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
function stableHash(value) {
|
|
160
|
-
return crypto.createHash("sha256").update(value).digest("hex");
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
function buildExecutionCacheKey(command) {
|
|
164
|
-
const quoteId = normalizeString(command && command.quote && command.quote.quote_id);
|
|
165
|
-
const taskRef = normalizeString(command && command.task_ref);
|
|
166
|
-
const toolName = normalizeString(command && command.body && command.body.tool_name);
|
|
167
|
-
const args = command && command.body && command.body.arguments ? command.body.arguments : {};
|
|
168
|
-
return stableHash(JSON.stringify({ quoteId, taskRef, toolName, args }));
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
function summarizeText(rawText, maxTextLength) {
|
|
172
|
-
const text = String(rawText || "").trim().replace(/\s+/g, " ");
|
|
173
|
-
const boundedText = text.slice(0, maxTextLength);
|
|
174
|
-
const sentences = boundedText.split(/(?<=[.!?])\s+/).filter(Boolean);
|
|
175
|
-
const summary = sentences.slice(0, 3).join(" ").trim() || boundedText.slice(0, 280);
|
|
176
|
-
return {
|
|
177
|
-
ok: true,
|
|
178
|
-
summary,
|
|
179
|
-
char_count: boundedText.length,
|
|
180
|
-
sentence_count: sentences.length
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
function draftReply(argumentsPayload) {
|
|
185
|
-
const text = String(argumentsPayload && argumentsPayload.text || "").trim();
|
|
186
|
-
if (!text) {
|
|
187
|
-
return {
|
|
188
|
-
ok: false,
|
|
189
|
-
reason: "text_required"
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
const tone = normalizeString(argumentsPayload && argumentsPayload.tone, "clear");
|
|
193
|
-
const summary = summarizeText(text, runtimeConfig.maxTextLength).summary;
|
|
194
|
-
return {
|
|
195
|
-
ok: true,
|
|
196
|
-
tone,
|
|
197
|
-
draft: `${summary}${summary.endsWith(".") ? "" : "."} Keep it ${tone}, specific, and ready for agent use.`,
|
|
198
|
-
source_text_char_count: text.length,
|
|
199
|
-
source_text_preview: text.slice(0, 240)
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
function validateJsonPayload(argumentsPayload) {
|
|
204
|
-
const schemaName = normalizeString(argumentsPayload && argumentsPayload.schema_name, "unspecified");
|
|
205
|
-
if (!argumentsPayload || typeof argumentsPayload.payload !== "object" || Array.isArray(argumentsPayload.payload) || argumentsPayload.payload === null) {
|
|
206
|
-
return {
|
|
207
|
-
ok: false,
|
|
208
|
-
reason: "payload_object_required",
|
|
209
|
-
schema_name: schemaName
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
const keys = Object.keys(argumentsPayload.payload).sort();
|
|
213
|
-
return {
|
|
214
|
-
ok: true,
|
|
215
|
-
schema_name: schemaName,
|
|
216
|
-
valid: true,
|
|
217
|
-
key_count: keys.length,
|
|
218
|
-
keys,
|
|
219
|
-
preview_hash: stableHash(JSON.stringify(argumentsPayload.payload))
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
function buildCatalogSummary() {
|
|
224
|
-
return {
|
|
225
|
-
ok: true,
|
|
226
|
-
category: "xytara-mcp-executor-tool-catalog",
|
|
227
|
-
tool_count: buildToolCatalog().length,
|
|
228
|
-
enabled_tools: runtimeConfig.enabledTools.slice(),
|
|
229
|
-
tools: buildToolCatalog().filter((entry) => entry.enabled).map((entry) => ({
|
|
230
|
-
tool_name: entry.tool_name,
|
|
231
|
-
description: entry.description
|
|
232
|
-
}))
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
async function performZoneLookup(argumentsPayload) {
|
|
237
|
-
const hostname = normalizeString(argumentsPayload && argumentsPayload.hostname);
|
|
238
|
-
if (!hostname) {
|
|
239
|
-
return {
|
|
240
|
-
ok: false,
|
|
241
|
-
reason: "hostname_required"
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
const [aRecords, aaaaRecords, mxRecords, nsRecords, txtRecords] = await Promise.allSettled([
|
|
245
|
-
dns.resolve4(hostname),
|
|
246
|
-
dns.resolve6(hostname),
|
|
247
|
-
dns.resolveMx(hostname),
|
|
248
|
-
dns.resolveNs(hostname),
|
|
249
|
-
dns.resolveTxt(hostname)
|
|
250
|
-
]);
|
|
251
|
-
const unwrap = (result) => result.status === "fulfilled" ? result.value : [];
|
|
252
|
-
return {
|
|
253
|
-
ok: true,
|
|
254
|
-
hostname,
|
|
255
|
-
addresses_ipv4: unwrap(aRecords),
|
|
256
|
-
addresses_ipv6: unwrap(aaaaRecords),
|
|
257
|
-
mx: unwrap(mxRecords),
|
|
258
|
-
ns: unwrap(nsRecords),
|
|
259
|
-
txt: unwrap(txtRecords).map((entry) => Array.isArray(entry) ? entry.join("") : String(entry))
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
async function executeTool(toolName, argumentsPayload) {
|
|
264
|
-
if (toolName === "summarize") {
|
|
265
|
-
return summarizeText(argumentsPayload && argumentsPayload.text, runtimeConfig.maxTextLength);
|
|
266
|
-
}
|
|
267
|
-
if (toolName === "zones.lookup") {
|
|
268
|
-
return performZoneLookup(argumentsPayload);
|
|
269
|
-
}
|
|
270
|
-
if (toolName === "catalog") {
|
|
271
|
-
return buildCatalogSummary();
|
|
272
|
-
}
|
|
273
|
-
if (toolName === "reply.draft") {
|
|
274
|
-
return draftReply(argumentsPayload);
|
|
275
|
-
}
|
|
276
|
-
if (toolName === "json.validate") {
|
|
277
|
-
return validateJsonPayload(argumentsPayload);
|
|
278
|
-
}
|
|
279
|
-
return {
|
|
280
|
-
ok: false,
|
|
281
|
-
reason: "tool_not_supported"
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
function buildToolCatalog() {
|
|
286
|
-
const enabled = new Set(runtimeConfig.enabledTools);
|
|
287
|
-
return [
|
|
288
|
-
{
|
|
289
|
-
tool_name: "summarize",
|
|
290
|
-
enabled: enabled.has("summarize"),
|
|
291
|
-
description: "Deterministic text summarization for first-run MCP execution.",
|
|
292
|
-
input_schema: {
|
|
293
|
-
type: "object",
|
|
294
|
-
properties: {
|
|
295
|
-
text: {
|
|
296
|
-
type: "string",
|
|
297
|
-
description: "Plain text to summarize."
|
|
298
|
-
}
|
|
299
|
-
},
|
|
300
|
-
required: ["text"],
|
|
301
|
-
additionalProperties: false
|
|
302
|
-
}
|
|
303
|
-
},
|
|
304
|
-
{
|
|
305
|
-
tool_name: "zones.lookup",
|
|
306
|
-
enabled: enabled.has("zones.lookup"),
|
|
307
|
-
description: "DNS and zone lookup with A, AAAA, MX, NS, and TXT records.",
|
|
308
|
-
input_schema: {
|
|
309
|
-
type: "object",
|
|
310
|
-
properties: {
|
|
311
|
-
hostname: {
|
|
312
|
-
type: "string",
|
|
313
|
-
description: "Hostname to resolve, for example example.com."
|
|
314
|
-
}
|
|
315
|
-
},
|
|
316
|
-
required: ["hostname"],
|
|
317
|
-
additionalProperties: false
|
|
318
|
-
}
|
|
319
|
-
},
|
|
320
|
-
{
|
|
321
|
-
tool_name: "catalog",
|
|
322
|
-
enabled: enabled.has("catalog"),
|
|
323
|
-
description: "Returns the current enabled MCP tool catalog for discovery-aware agents.",
|
|
324
|
-
input_schema: {
|
|
325
|
-
type: "object",
|
|
326
|
-
properties: {},
|
|
327
|
-
additionalProperties: false
|
|
328
|
-
}
|
|
329
|
-
},
|
|
330
|
-
{
|
|
331
|
-
tool_name: "reply.draft",
|
|
332
|
-
enabled: enabled.has("reply.draft"),
|
|
333
|
-
description: "Produces a concise agent-ready reply draft from source text and tone.",
|
|
334
|
-
input_schema: {
|
|
335
|
-
type: "object",
|
|
336
|
-
properties: {
|
|
337
|
-
text: {
|
|
338
|
-
type: "string",
|
|
339
|
-
description: "Source text to transform into a reply draft."
|
|
340
|
-
},
|
|
341
|
-
tone: {
|
|
342
|
-
type: "string",
|
|
343
|
-
description: "Optional style hint such as concise, warm, or formal."
|
|
344
|
-
}
|
|
345
|
-
},
|
|
346
|
-
required: ["text"],
|
|
347
|
-
additionalProperties: false
|
|
348
|
-
}
|
|
349
|
-
},
|
|
350
|
-
{
|
|
351
|
-
tool_name: "json.validate",
|
|
352
|
-
enabled: enabled.has("json.validate"),
|
|
353
|
-
description: "Validates a JSON object payload and returns deterministic shape metadata.",
|
|
354
|
-
input_schema: {
|
|
355
|
-
type: "object",
|
|
356
|
-
properties: {
|
|
357
|
-
payload: {
|
|
358
|
-
type: "object",
|
|
359
|
-
description: "JSON payload to inspect."
|
|
360
|
-
},
|
|
361
|
-
schema_name: {
|
|
362
|
-
type: "string",
|
|
363
|
-
description: "Optional schema label for the validation request."
|
|
364
|
-
}
|
|
365
|
-
},
|
|
366
|
-
required: ["payload"],
|
|
367
|
-
additionalProperties: false
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
];
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
function buildMcpToolCatalog() {
|
|
374
|
-
return buildToolCatalog()
|
|
375
|
-
.filter((entry) => entry.enabled)
|
|
376
|
-
.map((entry) => ({
|
|
377
|
-
name: entry.tool_name,
|
|
378
|
-
title: entry.tool_name,
|
|
379
|
-
description: entry.description,
|
|
380
|
-
inputSchema: entry.input_schema
|
|
381
|
-
}));
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
function buildMcpServerCard(request) {
|
|
385
|
-
const baseUrl = buildBaseUrl(request);
|
|
386
|
-
const remotes = [
|
|
387
|
-
{
|
|
388
|
-
type: "streamable-http",
|
|
389
|
-
url: `${baseUrl}/mcp`
|
|
390
|
-
}
|
|
391
|
-
];
|
|
392
|
-
if (runtimeConfig.mcpTransportAuthMode !== "public") {
|
|
393
|
-
remotes[0].headers = [
|
|
394
|
-
{
|
|
395
|
-
name: "Authorization",
|
|
396
|
-
description: "Bearer token issued for xytara MCP executor access. Format: Bearer <token>.",
|
|
397
|
-
isRequired: true,
|
|
398
|
-
isSecret: true
|
|
399
|
-
}
|
|
400
|
-
];
|
|
401
|
-
}
|
|
402
|
-
return {
|
|
403
|
-
$schema: "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
404
|
-
name: MCP_SERVER_NAME,
|
|
405
|
-
title: MCP_SERVER_TITLE,
|
|
406
|
-
description: MCP_SERVER_DESCRIPTION,
|
|
407
|
-
version: MCP_SERVER_VERSION,
|
|
408
|
-
remotes,
|
|
409
|
-
websiteUrl: runtimeConfig.websiteUrl,
|
|
410
|
-
documentationUrl: runtimeConfig.documentationUrl,
|
|
411
|
-
supportUrl: runtimeConfig.supportUrl
|
|
412
|
-
};
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
function buildMcpDiscoverySummary(request) {
|
|
416
|
-
return {
|
|
417
|
-
ok: true,
|
|
418
|
-
category: "xytara-mcp-executor-discovery-summary",
|
|
419
|
-
server_name: MCP_SERVER_NAME,
|
|
420
|
-
title: MCP_SERVER_TITLE,
|
|
421
|
-
version: MCP_SERVER_VERSION,
|
|
422
|
-
transport_type: "streamable-http",
|
|
423
|
-
mcp_ref: `${buildBaseUrl(request)}/mcp`,
|
|
424
|
-
server_card_ref: `${buildBaseUrl(request)}/server.json`,
|
|
425
|
-
public_transport: runtimeConfig.mcpTransportAuthMode === "public",
|
|
426
|
-
tool_count: buildMcpToolCatalog().length,
|
|
427
|
-
tools: buildMcpToolCatalog().map((entry) => entry.name)
|
|
428
|
-
};
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
function buildMcpDiscoveryPaymentRequiredPayload(request) {
|
|
432
|
-
const summary = buildMcpDiscoverySummary(request);
|
|
433
|
-
const resource = `${buildBaseUrl(request)}/mcp`;
|
|
434
|
-
const discoveryInputSchema = {
|
|
435
|
-
type: "object",
|
|
436
|
-
properties: {},
|
|
437
|
-
additionalProperties: false
|
|
438
|
-
};
|
|
439
|
-
const discoveryOutputSchema = {
|
|
440
|
-
type: "object",
|
|
441
|
-
additionalProperties: false,
|
|
442
|
-
properties: {
|
|
443
|
-
ok: {
|
|
444
|
-
type: "boolean"
|
|
445
|
-
},
|
|
446
|
-
server_name: {
|
|
447
|
-
type: "string"
|
|
448
|
-
},
|
|
449
|
-
title: {
|
|
450
|
-
type: "string"
|
|
451
|
-
},
|
|
452
|
-
version: {
|
|
453
|
-
type: "string"
|
|
454
|
-
},
|
|
455
|
-
transport_type: {
|
|
456
|
-
type: "string"
|
|
457
|
-
},
|
|
458
|
-
mcp_ref: {
|
|
459
|
-
type: "string"
|
|
460
|
-
},
|
|
461
|
-
server_card_ref: {
|
|
462
|
-
type: "string"
|
|
463
|
-
},
|
|
464
|
-
public_transport: {
|
|
465
|
-
type: "boolean"
|
|
466
|
-
},
|
|
467
|
-
tool_count: {
|
|
468
|
-
type: "number"
|
|
469
|
-
},
|
|
470
|
-
tools: {
|
|
471
|
-
type: "array",
|
|
472
|
-
items: {
|
|
473
|
-
type: "string"
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
},
|
|
477
|
-
required: [
|
|
478
|
-
"ok",
|
|
479
|
-
"server_name",
|
|
480
|
-
"title",
|
|
481
|
-
"version",
|
|
482
|
-
"transport_type",
|
|
483
|
-
"mcp_ref",
|
|
484
|
-
"server_card_ref",
|
|
485
|
-
"public_transport",
|
|
486
|
-
"tool_count",
|
|
487
|
-
"tools"
|
|
488
|
-
]
|
|
489
|
-
};
|
|
490
|
-
const catalogToolDeclaration = {
|
|
491
|
-
name: "catalog",
|
|
492
|
-
title: "catalog",
|
|
493
|
-
description: "Returns the current enabled MCP tool catalog for discovery-aware agents.",
|
|
494
|
-
inputSchema: {
|
|
495
|
-
type: "object",
|
|
496
|
-
properties: {},
|
|
497
|
-
additionalProperties: false
|
|
498
|
-
}
|
|
499
|
-
};
|
|
500
|
-
return {
|
|
501
|
-
x402Version: 2,
|
|
502
|
-
type: "http",
|
|
503
|
-
resource: {
|
|
504
|
-
url: resource,
|
|
505
|
-
description: MCP_SERVER_DESCRIPTION,
|
|
506
|
-
mimeType: "application/json"
|
|
507
|
-
},
|
|
508
|
-
lastUpdated: new Date().toISOString(),
|
|
509
|
-
accepts: [
|
|
510
|
-
{
|
|
511
|
-
scheme: "exact",
|
|
512
|
-
network: "eip155:84532",
|
|
513
|
-
asset: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
|
|
514
|
-
amount: "1000",
|
|
515
|
-
payTo: "0x209693Bc6afc0C5328bA36FaF03C514EF312287C",
|
|
516
|
-
maxTimeoutSeconds: 60
|
|
517
|
-
}
|
|
518
|
-
],
|
|
519
|
-
metadata: {
|
|
520
|
-
description: MCP_SERVER_DESCRIPTION,
|
|
521
|
-
},
|
|
522
|
-
input: {
|
|
523
|
-
type: "http",
|
|
524
|
-
method: "GET",
|
|
525
|
-
queryParams: {}
|
|
526
|
-
},
|
|
527
|
-
inputSchema: discoveryInputSchema,
|
|
528
|
-
output: {
|
|
529
|
-
type: "json",
|
|
530
|
-
example: summary
|
|
531
|
-
},
|
|
532
|
-
outputSchema: discoveryOutputSchema,
|
|
533
|
-
extensions: {
|
|
534
|
-
bazaar: {
|
|
535
|
-
toolName: "catalog",
|
|
536
|
-
description: "Returns the current enabled MCP tool catalog for discovery-aware agents.",
|
|
537
|
-
transport: "streamable-http",
|
|
538
|
-
inputSchema: {
|
|
539
|
-
type: "object",
|
|
540
|
-
properties: {},
|
|
541
|
-
additionalProperties: false
|
|
542
|
-
},
|
|
543
|
-
example: {
|
|
544
|
-
name: "catalog",
|
|
545
|
-
title: "catalog",
|
|
546
|
-
description: "Returns the current enabled MCP tool catalog for discovery-aware agents.",
|
|
547
|
-
inputSchema: {
|
|
548
|
-
type: "object",
|
|
549
|
-
properties: {},
|
|
550
|
-
additionalProperties: false
|
|
551
|
-
}
|
|
552
|
-
},
|
|
553
|
-
input: {
|
|
554
|
-
type: "mcp",
|
|
555
|
-
toolName: "catalog",
|
|
556
|
-
inputSchema: {
|
|
557
|
-
type: "object",
|
|
558
|
-
properties: {},
|
|
559
|
-
additionalProperties: false
|
|
560
|
-
},
|
|
561
|
-
description: "Returns the current enabled MCP tool catalog for discovery-aware agents.",
|
|
562
|
-
transport: "streamable-http",
|
|
563
|
-
example: catalogToolDeclaration
|
|
564
|
-
},
|
|
565
|
-
output: {
|
|
566
|
-
type: "json",
|
|
567
|
-
example: catalogToolDeclaration
|
|
568
|
-
},
|
|
569
|
-
info: {
|
|
570
|
-
input: {
|
|
571
|
-
type: "http",
|
|
572
|
-
method: "GET",
|
|
573
|
-
queryParams: {}
|
|
574
|
-
},
|
|
575
|
-
output: {
|
|
576
|
-
type: "json",
|
|
577
|
-
example: summary
|
|
578
|
-
}
|
|
579
|
-
},
|
|
580
|
-
schema: {
|
|
581
|
-
type: "object",
|
|
582
|
-
additionalProperties: false,
|
|
583
|
-
properties: {
|
|
584
|
-
toolName: { type: "string" },
|
|
585
|
-
description: { type: "string" },
|
|
586
|
-
transport: { type: "string" },
|
|
587
|
-
inputSchema: {
|
|
588
|
-
type: "object",
|
|
589
|
-
additionalProperties: true
|
|
590
|
-
},
|
|
591
|
-
example: {
|
|
592
|
-
type: "object",
|
|
593
|
-
additionalProperties: false,
|
|
594
|
-
properties: {
|
|
595
|
-
name: { type: "string" },
|
|
596
|
-
title: { type: "string" },
|
|
597
|
-
description: { type: "string" },
|
|
598
|
-
inputSchema: {
|
|
599
|
-
type: "object",
|
|
600
|
-
additionalProperties: true
|
|
601
|
-
}
|
|
602
|
-
},
|
|
603
|
-
required: ["name", "title", "description", "inputSchema"]
|
|
604
|
-
},
|
|
605
|
-
input: {
|
|
606
|
-
type: "object",
|
|
607
|
-
additionalProperties: false,
|
|
608
|
-
properties: {
|
|
609
|
-
type: { type: "string", const: "mcp" },
|
|
610
|
-
toolName: { type: "string" },
|
|
611
|
-
inputSchema: {
|
|
612
|
-
type: "object",
|
|
613
|
-
additionalProperties: true
|
|
614
|
-
},
|
|
615
|
-
description: { type: "string" },
|
|
616
|
-
transport: { type: "string" },
|
|
617
|
-
example: {
|
|
618
|
-
type: "object",
|
|
619
|
-
additionalProperties: false,
|
|
620
|
-
properties: {
|
|
621
|
-
name: { type: "string" },
|
|
622
|
-
title: { type: "string" },
|
|
623
|
-
description: { type: "string" },
|
|
624
|
-
inputSchema: {
|
|
625
|
-
type: "object",
|
|
626
|
-
additionalProperties: true
|
|
627
|
-
}
|
|
628
|
-
},
|
|
629
|
-
required: ["name", "title", "description", "inputSchema"]
|
|
630
|
-
}
|
|
631
|
-
},
|
|
632
|
-
required: ["type", "toolName", "inputSchema", "transport", "example"]
|
|
633
|
-
},
|
|
634
|
-
output: {
|
|
635
|
-
type: "object",
|
|
636
|
-
additionalProperties: false,
|
|
637
|
-
properties: {
|
|
638
|
-
type: { type: "string", const: "json" },
|
|
639
|
-
example: {
|
|
640
|
-
type: "object",
|
|
641
|
-
additionalProperties: false,
|
|
642
|
-
properties: {
|
|
643
|
-
name: { type: "string" },
|
|
644
|
-
title: { type: "string" },
|
|
645
|
-
description: { type: "string" },
|
|
646
|
-
inputSchema: {
|
|
647
|
-
type: "object",
|
|
648
|
-
additionalProperties: true
|
|
649
|
-
}
|
|
650
|
-
},
|
|
651
|
-
required: [
|
|
652
|
-
"name",
|
|
653
|
-
"title",
|
|
654
|
-
"description",
|
|
655
|
-
"inputSchema"
|
|
656
|
-
]
|
|
657
|
-
}
|
|
658
|
-
},
|
|
659
|
-
required: ["type", "example"]
|
|
660
|
-
}
|
|
661
|
-
},
|
|
662
|
-
required: ["input", "output"]
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
};
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
function buildGlamaClaimDocument() {
|
|
670
|
-
const maintainerEmail = normalizeString(process.env.MCP_EXECUTOR_GLAMA_MAINTAINER_EMAIL);
|
|
671
|
-
if (!maintainerEmail) return null;
|
|
672
|
-
return {
|
|
673
|
-
$schema: "https://glama.ai/mcp/schemas/connector.json",
|
|
674
|
-
maintainers: [
|
|
675
|
-
{
|
|
676
|
-
email: maintainerEmail
|
|
677
|
-
}
|
|
678
|
-
]
|
|
679
|
-
};
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
function buildOperationalDepth() {
|
|
683
|
-
const executionStats = {
|
|
684
|
-
...executionMetrics,
|
|
685
|
-
tool_counts: {
|
|
686
|
-
...executionMetrics.tool_counts
|
|
687
|
-
}
|
|
688
|
-
};
|
|
689
|
-
return {
|
|
690
|
-
depth_version: "xytara-mcp-execution-target-depth-v1",
|
|
691
|
-
provider_live_task_ref: "adapter.mcp.invoke",
|
|
692
|
-
mcp_server_name: MCP_SERVER_NAME,
|
|
693
|
-
mcp_protocol_version: MCP_PROTOCOL_VERSION,
|
|
694
|
-
execute_surface: "/execute",
|
|
695
|
-
health_surface: "/health",
|
|
696
|
-
tool_catalog_surface: "/tools",
|
|
697
|
-
mcp_surface: "/mcp",
|
|
698
|
-
server_card_surface: "/server.json",
|
|
699
|
-
auth_mode: runtimeConfig.bearerToken ? "bearer_required" : "open_local_or_private",
|
|
700
|
-
mcp_auth_mode: runtimeConfig.mcpTransportAuthMode,
|
|
701
|
-
supports_health: true,
|
|
702
|
-
supports_tool_catalog: true,
|
|
703
|
-
supports_execute: true,
|
|
704
|
-
supports_mcp_streamable_http: true,
|
|
705
|
-
supports_bearer_auth: Boolean(runtimeConfig.bearerToken),
|
|
706
|
-
emits_proof_facts: true,
|
|
707
|
-
idempotency_cache_enabled: true,
|
|
708
|
-
cache_entry_count: executionCache.size,
|
|
709
|
-
enabled_tool_count: runtimeConfig.enabledTools.length,
|
|
710
|
-
enabled_tools: runtimeConfig.enabledTools,
|
|
711
|
-
proof_fact_compatible: true,
|
|
712
|
-
deterministic_cache_enabled: true,
|
|
713
|
-
bounded_body_bytes: MAX_BODY_BYTES,
|
|
714
|
-
metrics: executionStats,
|
|
715
|
-
execution_stats: executionStats
|
|
716
|
-
};
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
function writeRpcResult(response, id, result) {
|
|
720
|
-
jsonResponse(response, 200, {
|
|
721
|
-
jsonrpc: "2.0",
|
|
722
|
-
id: typeof id === "undefined" ? null : id,
|
|
723
|
-
result
|
|
724
|
-
});
|
|
725
|
-
}
|
|
726
|
-
|
|
727
|
-
function writeRpcError(response, id, code, message, data) {
|
|
728
|
-
jsonResponse(response, 200, {
|
|
729
|
-
jsonrpc: "2.0",
|
|
730
|
-
id: typeof id === "undefined" ? null : id,
|
|
731
|
-
error: {
|
|
732
|
-
code,
|
|
733
|
-
message,
|
|
734
|
-
...(typeof data === "undefined" ? {} : { data })
|
|
735
|
-
}
|
|
736
|
-
});
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
async function handleMcpRequest(request, response) {
|
|
740
|
-
if (runtimeConfig.mcpTransportAuthMode !== "public" && !normalizeString(request.headers["payment-signature"])) {
|
|
741
|
-
const paymentRequired = buildMcpDiscoveryPaymentRequiredPayload(request);
|
|
742
|
-
writePaymentRequiredChallenge(response, paymentRequired);
|
|
743
|
-
return;
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
let payload;
|
|
747
|
-
try {
|
|
748
|
-
payload = await readJsonBody(request);
|
|
749
|
-
} catch (error) {
|
|
750
|
-
writeRpcError(response, null, -32700, "Parse error", {
|
|
751
|
-
reason: error && error.message === "request_body_too_large" ? "request_body_too_large" : "invalid_json"
|
|
752
|
-
});
|
|
753
|
-
return;
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
if (!payload || typeof payload !== "object" || Array.isArray(payload)) {
|
|
757
|
-
writeRpcError(response, null, -32600, "Invalid Request");
|
|
758
|
-
return;
|
|
759
|
-
}
|
|
760
|
-
|
|
761
|
-
const method = normalizeString(payload.method);
|
|
762
|
-
const id = payload.id;
|
|
763
|
-
const params = payload && typeof payload.params === "object" && payload.params ? payload.params : {};
|
|
764
|
-
|
|
765
|
-
if (method === "initialize") {
|
|
766
|
-
writeRpcResult(response, id, {
|
|
767
|
-
protocolVersion: MCP_PROTOCOL_VERSION,
|
|
768
|
-
capabilities: {
|
|
769
|
-
tools: {
|
|
770
|
-
listChanged: false
|
|
771
|
-
}
|
|
772
|
-
},
|
|
773
|
-
serverInfo: {
|
|
774
|
-
name: MCP_SERVER_NAME,
|
|
775
|
-
title: MCP_SERVER_TITLE,
|
|
776
|
-
version: MCP_SERVER_VERSION
|
|
777
|
-
},
|
|
778
|
-
instructions: "Use tools/list to discover deterministic summarization, DNS lookup, tool catalog, reply drafting, and JSON validation tools."
|
|
779
|
-
});
|
|
780
|
-
return;
|
|
781
|
-
}
|
|
782
|
-
|
|
783
|
-
if (method === "notifications/initialized") {
|
|
784
|
-
response.writeHead(202, { "content-type": "application/json; charset=utf-8" });
|
|
785
|
-
response.end(JSON.stringify({ ok: true }));
|
|
786
|
-
return;
|
|
787
|
-
}
|
|
788
|
-
|
|
789
|
-
if (method === "ping") {
|
|
790
|
-
writeRpcResult(response, id, {});
|
|
791
|
-
return;
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
if (method === "tools/list") {
|
|
795
|
-
writeRpcResult(response, id, {
|
|
796
|
-
tools: buildMcpToolCatalog()
|
|
797
|
-
});
|
|
798
|
-
return;
|
|
799
|
-
}
|
|
800
|
-
|
|
801
|
-
if (method === "tools/call") {
|
|
802
|
-
const toolName = normalizeString(params.name);
|
|
803
|
-
const toolArgs = params && typeof params.arguments === "object" && params.arguments ? params.arguments : {};
|
|
804
|
-
if (!runtimeConfig.enabledTools.includes(toolName)) {
|
|
805
|
-
writeRpcError(response, id, -32602, "Unknown tool", {
|
|
806
|
-
tool_name: toolName,
|
|
807
|
-
enabled_tools: runtimeConfig.enabledTools
|
|
808
|
-
});
|
|
809
|
-
return;
|
|
810
|
-
}
|
|
811
|
-
const result = await executeTool(toolName, toolArgs);
|
|
812
|
-
if (!result || result.ok === false) {
|
|
813
|
-
writeRpcResult(response, id, {
|
|
814
|
-
content: [
|
|
815
|
-
{
|
|
816
|
-
type: "text",
|
|
817
|
-
text: JSON.stringify(result, null, 2)
|
|
818
|
-
}
|
|
819
|
-
],
|
|
820
|
-
structuredContent: result,
|
|
821
|
-
isError: true
|
|
822
|
-
});
|
|
823
|
-
return;
|
|
824
|
-
}
|
|
825
|
-
writeRpcResult(response, id, {
|
|
826
|
-
content: [
|
|
827
|
-
{
|
|
828
|
-
type: "text",
|
|
829
|
-
text: JSON.stringify(result, null, 2)
|
|
830
|
-
}
|
|
831
|
-
],
|
|
832
|
-
structuredContent: result,
|
|
833
|
-
isError: false
|
|
834
|
-
});
|
|
835
|
-
return;
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
writeRpcError(response, id, -32601, "Method not found", {
|
|
839
|
-
method
|
|
840
|
-
});
|
|
841
|
-
}
|
|
842
|
-
|
|
843
|
-
async function handleExecute(request, response) {
|
|
844
|
-
if (!isAuthorized(request)) {
|
|
845
|
-
unauthorized(response);
|
|
846
|
-
return;
|
|
847
|
-
}
|
|
848
|
-
executionMetrics.request_count += 1;
|
|
849
|
-
executionMetrics.latest_execution_at_iso = new Date().toISOString();
|
|
850
|
-
|
|
851
|
-
let payload;
|
|
852
|
-
try {
|
|
853
|
-
payload = await readJsonBody(request);
|
|
854
|
-
} catch (error) {
|
|
855
|
-
executionMetrics.failed_count += 1;
|
|
856
|
-
jsonResponse(response, 400, {
|
|
857
|
-
ok: false,
|
|
858
|
-
reason: error && error.message === "request_body_too_large" ? "request_body_too_large" : "invalid_json"
|
|
859
|
-
});
|
|
860
|
-
return;
|
|
861
|
-
}
|
|
862
|
-
|
|
863
|
-
const taskRef = normalizeString(payload && payload.task_ref);
|
|
864
|
-
const body = payload && typeof payload.body === "object" && payload.body ? payload.body : {};
|
|
865
|
-
const toolName = normalizeString(body.tool_name);
|
|
866
|
-
const toolArgs = body && typeof body.arguments === "object" && body.arguments ? body.arguments : {};
|
|
867
|
-
|
|
868
|
-
if (!taskRef.startsWith("adapter.mcp.")) {
|
|
869
|
-
executionMetrics.failed_count += 1;
|
|
870
|
-
jsonResponse(response, 400, {
|
|
871
|
-
ok: false,
|
|
872
|
-
reason: "unsupported_task_ref",
|
|
873
|
-
supported_task_prefix: "adapter.mcp."
|
|
874
|
-
});
|
|
875
|
-
return;
|
|
876
|
-
}
|
|
877
|
-
if (!runtimeConfig.enabledTools.includes(toolName)) {
|
|
878
|
-
executionMetrics.failed_count += 1;
|
|
879
|
-
jsonResponse(response, 403, {
|
|
880
|
-
ok: false,
|
|
881
|
-
reason: "tool_not_enabled",
|
|
882
|
-
tool_name: toolName,
|
|
883
|
-
enabled_tools: runtimeConfig.enabledTools
|
|
884
|
-
});
|
|
885
|
-
return;
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
const cacheKey = buildExecutionCacheKey(payload);
|
|
889
|
-
if (executionCache.has(cacheKey)) {
|
|
890
|
-
executionMetrics.cache_hit_count += 1;
|
|
891
|
-
jsonResponse(response, 200, executionCache.get(cacheKey));
|
|
892
|
-
return;
|
|
893
|
-
}
|
|
894
|
-
|
|
895
|
-
const startedAt = new Date().toISOString();
|
|
896
|
-
const result = await executeTool(toolName, toolArgs);
|
|
897
|
-
if (!result || result.ok === false) {
|
|
898
|
-
executionMetrics.failed_count += 1;
|
|
899
|
-
const failurePayload = {
|
|
900
|
-
ok: false,
|
|
901
|
-
status: "failed",
|
|
902
|
-
adapter_id: "xytara.provider.mcp_execution_target",
|
|
903
|
-
tool_name: toolName,
|
|
904
|
-
started_at_iso: startedAt,
|
|
905
|
-
finished_at_iso: new Date().toISOString(),
|
|
906
|
-
reason: result && result.reason ? result.reason : "execution_failed"
|
|
907
|
-
};
|
|
908
|
-
jsonResponse(response, 422, failurePayload);
|
|
909
|
-
return;
|
|
910
|
-
}
|
|
911
|
-
|
|
912
|
-
const successPayload = {
|
|
913
|
-
ok: true,
|
|
914
|
-
status: "completed",
|
|
915
|
-
adapter_id: "xytara.provider.mcp_execution_target",
|
|
916
|
-
tool_name: toolName,
|
|
917
|
-
started_at_iso: startedAt,
|
|
918
|
-
finished_at_iso: new Date().toISOString(),
|
|
919
|
-
result: {
|
|
920
|
-
task_ref: taskRef,
|
|
921
|
-
tool_name: toolName,
|
|
922
|
-
output: result
|
|
923
|
-
},
|
|
924
|
-
proof_facts: {
|
|
925
|
-
emits_proof_compatible_facts: true,
|
|
926
|
-
proof_mode: "execution_facts_only",
|
|
927
|
-
execution_kind: "mcp_tool_invoke",
|
|
928
|
-
tool_name: toolName
|
|
929
|
-
}
|
|
930
|
-
};
|
|
931
|
-
executionCache.set(cacheKey, successPayload);
|
|
932
|
-
executionMetrics.completed_count += 1;
|
|
933
|
-
executionMetrics.tool_counts[toolName] = (executionMetrics.tool_counts[toolName] || 0) + 1;
|
|
934
|
-
jsonResponse(response, 200, successPayload);
|
|
935
|
-
}
|
|
936
|
-
|
|
937
|
-
function createServer() {
|
|
938
|
-
return http.createServer(async (request, response) => {
|
|
939
|
-
const url = new URL(request.url, `http://${request.headers.host || "localhost"}`);
|
|
940
|
-
if (request.method === "GET" && url.pathname === "/health") {
|
|
941
|
-
jsonResponse(response, 200, {
|
|
942
|
-
ok: true,
|
|
943
|
-
status: "ok",
|
|
944
|
-
readiness: runtimeConfig.bearerToken ? "auth_required" : "ready",
|
|
945
|
-
service: "xytara-mcp-execution-target",
|
|
946
|
-
enabled_tools: runtimeConfig.enabledTools,
|
|
947
|
-
operational_depth: buildOperationalDepth()
|
|
948
|
-
});
|
|
949
|
-
return;
|
|
950
|
-
}
|
|
951
|
-
if (request.method === "GET" && url.pathname === "/server.json") {
|
|
952
|
-
jsonResponse(response, 200, buildMcpServerCard(request));
|
|
953
|
-
return;
|
|
954
|
-
}
|
|
955
|
-
if (request.method === "GET" && url.pathname === "/.well-known/mcp-server.json") {
|
|
956
|
-
jsonResponse(response, 200, buildMcpServerCard(request));
|
|
957
|
-
return;
|
|
958
|
-
}
|
|
959
|
-
if (request.method === "GET" && url.pathname === "/.well-known/glama.json") {
|
|
960
|
-
const glamaClaim = buildGlamaClaimDocument();
|
|
961
|
-
if (!glamaClaim) {
|
|
962
|
-
jsonResponse(response, 404, {
|
|
963
|
-
ok: false,
|
|
964
|
-
reason: "glama_claim_not_configured"
|
|
965
|
-
});
|
|
966
|
-
return;
|
|
967
|
-
}
|
|
968
|
-
jsonResponse(response, 200, glamaClaim);
|
|
969
|
-
return;
|
|
970
|
-
}
|
|
971
|
-
if (request.method === "GET" && url.pathname === "/mcp") {
|
|
972
|
-
if (runtimeConfig.mcpTransportAuthMode !== "public" && !normalizeString(request.headers["payment-signature"])) {
|
|
973
|
-
const paymentRequired = buildMcpDiscoveryPaymentRequiredPayload(request);
|
|
974
|
-
writePaymentRequiredChallenge(response, paymentRequired);
|
|
975
|
-
return;
|
|
976
|
-
}
|
|
977
|
-
jsonResponse(response, 200, buildMcpDiscoverySummary(request));
|
|
978
|
-
return;
|
|
979
|
-
}
|
|
980
|
-
if (request.method === "OPTIONS" && url.pathname === "/mcp") {
|
|
981
|
-
response.writeHead(204, {
|
|
982
|
-
allow: "GET, POST, OPTIONS"
|
|
983
|
-
});
|
|
984
|
-
response.end();
|
|
985
|
-
return;
|
|
986
|
-
}
|
|
987
|
-
if (request.method === "POST" && url.pathname === "/mcp") {
|
|
988
|
-
await handleMcpRequest(request, response);
|
|
989
|
-
return;
|
|
990
|
-
}
|
|
991
|
-
if (request.method === "GET" && url.pathname === "/tools") {
|
|
992
|
-
if (!isAuthorized(request)) {
|
|
993
|
-
unauthorized(response);
|
|
994
|
-
return;
|
|
995
|
-
}
|
|
996
|
-
jsonResponse(response, 200, {
|
|
997
|
-
ok: true,
|
|
998
|
-
tools: buildToolCatalog()
|
|
999
|
-
});
|
|
1000
|
-
return;
|
|
1001
|
-
}
|
|
1002
|
-
if (request.method === "POST" && url.pathname === "/execute") {
|
|
1003
|
-
await handleExecute(request, response);
|
|
1004
|
-
return;
|
|
1005
|
-
}
|
|
1006
|
-
jsonResponse(response, 404, {
|
|
1007
|
-
ok: false,
|
|
1008
|
-
reason: "not_found"
|
|
1009
|
-
});
|
|
1010
|
-
});
|
|
1011
|
-
}
|
|
1012
|
-
|
|
1013
|
-
if (require.main === module) {
|
|
1014
|
-
const server = createServer();
|
|
1015
|
-
server.listen(runtimeConfig.port, runtimeConfig.host, () => {
|
|
1016
|
-
process.stdout.write(
|
|
1017
|
-
`xytara-mcp-execution-target listening on http://${runtimeConfig.host}:${runtimeConfig.port}\n`
|
|
1018
|
-
);
|
|
1019
|
-
});
|
|
1020
|
-
}
|
|
1021
|
-
|
|
1022
|
-
module.exports = {
|
|
1023
|
-
createServer,
|
|
1024
|
-
loadConfig,
|
|
1025
|
-
buildToolCatalog,
|
|
1026
|
-
buildOperationalDepth,
|
|
1027
|
-
buildMcpToolCatalog,
|
|
1028
|
-
buildMcpServerCard,
|
|
1029
|
-
buildMcpDiscoverySummary,
|
|
1030
|
-
buildGlamaClaimDocument
|
|
1031
|
-
};
|