effect 4.0.7 → 4.1.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.
- package/README.md +1 -1
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +3 -0
- package/dist/BigDecimal.js.map +1 -1
- package/dist/Channel.d.ts +12 -6
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +9 -3
- package/dist/Channel.js.map +1 -1
- package/dist/Config.d.ts +7 -1
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js.map +1 -1
- package/dist/Context.d.ts +18 -1
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js +27 -8
- package/dist/Context.js.map +1 -1
- package/dist/Cron.d.ts +81 -11
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +101 -26
- package/dist/Cron.js.map +1 -1
- package/dist/Duration.d.ts +78 -0
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +123 -0
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +164 -7
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +11 -1
- package/dist/Effect.js.map +1 -1
- package/dist/FileSystem.d.ts +59 -4
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +9 -2
- package/dist/FileSystem.js.map +1 -1
- package/dist/Glob.d.ts +165 -0
- package/dist/Glob.d.ts.map +1 -0
- package/dist/Glob.js +127 -0
- package/dist/Glob.js.map +1 -0
- package/dist/Match.d.ts +86 -0
- package/dist/Match.d.ts.map +1 -1
- package/dist/Match.js +72 -0
- package/dist/Match.js.map +1 -1
- package/dist/Pool.d.ts +51 -0
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +59 -9
- package/dist/Pool.js.map +1 -1
- package/dist/Random.d.ts.map +1 -1
- package/dist/Random.js +3 -3
- package/dist/Random.js.map +1 -1
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/RcMap.js +8 -2
- package/dist/RcMap.js.map +1 -1
- package/dist/Schedule.d.ts +18 -1
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +7 -2
- package/dist/Schedule.js.map +1 -1
- package/dist/Schema.d.ts +666 -41
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +650 -0
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaGetter.d.ts +6 -1
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +22 -11
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +14 -0
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +16 -0
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +8 -3
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +6 -3
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/ScopedCache.d.ts.map +1 -1
- package/dist/ScopedCache.js +5 -7
- package/dist/ScopedCache.js.map +1 -1
- package/dist/Semaphore.d.ts +130 -0
- package/dist/Semaphore.d.ts.map +1 -1
- package/dist/Semaphore.js +40 -0
- package/dist/Semaphore.js.map +1 -1
- package/dist/Stream.d.ts +13 -4
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +9 -0
- package/dist/Stream.js.map +1 -1
- package/dist/Terminal.d.ts +18 -1
- package/dist/Terminal.d.ts.map +1 -1
- package/dist/Terminal.js +1 -1
- package/dist/Terminal.js.map +1 -1
- package/dist/ai/AiError.d.ts +43 -116
- package/dist/ai/AiError.d.ts.map +1 -1
- package/dist/ai/AiError.js +53 -72
- package/dist/ai/AiError.js.map +1 -1
- package/dist/ai/Decision.d.ts +196 -15
- package/dist/ai/Decision.d.ts.map +1 -1
- package/dist/ai/Decision.js +130 -0
- package/dist/ai/Decision.js.map +1 -1
- package/dist/ai/DecisionModel.d.ts +54 -13
- package/dist/ai/DecisionModel.d.ts.map +1 -1
- package/dist/ai/DecisionModel.js +123 -12
- package/dist/ai/DecisionModel.js.map +1 -1
- package/dist/ai/McpServer.d.ts +630 -29
- package/dist/ai/McpServer.d.ts.map +1 -1
- package/dist/ai/McpServer.js +562 -116
- package/dist/ai/McpServer.js.map +1 -1
- package/dist/ai/McpTest.d.ts +130 -0
- package/dist/ai/McpTest.d.ts.map +1 -0
- package/dist/ai/McpTest.js +237 -0
- package/dist/ai/McpTest.js.map +1 -0
- package/dist/ai/Response.d.ts +1 -25
- package/dist/ai/Response.d.ts.map +1 -1
- package/dist/ai/Response.js +1 -10
- package/dist/ai/Response.js.map +1 -1
- package/dist/ai/Tool.d.ts +19 -1
- package/dist/ai/Tool.d.ts.map +1 -1
- package/dist/ai/Tool.js.map +1 -1
- package/dist/ai/index.d.ts +5 -0
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +5 -0
- package/dist/ai/index.js.map +1 -1
- package/dist/ai/internal/mcpCore.js +17 -12
- package/dist/ai/internal/mcpCore.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2024_11_05.js +4 -5
- package/dist/ai/internal/mcpProtocol/v2024_11_05.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_03_26.js +4 -5
- package/dist/ai/internal/mcpProtocol/v2025_03_26.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_06_18.js +4 -5
- package/dist/ai/internal/mcpProtocol/v2025_06_18.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_11_25.js +4 -5
- package/dist/ai/internal/mcpProtocol/v2025_11_25.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2026_07_28.js +18 -10
- package/dist/ai/internal/mcpProtocol/v2026_07_28.js.map +1 -1
- package/dist/ai/internal/mcpProtocol.js +13 -0
- package/dist/ai/internal/mcpProtocol.js.map +1 -1
- package/dist/ai/internal/mcpRuntime.js +5 -3
- package/dist/ai/internal/mcpRuntime.js.map +1 -1
- package/dist/ai/internal/mcpStatefulRuntime.js +6 -1
- package/dist/ai/internal/mcpStatefulRuntime.js.map +1 -1
- package/dist/cli/Argument.d.ts +6 -0
- package/dist/cli/Argument.d.ts.map +1 -1
- package/dist/cli/Argument.js +2 -0
- package/dist/cli/Argument.js.map +1 -1
- package/dist/cli/CliOutput.d.ts +65 -1
- package/dist/cli/CliOutput.d.ts.map +1 -1
- package/dist/cli/CliOutput.js +94 -37
- package/dist/cli/CliOutput.js.map +1 -1
- package/dist/cli/Command.d.ts +23 -0
- package/dist/cli/Command.d.ts.map +1 -1
- package/dist/cli/Command.js +8 -0
- package/dist/cli/Command.js.map +1 -1
- package/dist/cli/Flag.d.ts +107 -0
- package/dist/cli/Flag.d.ts.map +1 -1
- package/dist/cli/Flag.js +37 -0
- package/dist/cli/Flag.js.map +1 -1
- package/dist/cli/HelpDoc.d.ts +15 -1
- package/dist/cli/HelpDoc.d.ts.map +1 -1
- package/dist/cli/Param.d.ts +6 -0
- package/dist/cli/Param.d.ts.map +1 -1
- package/dist/cli/Param.js +2 -0
- package/dist/cli/Param.js.map +1 -1
- package/dist/cli/Primitive.d.ts +14 -0
- package/dist/cli/Primitive.d.ts.map +1 -1
- package/dist/cli/Primitive.js +15 -1
- package/dist/cli/Primitive.js.map +1 -1
- package/dist/cli/Prompt.d.ts +1 -0
- package/dist/cli/Prompt.d.ts.map +1 -1
- package/dist/cli/Prompt.js +1 -0
- package/dist/cli/Prompt.js.map +1 -1
- package/dist/cli/internal/help.d.ts.map +1 -1
- package/dist/cli/internal/help.js +17 -10
- package/dist/cli/internal/help.js.map +1 -1
- package/dist/cluster/Sharding.d.ts.map +1 -1
- package/dist/cluster/Sharding.js +90 -28
- package/dist/cluster/Sharding.js.map +1 -1
- package/dist/cluster/ShardingConfig.d.ts +72 -6
- package/dist/cluster/ShardingConfig.d.ts.map +1 -1
- package/dist/cluster/ShardingConfig.js +4 -0
- package/dist/cluster/ShardingConfig.js.map +1 -1
- package/dist/cluster/SingleRunner.d.ts +3 -3
- package/dist/cluster/SingleRunner.d.ts.map +1 -1
- package/dist/cluster/SingleRunner.js +1 -1
- package/dist/cluster/SqlMessageStorage.d.ts +37 -6
- package/dist/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/cluster/SqlMessageStorage.js +34 -7
- package/dist/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/cluster/SqlRunnerStorage.d.ts.map +1 -1
- package/dist/cluster/SqlRunnerStorage.js +23 -8
- package/dist/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/crypto/Aead.d.ts +322 -0
- package/dist/crypto/Aead.d.ts.map +1 -0
- package/dist/crypto/Aead.js +331 -0
- package/dist/crypto/Aead.js.map +1 -0
- package/dist/crypto/Cipher.d.ts +235 -0
- package/dist/crypto/Cipher.d.ts.map +1 -0
- package/dist/crypto/Cipher.js +233 -0
- package/dist/crypto/Cipher.js.map +1 -0
- package/dist/crypto/CryptoError.d.ts +212 -0
- package/dist/crypto/CryptoError.d.ts.map +1 -0
- package/dist/crypto/CryptoError.js +202 -0
- package/dist/crypto/CryptoError.js.map +1 -0
- package/dist/crypto/Digest.d.ts +143 -0
- package/dist/crypto/Digest.d.ts.map +1 -0
- package/dist/crypto/Digest.js +146 -0
- package/dist/crypto/Digest.js.map +1 -0
- package/dist/crypto/Kdf.d.ts +220 -0
- package/dist/crypto/Kdf.d.ts.map +1 -0
- package/dist/crypto/Kdf.js +212 -0
- package/dist/crypto/Kdf.js.map +1 -0
- package/dist/crypto/KeyAgreement.d.ts +323 -0
- package/dist/crypto/KeyAgreement.d.ts.map +1 -0
- package/dist/crypto/KeyAgreement.js +303 -0
- package/dist/crypto/KeyAgreement.js.map +1 -0
- package/dist/crypto/KeyFormat.d.ts +309 -0
- package/dist/crypto/KeyFormat.d.ts.map +1 -0
- package/dist/crypto/KeyFormat.js +556 -0
- package/dist/crypto/KeyFormat.js.map +1 -0
- package/dist/crypto/KeyWrap.d.ts +389 -0
- package/dist/crypto/KeyWrap.d.ts.map +1 -0
- package/dist/crypto/KeyWrap.js +381 -0
- package/dist/crypto/KeyWrap.js.map +1 -0
- package/dist/crypto/Mac.d.ts +277 -0
- package/dist/crypto/Mac.d.ts.map +1 -0
- package/dist/crypto/Mac.js +288 -0
- package/dist/crypto/Mac.js.map +1 -0
- package/dist/crypto/SecureRandom.d.ts +340 -0
- package/dist/crypto/SecureRandom.d.ts.map +1 -0
- package/dist/crypto/SecureRandom.js +257 -0
- package/dist/crypto/SecureRandom.js.map +1 -0
- package/dist/crypto/Signature.d.ts +448 -0
- package/dist/crypto/Signature.d.ts.map +1 -0
- package/dist/crypto/Signature.js +484 -0
- package/dist/crypto/Signature.js.map +1 -0
- package/dist/crypto/WebCrypto.d.ts +61 -0
- package/dist/crypto/WebCrypto.d.ts.map +1 -0
- package/dist/crypto/WebCrypto.js +63 -0
- package/dist/crypto/WebCrypto.js.map +1 -0
- package/dist/crypto/index.d.ts +65 -0
- package/dist/crypto/index.d.ts.map +1 -0
- package/dist/crypto/index.js +66 -0
- package/dist/crypto/index.js.map +1 -0
- package/dist/crypto/internal/asymmetric.d.ts +2 -0
- package/dist/crypto/internal/asymmetric.d.ts.map +1 -0
- package/dist/crypto/internal/asymmetric.js +210 -0
- package/dist/crypto/internal/asymmetric.js.map +1 -0
- package/dist/crypto/internal/chacha.d.ts +46 -0
- package/dist/crypto/internal/chacha.d.ts.map +1 -0
- package/dist/crypto/internal/chacha.js +885 -0
- package/dist/crypto/internal/chacha.js.map +1 -0
- package/dist/crypto/internal/der.d.ts +6 -0
- package/dist/crypto/internal/der.d.ts.map +1 -0
- package/dist/crypto/internal/der.js +86 -0
- package/dist/crypto/internal/der.js.map +1 -0
- package/dist/crypto/internal/digest.d.ts +2 -0
- package/dist/crypto/internal/digest.d.ts.map +1 -0
- package/dist/crypto/internal/digest.js +15 -0
- package/dist/crypto/internal/digest.js.map +1 -0
- package/dist/crypto/internal/key.d.ts +2 -0
- package/dist/crypto/internal/key.d.ts.map +1 -0
- package/dist/crypto/internal/key.js +170 -0
- package/dist/crypto/internal/key.js.map +1 -0
- package/dist/crypto/internal/md5.d.ts +39 -0
- package/dist/crypto/internal/md5.d.ts.map +1 -0
- package/dist/crypto/internal/md5.js +179 -0
- package/dist/crypto/internal/md5.js.map +1 -0
- package/dist/crypto/internal/webCrypto.d.ts +2 -0
- package/dist/crypto/internal/webCrypto.d.ts.map +1 -0
- package/dist/crypto/internal/webCrypto.js +111 -0
- package/dist/crypto/internal/webCrypto.js.map +1 -0
- package/dist/encoding/Base64Url.d.ts.map +1 -1
- package/dist/encoding/Base64Url.js +3 -2
- package/dist/encoding/Base64Url.js.map +1 -1
- package/dist/encoding/Csv.d.ts +608 -0
- package/dist/encoding/Csv.d.ts.map +1 -0
- package/dist/encoding/Csv.js +718 -0
- package/dist/encoding/Csv.js.map +1 -0
- package/dist/encoding/Hex.d.ts +3 -2
- package/dist/encoding/Hex.d.ts.map +1 -1
- package/dist/encoding/Hex.js +3 -2
- package/dist/encoding/Hex.js.map +1 -1
- package/dist/encoding/SchemaBinary.d.ts.map +1 -1
- package/dist/encoding/SchemaBinary.js +42 -4
- package/dist/encoding/SchemaBinary.js.map +1 -1
- package/dist/encoding/Toml.d.ts +17 -3
- package/dist/encoding/Toml.d.ts.map +1 -1
- package/dist/encoding/Toml.js +104 -16
- package/dist/encoding/Toml.js.map +1 -1
- package/dist/encoding/Yaml.d.ts +8 -1
- package/dist/encoding/Yaml.d.ts.map +1 -1
- package/dist/encoding/Yaml.js +54 -18
- package/dist/encoding/Yaml.js.map +1 -1
- package/dist/encoding/index.d.ts +5 -0
- package/dist/encoding/index.d.ts.map +1 -1
- package/dist/encoding/index.js +5 -0
- package/dist/encoding/index.js.map +1 -1
- package/dist/eventlog/EventJournal.d.ts.map +1 -1
- package/dist/eventlog/EventJournal.js +6 -3
- package/dist/eventlog/EventJournal.js.map +1 -1
- package/dist/eventlog/EventLog.d.ts +119 -4
- package/dist/eventlog/EventLog.d.ts.map +1 -1
- package/dist/eventlog/EventLog.js +200 -12
- package/dist/eventlog/EventLog.js.map +1 -1
- package/dist/eventlog/EventLogEncryption.d.ts +41 -4
- package/dist/eventlog/EventLogEncryption.d.ts.map +1 -1
- package/dist/eventlog/EventLogEncryption.js +83 -64
- package/dist/eventlog/EventLogEncryption.js.map +1 -1
- package/dist/eventlog/EventLogMessage.d.ts +279 -0
- package/dist/eventlog/EventLogMessage.d.ts.map +1 -1
- package/dist/eventlog/EventLogMessage.js +217 -1
- package/dist/eventlog/EventLogMessage.js.map +1 -1
- package/dist/eventlog/EventLogRemote.d.ts +200 -28
- package/dist/eventlog/EventLogRemote.d.ts.map +1 -1
- package/dist/eventlog/EventLogRemote.js +186 -16
- package/dist/eventlog/EventLogRemote.js.map +1 -1
- package/dist/eventlog/EventLogServer.d.ts +3 -0
- package/dist/eventlog/EventLogServer.d.ts.map +1 -1
- package/dist/eventlog/EventLogServer.js +18 -10
- package/dist/eventlog/EventLogServer.js.map +1 -1
- package/dist/eventlog/EventLogServerEncrypted.d.ts +326 -5
- package/dist/eventlog/EventLogServerEncrypted.d.ts.map +1 -1
- package/dist/eventlog/EventLogServerEncrypted.js +769 -14
- package/dist/eventlog/EventLogServerEncrypted.js.map +1 -1
- package/dist/eventlog/EventLogSessionAuth.d.ts +5 -3
- package/dist/eventlog/EventLogSessionAuth.d.ts.map +1 -1
- package/dist/eventlog/EventLogSessionAuth.js +41 -64
- package/dist/eventlog/EventLogSessionAuth.js.map +1 -1
- package/dist/eventlog/EventRow.d.ts +4 -0
- package/dist/eventlog/EventRow.d.ts.map +1 -1
- package/dist/eventlog/EventRow.js +12 -2
- package/dist/eventlog/EventRow.js.map +1 -1
- package/dist/eventlog/SqlEventJournal.js +2 -2
- package/dist/eventlog/SqlEventJournal.js.map +1 -1
- package/dist/eventlog/SqlEventLogServerEncrypted.d.ts +21 -5
- package/dist/eventlog/SqlEventLogServerEncrypted.d.ts.map +1 -1
- package/dist/eventlog/SqlEventLogServerEncrypted.js +1048 -113
- package/dist/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
- package/dist/eventlog/SqlEventLogServerUnencrypted.js +2 -2
- package/dist/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
- package/dist/eventlog/internal/batches.d.ts +12 -0
- package/dist/eventlog/internal/batches.d.ts.map +1 -0
- package/dist/eventlog/internal/batches.js +26 -0
- package/dist/eventlog/internal/batches.js.map +1 -0
- package/dist/eventlog/internal/compaction.d.ts +38 -0
- package/dist/eventlog/internal/compaction.d.ts.map +1 -0
- package/dist/eventlog/internal/compaction.js +33 -0
- package/dist/eventlog/internal/compaction.js.map +1 -0
- package/dist/eventlog/internal/identityRootSecretDerivation.js +66 -67
- package/dist/eventlog/internal/identityRootSecretDerivation.js.map +1 -1
- package/dist/eventlog/internal/remoteCompaction.d.ts +31 -0
- package/dist/eventlog/internal/remoteCompaction.d.ts.map +1 -0
- package/dist/eventlog/internal/remoteCompaction.js +76 -0
- package/dist/eventlog/internal/remoteCompaction.js.map +1 -0
- package/dist/http/Cookies.d.ts +172 -0
- package/dist/http/Cookies.d.ts.map +1 -1
- package/dist/http/Cookies.js +143 -1
- package/dist/http/Cookies.js.map +1 -1
- package/dist/http/FetchHttpClient.d.ts +26 -2
- package/dist/http/FetchHttpClient.d.ts.map +1 -1
- package/dist/http/FetchHttpClient.js +78 -15
- package/dist/http/FetchHttpClient.js.map +1 -1
- package/dist/http/HttpClient.d.ts +79 -8
- package/dist/http/HttpClient.d.ts.map +1 -1
- package/dist/http/HttpClient.js +65 -5
- package/dist/http/HttpClient.js.map +1 -1
- package/dist/http/HttpClientRequest.d.ts +9 -5
- package/dist/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/http/HttpClientRequest.js +2 -3
- package/dist/http/HttpClientRequest.js.map +1 -1
- package/dist/http/HttpClientResponse.d.ts.map +1 -1
- package/dist/http/HttpClientResponse.js +3 -2
- package/dist/http/HttpClientResponse.js.map +1 -1
- package/dist/http/HttpMethod.d.ts +7 -1
- package/dist/http/HttpMethod.d.ts.map +1 -1
- package/dist/http/HttpMethod.js +3 -8
- package/dist/http/HttpMethod.js.map +1 -1
- package/dist/http/HttpServerRequest.d.ts +5 -2
- package/dist/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/http/HttpServerRequest.js +6 -17
- package/dist/http/HttpServerRequest.js.map +1 -1
- package/dist/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/http/HttpServerResponse.js +3 -2
- package/dist/http/HttpServerResponse.js.map +1 -1
- package/dist/http/HttpTraceContext.d.ts +2 -1
- package/dist/http/HttpTraceContext.d.ts.map +1 -1
- package/dist/http/HttpTraceContext.js +7 -5
- package/dist/http/HttpTraceContext.js.map +1 -1
- package/dist/http/ProblemDetails.d.ts +96 -0
- package/dist/http/ProblemDetails.d.ts.map +1 -0
- package/dist/http/ProblemDetails.js +98 -0
- package/dist/http/ProblemDetails.js.map +1 -0
- package/dist/http/index.d.ts +5 -0
- package/dist/http/index.d.ts.map +1 -1
- package/dist/http/index.js +5 -0
- package/dist/http/index.js.map +1 -1
- package/dist/http/internal/decompression.js +3 -2
- package/dist/http/internal/decompression.js.map +1 -1
- package/dist/http/internal/urlParams.js +8 -0
- package/dist/http/internal/urlParams.js.map +1 -1
- package/dist/http-api/HttpApiBuilder.js +19 -5
- package/dist/http-api/HttpApiBuilder.js.map +1 -1
- package/dist/http-api/HttpApiClient.d.ts +63 -0
- package/dist/http-api/HttpApiClient.d.ts.map +1 -1
- package/dist/http-api/HttpApiClient.js +51 -0
- package/dist/http-api/HttpApiClient.js.map +1 -1
- package/dist/http-api/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/http-api/HttpApiEndpoint.js +14 -5
- package/dist/http-api/HttpApiEndpoint.js.map +1 -1
- package/dist/http-api/HttpApiError.d.ts +185 -13
- package/dist/http-api/HttpApiError.d.ts.map +1 -1
- package/dist/http-api/HttpApiError.js +128 -0
- package/dist/http-api/HttpApiError.js.map +1 -1
- package/dist/http-api/HttpApiMiddleware.d.ts +64 -17
- package/dist/http-api/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/http-api/HttpApiMiddleware.js +85 -1
- package/dist/http-api/HttpApiMiddleware.js.map +1 -1
- package/dist/http-api/HttpApiSchema.d.ts +76 -14
- package/dist/http-api/HttpApiSchema.d.ts.map +1 -1
- package/dist/http-api/HttpApiSchema.js +53 -0
- package/dist/http-api/HttpApiSchema.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/internal/effect.js +25 -14
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/glob.d.ts +2 -0
- package/dist/internal/glob.d.ts.map +1 -0
- package/dist/internal/glob.js +630 -0
- package/dist/internal/glob.js.map +1 -0
- package/dist/internal/matcher.js +10 -0
- package/dist/internal/matcher.js.map +1 -1
- package/dist/internal/persistence.js +9 -0
- package/dist/internal/persistence.js.map +1 -1
- package/dist/internal/rcRef.js +4 -1
- package/dist/internal/rcRef.js.map +1 -1
- package/dist/internal/schema/toCodeDocument.js +6 -3
- package/dist/internal/schema/toCodeDocument.js.map +1 -1
- package/dist/internal/trie.js +42 -13
- package/dist/internal/trie.js.map +1 -1
- package/dist/internal/ulid.js +41 -0
- package/dist/internal/ulid.js.map +1 -1
- package/dist/internal/uuid.js +52 -8
- package/dist/internal/uuid.js.map +1 -1
- package/dist/internal/version.js +1 -1
- package/dist/observability/Otlp.d.ts +15 -4
- package/dist/observability/Otlp.d.ts.map +1 -1
- package/dist/observability/Otlp.js +10 -0
- package/dist/observability/Otlp.js.map +1 -1
- package/dist/observability/OtlpResource.d.ts +7 -0
- package/dist/observability/OtlpResource.d.ts.map +1 -1
- package/dist/observability/OtlpResource.js +11 -1
- package/dist/observability/OtlpResource.js.map +1 -1
- package/dist/persistence/KeyValueStore.d.ts +47 -2
- package/dist/persistence/KeyValueStore.d.ts.map +1 -1
- package/dist/persistence/KeyValueStore.js +129 -18
- package/dist/persistence/KeyValueStore.js.map +1 -1
- package/dist/persistence/PersistedQueue.d.ts +9 -0
- package/dist/persistence/PersistedQueue.d.ts.map +1 -1
- package/dist/persistence/PersistedQueue.js +94 -52
- package/dist/persistence/PersistedQueue.js.map +1 -1
- package/dist/persistence/Persistence.d.ts +10 -4
- package/dist/persistence/Persistence.d.ts.map +1 -1
- package/dist/persistence/Persistence.js +18 -11
- package/dist/persistence/Persistence.js.map +1 -1
- package/dist/process/ChildProcess.d.ts +207 -67
- package/dist/process/ChildProcess.d.ts.map +1 -1
- package/dist/process/ChildProcess.js +56 -158
- package/dist/process/ChildProcess.js.map +1 -1
- package/dist/process/ChildProcessSpawner.d.ts +5 -0
- package/dist/process/ChildProcessSpawner.d.ts.map +1 -1
- package/dist/process/ChildProcessSpawner.js.map +1 -1
- package/dist/process/CommandLine.d.ts +294 -0
- package/dist/process/CommandLine.d.ts.map +1 -0
- package/dist/process/CommandLine.js +481 -0
- package/dist/process/CommandLine.js.map +1 -0
- package/dist/process/index.d.ts +5 -0
- package/dist/process/index.d.ts.map +1 -1
- package/dist/process/index.js +5 -0
- package/dist/process/index.js.map +1 -1
- package/dist/reactivity/Atom.d.ts +2 -1
- package/dist/reactivity/Atom.d.ts.map +1 -1
- package/dist/reactivity/Atom.js +3 -4
- package/dist/reactivity/Atom.js.map +1 -1
- package/dist/reactivity/AtomRegistry.js.map +1 -1
- package/dist/rpc/RpcClient.d.ts +16 -1
- package/dist/rpc/RpcClient.d.ts.map +1 -1
- package/dist/rpc/RpcClient.js +50 -16
- package/dist/rpc/RpcClient.js.map +1 -1
- package/dist/rpc/RpcMessage.d.ts +10 -1
- package/dist/rpc/RpcMessage.d.ts.map +1 -1
- package/dist/rpc/RpcMessage.js +1 -0
- package/dist/rpc/RpcMessage.js.map +1 -1
- package/dist/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/rpc/RpcSerialization.js +6 -0
- package/dist/rpc/RpcSerialization.js.map +1 -1
- package/dist/rpc/RpcServer.d.ts +31 -0
- package/dist/rpc/RpcServer.d.ts.map +1 -1
- package/dist/rpc/RpcServer.js +139 -66
- package/dist/rpc/RpcServer.js.map +1 -1
- package/dist/schema/Model.d.ts +14 -0
- package/dist/schema/Model.d.ts.map +1 -1
- package/dist/schema/Model.js +18 -3
- package/dist/schema/Model.js.map +1 -1
- package/dist/sql/Migrator.d.ts +0 -19
- package/dist/sql/Migrator.d.ts.map +1 -1
- package/dist/sql/Migrator.js +3 -48
- package/dist/sql/Migrator.js.map +1 -1
- package/dist/sql/MigratorFileSystem.d.ts +21 -0
- package/dist/sql/MigratorFileSystem.d.ts.map +1 -0
- package/dist/sql/MigratorFileSystem.js +57 -0
- package/dist/sql/MigratorFileSystem.js.map +1 -0
- package/dist/sql/SqlClient.d.ts.map +1 -1
- package/dist/sql/SqlClient.js +5 -9
- package/dist/sql/SqlClient.js.map +1 -1
- package/dist/sql/Statement.d.ts +20 -6
- package/dist/sql/Statement.d.ts.map +1 -1
- package/dist/sql/Statement.js +0 -13
- package/dist/sql/Statement.js.map +1 -1
- package/dist/sql/index.js +1 -1
- package/dist/testing/index.d.ts +0 -5
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +0 -5
- package/dist/testing/index.js.map +1 -1
- package/dist/workflow/internal/crypto.js +9 -8
- package/dist/workflow/internal/crypto.js.map +1 -1
- package/package.json +3 -1
- package/src/BigDecimal.ts +3 -0
- package/src/Channel.ts +17 -11
- package/src/Config.ts +7 -1
- package/src/Context.ts +34 -10
- package/src/Cron.ts +178 -29
- package/src/Duration.ts +140 -0
- package/src/Effect.ts +914 -85
- package/src/FileSystem.ts +65 -4
- package/src/Glob.ts +205 -0
- package/src/Match.ts +127 -0
- package/src/Pool.ts +73 -15
- package/src/Random.ts +3 -3
- package/src/RcMap.ts +5 -1
- package/src/Schedule.ts +26 -3
- package/src/Schema.ts +1189 -62
- package/src/SchemaGetter.ts +27 -11
- package/src/SchemaRepresentation.ts +19 -0
- package/src/SchemaTransformation.ts +8 -3
- package/src/ScopedCache.ts +5 -9
- package/src/Semaphore.ts +141 -0
- package/src/Stream.ts +15 -6
- package/src/Terminal.ts +19 -1
- package/src/ai/AiError.ts +56 -80
- package/src/ai/Decision.ts +257 -6
- package/src/ai/DecisionModel.ts +171 -28
- package/src/ai/McpServer.ts +1269 -286
- package/src/ai/McpTest.ts +380 -0
- package/src/ai/Response.ts +2 -22
- package/src/ai/Tool.ts +27 -8
- package/src/ai/index.ts +6 -0
- package/src/ai/internal/mcpCore.ts +78 -44
- package/src/ai/internal/mcpProtocol/v2024_11_05.ts +4 -7
- package/src/ai/internal/mcpProtocol/v2025_03_26.ts +4 -7
- package/src/ai/internal/mcpProtocol/v2025_06_18.ts +4 -7
- package/src/ai/internal/mcpProtocol/v2025_11_25.ts +4 -7
- package/src/ai/internal/mcpProtocol/v2026_07_28.ts +15 -10
- package/src/ai/internal/mcpProtocol.ts +29 -0
- package/src/ai/internal/mcpRuntime.ts +9 -5
- package/src/ai/internal/mcpStatefulRuntime.ts +14 -2
- package/src/cli/Argument.ts +6 -0
- package/src/cli/CliOutput.ts +117 -49
- package/src/cli/Command.ts +23 -0
- package/src/cli/Flag.ts +107 -0
- package/src/cli/HelpDoc.ts +18 -1
- package/src/cli/Param.ts +6 -0
- package/src/cli/Primitive.ts +16 -1
- package/src/cli/Prompt.ts +1 -0
- package/src/cli/internal/help.ts +21 -9
- package/src/cluster/Sharding.ts +93 -26
- package/src/cluster/ShardingConfig.ts +41 -3
- package/src/cluster/SingleRunner.ts +3 -3
- package/src/cluster/SqlMessageStorage.ts +49 -17
- package/src/cluster/SqlRunnerStorage.ts +37 -27
- package/src/crypto/Aead.ts +517 -0
- package/src/crypto/Cipher.ts +326 -0
- package/src/crypto/CryptoError.ts +242 -0
- package/src/crypto/Digest.ts +167 -0
- package/src/crypto/Kdf.ts +315 -0
- package/src/crypto/KeyAgreement.ts +489 -0
- package/src/crypto/KeyFormat.ts +712 -0
- package/src/crypto/KeyWrap.ts +639 -0
- package/src/crypto/Mac.ts +386 -0
- package/src/crypto/SecureRandom.ts +459 -0
- package/src/crypto/Signature.ts +673 -0
- package/src/crypto/WebCrypto.ts +64 -0
- package/src/crypto/index.ts +78 -0
- package/src/crypto/internal/asymmetric.ts +329 -0
- package/src/crypto/internal/chacha.ts +1088 -0
- package/src/crypto/internal/der.ts +110 -0
- package/src/crypto/internal/digest.ts +16 -0
- package/src/crypto/internal/key.ts +235 -0
- package/src/crypto/internal/md5.ts +170 -0
- package/src/crypto/internal/webCrypto.ts +150 -0
- package/src/encoding/Base64Url.ts +5 -2
- package/src/encoding/Csv.ts +1298 -0
- package/src/encoding/Hex.ts +3 -2
- package/src/encoding/SchemaBinary.ts +40 -4
- package/src/encoding/Toml.ts +85 -20
- package/src/encoding/Yaml.ts +61 -18
- package/src/encoding/index.ts +6 -0
- package/src/eventlog/EventJournal.ts +4 -3
- package/src/eventlog/EventLog.ts +340 -15
- package/src/eventlog/EventLogEncryption.ts +118 -110
- package/src/eventlog/EventLogMessage.ts +273 -1
- package/src/eventlog/EventLogRemote.ts +367 -23
- package/src/eventlog/EventLogServer.ts +23 -8
- package/src/eventlog/EventLogServerEncrypted.ts +1130 -67
- package/src/eventlog/EventLogSessionAuth.ts +56 -70
- package/src/eventlog/EventRow.ts +12 -3
- package/src/eventlog/SqlEventJournal.ts +2 -2
- package/src/eventlog/SqlEventLogServerEncrypted.ts +1244 -136
- package/src/eventlog/SqlEventLogServerUnencrypted.ts +2 -2
- package/src/eventlog/internal/batches.ts +30 -0
- package/src/eventlog/internal/compaction.ts +64 -0
- package/src/eventlog/internal/identityRootSecretDerivation.ts +93 -123
- package/src/eventlog/internal/remoteCompaction.ts +92 -0
- package/src/http/Cookies.ts +281 -1
- package/src/http/FetchHttpClient.ts +88 -16
- package/src/http/HttpClient.ts +89 -22
- package/src/http/HttpClientRequest.ts +12 -9
- package/src/http/HttpClientResponse.ts +3 -2
- package/src/http/HttpMethod.ts +10 -2
- package/src/http/HttpServerRequest.ts +15 -30
- package/src/http/HttpServerResponse.ts +3 -2
- package/src/http/HttpTraceContext.ts +7 -4
- package/src/http/ProblemDetails.ts +149 -0
- package/src/http/index.ts +6 -0
- package/src/http/internal/decompression.ts +4 -4
- package/src/http/internal/urlParams.ts +8 -0
- package/src/http-api/HttpApiBuilder.ts +24 -12
- package/src/http-api/HttpApiClient.ts +67 -1
- package/src/http-api/HttpApiEndpoint.ts +14 -5
- package/src/http-api/HttpApiError.ts +250 -0
- package/src/http-api/HttpApiMiddleware.ts +95 -1
- package/src/http-api/HttpApiSchema.ts +105 -14
- package/src/index.ts +6 -6
- package/src/internal/effect.ts +34 -18
- package/src/internal/glob.ts +736 -0
- package/src/internal/matcher.ts +17 -0
- package/src/internal/persistence.ts +11 -0
- package/src/internal/rcRef.ts +4 -1
- package/src/internal/schema/toCodeDocument.ts +7 -3
- package/src/internal/trie.ts +43 -14
- package/src/internal/ulid.ts +44 -0
- package/src/internal/uuid.ts +57 -16
- package/src/internal/version.ts +1 -1
- package/src/observability/Otlp.ts +21 -4
- package/src/observability/OtlpResource.ts +9 -1
- package/src/persistence/KeyValueStore.ts +219 -22
- package/src/persistence/PersistedQueue.ts +128 -59
- package/src/persistence/Persistence.ts +20 -13
- package/src/process/ChildProcess.ts +255 -260
- package/src/process/ChildProcessSpawner.ts +5 -0
- package/src/process/CommandLine.ts +630 -0
- package/src/process/index.ts +6 -0
- package/src/reactivity/Atom.ts +5 -5
- package/src/reactivity/AtomRegistry.ts +1 -1
- package/src/rpc/RpcClient.ts +62 -26
- package/src/rpc/RpcMessage.ts +10 -1
- package/src/rpc/RpcSerialization.ts +3 -0
- package/src/rpc/RpcServer.ts +176 -78
- package/src/schema/Model.ts +26 -3
- package/src/sql/Migrator.ts +4 -63
- package/src/sql/MigratorFileSystem.ts +71 -0
- package/src/sql/SqlClient.ts +2 -16
- package/src/sql/Statement.ts +8 -7
- package/src/sql/index.ts +1 -1
- package/src/testing/index.ts +0 -6
- package/src/workflow/internal/crypto.ts +15 -11
- package/dist/Crypto.d.ts +0 -244
- package/dist/Crypto.d.ts.map +0 -1
- package/dist/Crypto.js +0 -139
- package/dist/Crypto.js.map +0 -1
- package/dist/testing/TestCrypto.d.ts +0 -73
- package/dist/testing/TestCrypto.d.ts.map +0 -1
- package/dist/testing/TestCrypto.js +0 -87
- package/dist/testing/TestCrypto.js.map +0 -1
- package/src/Crypto.ts +0 -347
- package/src/testing/TestCrypto.ts +0 -94
package/dist/ai/McpServer.d.ts
CHANGED
|
@@ -14,8 +14,11 @@
|
|
|
14
14
|
import * as Arr from "../Array.ts";
|
|
15
15
|
import * as Cause from "../Cause.ts";
|
|
16
16
|
import * as Context from "../Context.ts";
|
|
17
|
+
import * as Duration from "../Duration.ts";
|
|
17
18
|
import * as Effect from "../Effect.ts";
|
|
19
|
+
import * as Headers from "../http/Headers.ts";
|
|
18
20
|
import * as HttpRouter from "../http/HttpRouter.ts";
|
|
21
|
+
import * as HttpServerRequest from "../http/HttpServerRequest.ts";
|
|
19
22
|
import * as Layer from "../Layer.ts";
|
|
20
23
|
import * as RpcClient from "../rpc/RpcClient.ts";
|
|
21
24
|
import type * as RpcGroup from "../rpc/RpcGroup.ts";
|
|
@@ -23,6 +26,7 @@ import * as RpcServer from "../rpc/RpcServer.ts";
|
|
|
23
26
|
import * as Schema from "../Schema.ts";
|
|
24
27
|
import * as Scope from "../Scope.ts";
|
|
25
28
|
import type { Stdio } from "../Stdio.ts";
|
|
29
|
+
import type * as Types from "../Types.ts";
|
|
26
30
|
import type * as McpProtocol from "./McpProtocol.ts";
|
|
27
31
|
import * as McpSchema from "./McpSchema.ts";
|
|
28
32
|
import { CallToolResult, ElicitationDeclined, GetPromptResult, InternalError, InvalidParams, McpRequestContext, McpServerClient, Prompt, Resource, ResourceTemplate, Tool as McpTool } from "./McpSchema.ts";
|
|
@@ -32,6 +36,369 @@ import * as Toolkit from "./Toolkit.ts";
|
|
|
32
36
|
type CompletionContext = typeof Complete.payloadSchema.Type["context"];
|
|
33
37
|
type ServerExtensions = NonNullable<ServerCapabilities["extensions"]>;
|
|
34
38
|
declare const BroadcastServerNotificationRpcs: RpcGroup.RpcGroup<typeof McpSchema.CancelledNotification | typeof McpSchema.ProgressNotification | typeof McpSchema.ResourceListChangedNotification | typeof McpSchema.ResourceUpdatedNotification | typeof McpSchema.PromptListChangedNotification | typeof McpSchema.ToolListChangedNotification | typeof McpSchema.LoggingMessageNotification>;
|
|
39
|
+
/**
|
|
40
|
+
* Marks a request-level dependency of an MCP registration or middleware.
|
|
41
|
+
*
|
|
42
|
+
* **Details**
|
|
43
|
+
*
|
|
44
|
+
* Registrations carry handler dependencies as `McpRequest<"Requires", S>`.
|
|
45
|
+
* MCP middleware and transports discharge these markers; providing `S` with
|
|
46
|
+
* `Layer.provide` or `Effect.provide` does not.
|
|
47
|
+
*
|
|
48
|
+
* `layerHttp` and `layerHttpRequestScoped` convert the markers they don't
|
|
49
|
+
* discharge into `HttpRouter.Request` markers, so `HttpRouter.middleware` can
|
|
50
|
+
* satisfy them. On stdio and custom transports an undischarged marker is a
|
|
51
|
+
* compile error.
|
|
52
|
+
*
|
|
53
|
+
* @see {@link middleware} for discharging request-level dependencies
|
|
54
|
+
*
|
|
55
|
+
* @stability unstable
|
|
56
|
+
* @category utility types
|
|
57
|
+
* @since 4.0.0
|
|
58
|
+
*/
|
|
59
|
+
export interface McpRequest<Kind extends string, T> {
|
|
60
|
+
readonly _: unique symbol;
|
|
61
|
+
readonly kind: Kind;
|
|
62
|
+
readonly type: T;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Helper types for `McpRequest` markers.
|
|
66
|
+
*
|
|
67
|
+
* @stability unstable
|
|
68
|
+
* @category utility types
|
|
69
|
+
* @since 4.0.0
|
|
70
|
+
*/
|
|
71
|
+
export declare namespace McpRequest {
|
|
72
|
+
/**
|
|
73
|
+
* Wraps each member of a union in an `McpRequest` marker of the supplied kind.
|
|
74
|
+
*
|
|
75
|
+
* @stability unstable
|
|
76
|
+
* @category utility types
|
|
77
|
+
* @since 4.0.0
|
|
78
|
+
*/
|
|
79
|
+
type From<Kind extends string, R> = R extends infer T ? McpRequest<Kind, T> : never;
|
|
80
|
+
/**
|
|
81
|
+
* Extracts the services from `McpRequest` markers of the supplied kind.
|
|
82
|
+
*
|
|
83
|
+
* @stability unstable
|
|
84
|
+
* @category utility types
|
|
85
|
+
* @since 4.0.0
|
|
86
|
+
*/
|
|
87
|
+
type Only<Kind extends string, A> = A extends McpRequest<Kind, infer T> ? T : never;
|
|
88
|
+
/**
|
|
89
|
+
* Removes `McpRequest` markers from a union.
|
|
90
|
+
*
|
|
91
|
+
* @stability unstable
|
|
92
|
+
* @category utility types
|
|
93
|
+
* @since 4.0.0
|
|
94
|
+
*/
|
|
95
|
+
type Without<A> = A extends McpRequest<infer _Kind, infer _> ? never : A;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Opaque handler result. Middleware can wrap execution and provide services,
|
|
99
|
+
* but cannot inspect or replace the result.
|
|
100
|
+
*
|
|
101
|
+
* @stability unstable
|
|
102
|
+
* @category middleware
|
|
103
|
+
* @since 4.0.0
|
|
104
|
+
*/
|
|
105
|
+
export interface MiddlewareSuccess {
|
|
106
|
+
readonly _: unique symbol;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* The request methods that run MCP middleware. More methods may be added, so
|
|
110
|
+
* don't `switch` on it exhaustively without a default case.
|
|
111
|
+
*
|
|
112
|
+
* @stability unstable
|
|
113
|
+
* @category middleware
|
|
114
|
+
* @since 4.0.0
|
|
115
|
+
*/
|
|
116
|
+
export type MiddlewareMethod = "tools/call" | "resources/read" | "prompts/get" | "completion/complete" | "tools/list" | "resources/list" | "resources/templates/list" | "prompts/list";
|
|
117
|
+
/**
|
|
118
|
+
* Request metadata passed to MCP middleware.
|
|
119
|
+
*
|
|
120
|
+
* **Details**
|
|
121
|
+
*
|
|
122
|
+
* `target` is the tool name, the requested resource URI, or the prompt name.
|
|
123
|
+
* For `completion/complete` it is the prompt name, or the URI template of the
|
|
124
|
+
* resource template being completed. `payload` holds the request parameters.
|
|
125
|
+
*
|
|
126
|
+
* On list requests, middleware runs only when it wraps a {@link visibility},
|
|
127
|
+
* once for each registration it wraps. `target` is then the tool name, the
|
|
128
|
+
* resource URI, the URI template or the prompt name of that registration, and
|
|
129
|
+
* `payload` is `undefined`.
|
|
130
|
+
*
|
|
131
|
+
* `headers` are the HTTP request headers. They are empty on stdio, on custom
|
|
132
|
+
* transports and for in-process calls. `sessionId` is the `Mcp-Session-Id`
|
|
133
|
+
* header, so it is `undefined` outside sessionful HTTP.
|
|
134
|
+
*
|
|
135
|
+
* @stability unstable
|
|
136
|
+
* @category middleware
|
|
137
|
+
* @since 4.0.0
|
|
138
|
+
*/
|
|
139
|
+
export interface MiddlewareOptions {
|
|
140
|
+
readonly method: MiddlewareMethod;
|
|
141
|
+
readonly target: string;
|
|
142
|
+
readonly payload: unknown;
|
|
143
|
+
readonly requestContext: McpRequestContext["Service"];
|
|
144
|
+
readonly headers: Headers.Headers;
|
|
145
|
+
readonly sessionId: string | undefined;
|
|
146
|
+
}
|
|
147
|
+
declare const MiddlewareTypeId = "~effect/ai/McpServer/Middleware";
|
|
148
|
+
type MiddlewareConfig = {
|
|
149
|
+
provides: any;
|
|
150
|
+
error: McpErrorBase;
|
|
151
|
+
requires: any;
|
|
152
|
+
layerError: any;
|
|
153
|
+
layerRequires: any;
|
|
154
|
+
};
|
|
155
|
+
type MiddlewareLayer<Config extends MiddlewareConfig, R> = Layer.Layer<McpRequest.From<"Requires", Config["provides"]>, Config["layerError"], R | Config["layerRequires"] | McpRequest.From<"Requires", Config["requires"]>>;
|
|
156
|
+
/**
|
|
157
|
+
* Composable MCP middleware.
|
|
158
|
+
*
|
|
159
|
+
* **Details**
|
|
160
|
+
*
|
|
161
|
+
* Provide `layer` to registration layers, or to the Effect form of a
|
|
162
|
+
* registration, to run the middleware for those registrations. Use
|
|
163
|
+
* `layerGlobal` to run it for every request on the server.
|
|
164
|
+
*
|
|
165
|
+
* Services the middleware reads per request are `McpRequest<"Requires", S>`
|
|
166
|
+
* requirements of `layer` and `layerGlobal`, like the request-level
|
|
167
|
+
* dependencies of a registration. A middleware that provides `S` meets them
|
|
168
|
+
* when it runs outside this one: `a.combine(b)` runs `b` outside `a`, and so
|
|
169
|
+
* does providing `b.layer` or `b.layerGlobal` outside `a.layer`, though
|
|
170
|
+
* `layerGlobal` installs `b` for the whole server. The transport discharges
|
|
171
|
+
* the services it supplies, and `layerHttp` turns the rest into
|
|
172
|
+
* `HttpRouter.Request` requirements that an `HttpRouter.middleware` can meet.
|
|
173
|
+
*
|
|
174
|
+
* @see {@link middleware} for creating MCP middleware
|
|
175
|
+
*
|
|
176
|
+
* @stability unstable
|
|
177
|
+
* @category middleware
|
|
178
|
+
* @since 4.0.0
|
|
179
|
+
*/
|
|
180
|
+
export interface Middleware<Config extends MiddlewareConfig> {
|
|
181
|
+
readonly [MiddlewareTypeId]: Config;
|
|
182
|
+
readonly layer: MiddlewareLayer<Config, never>;
|
|
183
|
+
readonly layerGlobal: MiddlewareLayer<Config, McpServer>;
|
|
184
|
+
readonly combine: <Config2 extends MiddlewareConfig>(other: Middleware<Config2>) => Middleware<{
|
|
185
|
+
provides: Config2["provides"] | Config["provides"];
|
|
186
|
+
error: Config2["error"] | Config["error"];
|
|
187
|
+
requires: Exclude<Config["requires"], Config2["provides"]> | Config2["requires"];
|
|
188
|
+
layerError: Config["layerError"] | Config2["layerError"];
|
|
189
|
+
layerRequires: Config["layerRequires"] | Config2["layerRequires"];
|
|
190
|
+
}>;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Creates MCP middleware that runs around `tools/call`, `resources/read`,
|
|
194
|
+
* `prompts/get` and `completion/complete` requests.
|
|
195
|
+
*
|
|
196
|
+
* **Details**
|
|
197
|
+
*
|
|
198
|
+
* Middleware is how request-level dependencies are satisfied: declare the
|
|
199
|
+
* services it provides with `middleware<{ provides: S }>()` and provide them to
|
|
200
|
+
* the handler effect. It receives the request headers, session id and request
|
|
201
|
+
* context, so it can resolve the current user per request.
|
|
202
|
+
*
|
|
203
|
+
* Pass a function, or an Effect that builds the function. Services the Effect
|
|
204
|
+
* reads are requirements of the middleware layer. Services the function reads
|
|
205
|
+
* per request, other than `McpRequestContext`, are per-request requirements
|
|
206
|
+
* of the result; see {@link Middleware} for how they are met.
|
|
207
|
+
*
|
|
208
|
+
* Failures must be `McpErrorBase` values. A middleware failure is sent as a
|
|
209
|
+
* JSON-RPC error with its `code`, `message` and `data`, never as a tool
|
|
210
|
+
* result. Pick custom codes from the implementation-defined range
|
|
211
|
+
* (-32000 to -32019): any numeric `code` is sent as is. Defects are logged,
|
|
212
|
+
* reported to the `ErrorReporter` and sent as `InternalError("Internal error")`.
|
|
213
|
+
* Interruption propagates.
|
|
214
|
+
*
|
|
215
|
+
* Local middleware runs inside global middleware, and middleware provided both
|
|
216
|
+
* locally and globally runs once. Middleware never runs for `initialize`. It
|
|
217
|
+
* runs for list requests only when it wraps a {@link visibility}, so that the
|
|
218
|
+
* visibility check can read the services it provides.
|
|
219
|
+
*
|
|
220
|
+
* **Example** (Resolving the current user per request)
|
|
221
|
+
*
|
|
222
|
+
* ```ts
|
|
223
|
+
* import { Context, Effect, Layer, Schema } from "effect"
|
|
224
|
+
* import { McpSchema, McpServer, Tool, Toolkit } from "effect/ai"
|
|
225
|
+
*
|
|
226
|
+
* class CurrentUser extends Context.Service<CurrentUser, { readonly id: string }>()("CurrentUser") {}
|
|
227
|
+
*
|
|
228
|
+
* class Unauthorized extends Schema.Error<Unauthorized>("Unauthorized")({
|
|
229
|
+
* ...McpSchema.McpErrorBase.fields,
|
|
230
|
+
* _tag: Schema.tag("Unauthorized"),
|
|
231
|
+
* code: Schema.tag(-32001)
|
|
232
|
+
* }) {}
|
|
233
|
+
*
|
|
234
|
+
* const WhoAmI = Tool.make("WhoAmI", { success: Schema.String, dependencies: [CurrentUser] })
|
|
235
|
+
* const Tools = Toolkit.make(WhoAmI)
|
|
236
|
+
*
|
|
237
|
+
* const Auth = McpServer.middleware<{ provides: CurrentUser }>()((effect, { headers }) => {
|
|
238
|
+
* const token = headers["authorization"]
|
|
239
|
+
* return token === undefined
|
|
240
|
+
* ? Effect.fail(new Unauthorized({ message: "Missing credentials" }))
|
|
241
|
+
* : Effect.provideService(effect, CurrentUser, { id: token })
|
|
242
|
+
* })
|
|
243
|
+
*
|
|
244
|
+
* const Registrations = McpServer.toolkit(Tools).pipe(
|
|
245
|
+
* Layer.provide(Auth.layer),
|
|
246
|
+
* Layer.provide(Tools.toLayer({
|
|
247
|
+
* WhoAmI: () => Effect.map(CurrentUser, (user) => user.id)
|
|
248
|
+
* }))
|
|
249
|
+
* )
|
|
250
|
+
* ```
|
|
251
|
+
*
|
|
252
|
+
* @stability unstable
|
|
253
|
+
* @category middleware
|
|
254
|
+
* @since 4.0.0
|
|
255
|
+
*/
|
|
256
|
+
export declare const middleware: middleware.Make<never> & (<Config extends {
|
|
257
|
+
provides?: any;
|
|
258
|
+
} = {}>() => middleware.Make<Config extends {
|
|
259
|
+
provides: infer P;
|
|
260
|
+
} ? P : never>);
|
|
261
|
+
/**
|
|
262
|
+
* Types used by `middleware`.
|
|
263
|
+
*
|
|
264
|
+
* @stability unstable
|
|
265
|
+
* @category middleware
|
|
266
|
+
* @since 4.0.0
|
|
267
|
+
*/
|
|
268
|
+
export declare namespace middleware {
|
|
269
|
+
/**
|
|
270
|
+
* The middleware function.
|
|
271
|
+
*
|
|
272
|
+
* @stability unstable
|
|
273
|
+
* @category middleware
|
|
274
|
+
* @since 4.0.0
|
|
275
|
+
*/
|
|
276
|
+
type Fn<Provides, E, R> = (effect: Effect.Effect<MiddlewareSuccess, McpErrorBase, Types.NoInfer<Provides>>, options: MiddlewareOptions) => Effect.Effect<MiddlewareSuccess, E, R>;
|
|
277
|
+
/**
|
|
278
|
+
* The overloads of a middleware constructor.
|
|
279
|
+
*
|
|
280
|
+
* @stability unstable
|
|
281
|
+
* @category middleware
|
|
282
|
+
* @since 4.0.0
|
|
283
|
+
*/
|
|
284
|
+
type Make<Provides> = {
|
|
285
|
+
<E extends McpErrorBase, R, EX, RX, const Global extends boolean = false>(middleware: Effect.Effect<Fn<Provides, E, R>, EX, RX>, options?: {
|
|
286
|
+
readonly global?: Global | undefined;
|
|
287
|
+
}): Made<Global, {
|
|
288
|
+
provides: Provides;
|
|
289
|
+
error: E;
|
|
290
|
+
requires: Exclude<R, McpRequestContext>;
|
|
291
|
+
layerError: EX;
|
|
292
|
+
layerRequires: Exclude<RX, Scope.Scope>;
|
|
293
|
+
}>;
|
|
294
|
+
<E extends McpErrorBase, R, const Global extends boolean = false>(middleware: Fn<Provides, E, R>, options?: {
|
|
295
|
+
readonly global?: Global | undefined;
|
|
296
|
+
}): Made<Global, {
|
|
297
|
+
provides: Provides;
|
|
298
|
+
error: E;
|
|
299
|
+
requires: Exclude<R, McpRequestContext>;
|
|
300
|
+
layerError: never;
|
|
301
|
+
layerRequires: never;
|
|
302
|
+
}>;
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Creates middleware that hides registrations per request.
|
|
307
|
+
*
|
|
308
|
+
* **Details**
|
|
309
|
+
*
|
|
310
|
+
* The check runs for every registration the middleware is provided to, on list
|
|
311
|
+
* requests and on calls, reads, gets and completions. When it returns `false`
|
|
312
|
+
* the registration is left out of list results, and requests for it fail as if
|
|
313
|
+
* it was not registered.
|
|
314
|
+
*
|
|
315
|
+
* The result is a `Middleware` and composes like one. The check receives the
|
|
316
|
+
* same {@link MiddlewareOptions} as middleware, and services it reads per
|
|
317
|
+
* request, other than `McpRequestContext`, are met the same way. Scope a
|
|
318
|
+
* visibility to some tools by providing its layer to their toolkit only, or
|
|
319
|
+
* branch on `target`.
|
|
320
|
+
*
|
|
321
|
+
* On a list request, the check and the middleware outside the innermost
|
|
322
|
+
* visibility run once for each registration. Middleware inside it does not
|
|
323
|
+
* run. A failure of that middleware or of a check fails the whole list
|
|
324
|
+
* request. It never hides a registration.
|
|
325
|
+
*
|
|
326
|
+
* Unlike `EnabledWhen`, a visibility runs the middleware around it on list
|
|
327
|
+
* requests, and middleware sees requests for hidden registrations.
|
|
328
|
+
*
|
|
329
|
+
* **Example** (Hiding admin tools from other users)
|
|
330
|
+
*
|
|
331
|
+
* ```ts
|
|
332
|
+
* import { Context, Effect, Layer, Schema } from "effect"
|
|
333
|
+
* import { McpServer, Tool, Toolkit } from "effect/ai"
|
|
334
|
+
*
|
|
335
|
+
* class CurrentUser extends Context.Service<CurrentUser, { readonly isAdmin: boolean }>()("CurrentUser") {}
|
|
336
|
+
*
|
|
337
|
+
* const AdminTools = Toolkit.make(Tool.make("DeleteUser", { success: Schema.String }))
|
|
338
|
+
*
|
|
339
|
+
* const Auth = McpServer.middleware<{ provides: CurrentUser }>()((effect, { headers }) =>
|
|
340
|
+
* Effect.provideService(effect, CurrentUser, { isAdmin: headers["x-role"] === "admin" })
|
|
341
|
+
* )
|
|
342
|
+
* const AdminOnly = McpServer.visibility(() => Effect.map(CurrentUser, (user) => user.isAdmin))
|
|
343
|
+
*
|
|
344
|
+
* const Registrations = McpServer.toolkit(AdminTools).pipe(
|
|
345
|
+
* Layer.provide(AdminOnly.combine(Auth).layer),
|
|
346
|
+
* Layer.provide(AdminTools.toLayer({ DeleteUser: () => Effect.succeed("deleted") }))
|
|
347
|
+
* )
|
|
348
|
+
* ```
|
|
349
|
+
*
|
|
350
|
+
* @see {@link middleware} for providing the services a check reads
|
|
351
|
+
*
|
|
352
|
+
* @stability unstable
|
|
353
|
+
* @category middleware
|
|
354
|
+
* @since 4.0.0
|
|
355
|
+
*/
|
|
356
|
+
export declare const visibility: visibility.Make;
|
|
357
|
+
/**
|
|
358
|
+
* Types used by `visibility`.
|
|
359
|
+
*
|
|
360
|
+
* @stability unstable
|
|
361
|
+
* @category middleware
|
|
362
|
+
* @since 4.0.0
|
|
363
|
+
*/
|
|
364
|
+
export declare namespace visibility {
|
|
365
|
+
/**
|
|
366
|
+
* The visibility check.
|
|
367
|
+
*
|
|
368
|
+
* @stability unstable
|
|
369
|
+
* @category middleware
|
|
370
|
+
* @since 4.0.0
|
|
371
|
+
*/
|
|
372
|
+
type Check<E, R> = (options: MiddlewareOptions) => Effect.Effect<boolean, E, R>;
|
|
373
|
+
/**
|
|
374
|
+
* The overloads of `visibility`.
|
|
375
|
+
*
|
|
376
|
+
* @stability unstable
|
|
377
|
+
* @category middleware
|
|
378
|
+
* @since 4.0.0
|
|
379
|
+
*/
|
|
380
|
+
type Make = {
|
|
381
|
+
<E extends McpErrorBase, R, EX, RX, const Global extends boolean = false>(check: Effect.Effect<Check<E, R>, EX, RX>, options?: {
|
|
382
|
+
readonly global?: Global | undefined;
|
|
383
|
+
}): Made<Global, {
|
|
384
|
+
provides: never;
|
|
385
|
+
error: E;
|
|
386
|
+
requires: Exclude<R, McpRequestContext>;
|
|
387
|
+
layerError: EX;
|
|
388
|
+
layerRequires: Exclude<RX, Scope.Scope>;
|
|
389
|
+
}>;
|
|
390
|
+
<E extends McpErrorBase, R, const Global extends boolean = false>(check: Check<E, R>, options?: {
|
|
391
|
+
readonly global?: Global | undefined;
|
|
392
|
+
}): Made<Global, {
|
|
393
|
+
provides: never;
|
|
394
|
+
error: E;
|
|
395
|
+
requires: Exclude<R, McpRequestContext>;
|
|
396
|
+
layerError: never;
|
|
397
|
+
layerRequires: never;
|
|
398
|
+
}>;
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
type Made<Global extends boolean, Config extends MiddlewareConfig> = Global extends true ? MiddlewareLayer<Config, McpServer> : Middleware<Config>;
|
|
35
402
|
declare const McpServer_base: Context.ServiceClass<McpServer, "effect/ai/McpServer", {
|
|
36
403
|
readonly notifications: RpcClient.RpcClient<RpcGroup.Rpcs<typeof BroadcastServerNotificationRpcs>>;
|
|
37
404
|
readonly notifyElicitationComplete: (options: {
|
|
@@ -45,9 +412,10 @@ declare const McpServer_base: Context.ServiceClass<McpServer, "effect/ai/McpServ
|
|
|
45
412
|
readonly addTool: (options: {
|
|
46
413
|
readonly tool: McpTool;
|
|
47
414
|
readonly annotations: Context.Context<never>;
|
|
415
|
+
readonly services?: Context.Context<never> | undefined;
|
|
48
416
|
readonly handle: (payload: any) => Effect.Effect<CallToolResult | McpSchema.InputRequired, InternalError | InvalidParams, McpRequestContext>;
|
|
49
417
|
}) => Effect.Effect<void>;
|
|
50
|
-
readonly callTool: (requests: typeof CallTool.payloadSchema.Type) => Effect.Effect<CallToolResult, InternalError | InvalidParams, McpServerClient>;
|
|
418
|
+
readonly callTool: (requests: typeof CallTool.payloadSchema.Type) => Effect.Effect<CallToolResult, McpErrorBase | InternalError | InvalidParams, McpServerClient>;
|
|
51
419
|
readonly resources: ReadonlyArray<{
|
|
52
420
|
readonly resource: Resource;
|
|
53
421
|
readonly annotations: Context.Context<never>;
|
|
@@ -55,6 +423,7 @@ declare const McpServer_base: Context.ServiceClass<McpServer, "effect/ai/McpServ
|
|
|
55
423
|
readonly addResource: (options: {
|
|
56
424
|
readonly resource: Resource;
|
|
57
425
|
readonly annotations: Context.Context<never>;
|
|
426
|
+
readonly services?: Context.Context<never> | undefined;
|
|
58
427
|
readonly handle: Effect.Effect<ReadResourceResult, InternalError, McpRequestContext>;
|
|
59
428
|
}) => Effect.Effect<void>;
|
|
60
429
|
readonly resourceTemplates: ReadonlyArray<{
|
|
@@ -64,6 +433,7 @@ declare const McpServer_base: Context.ServiceClass<McpServer, "effect/ai/McpServ
|
|
|
64
433
|
readonly addResourceTemplate: (options: {
|
|
65
434
|
readonly template: ResourceTemplate;
|
|
66
435
|
readonly annotations: Context.Context<never>;
|
|
436
|
+
readonly services?: Context.Context<never> | undefined;
|
|
67
437
|
readonly routerPath: string;
|
|
68
438
|
readonly completions: Record<string, (input: string, context: CompletionContext) => Effect.Effect<CompleteResult, InternalError>>;
|
|
69
439
|
readonly handle: (uri: string, params: Array<string>) => Effect.Effect<ReadResourceResult, InvalidParams | InternalError, McpRequestContext>;
|
|
@@ -76,11 +446,12 @@ declare const McpServer_base: Context.ServiceClass<McpServer, "effect/ai/McpServ
|
|
|
76
446
|
readonly addPrompt: (options: {
|
|
77
447
|
readonly prompt: Prompt;
|
|
78
448
|
readonly annotations: Context.Context<never>;
|
|
449
|
+
readonly services?: Context.Context<never> | undefined;
|
|
79
450
|
readonly completions: Record<string, (input: string, context: CompletionContext) => Effect.Effect<CompleteResult, InternalError, McpRequestContext>>;
|
|
80
451
|
readonly handle: (params: Record<string, string>) => Effect.Effect<GetPromptResult | McpSchema.InputRequired, InternalError | InvalidParams, McpRequestContext>;
|
|
81
452
|
}) => Effect.Effect<void>;
|
|
82
|
-
readonly getPromptResult: (request: typeof GetPrompt.payloadSchema.Type) => Effect.Effect<GetPromptResult, InternalError | InvalidParams, McpServerClient>;
|
|
83
|
-
readonly completion: (complete: typeof Complete.payloadSchema.Type) => Effect.Effect<CompleteResult, InvalidParams | InternalError, McpServerClient>;
|
|
453
|
+
readonly getPromptResult: (request: typeof GetPrompt.payloadSchema.Type) => Effect.Effect<GetPromptResult, McpErrorBase | InternalError | InvalidParams, McpServerClient>;
|
|
454
|
+
readonly completion: (complete: typeof Complete.payloadSchema.Type) => Effect.Effect<CompleteResult, McpErrorBase | InvalidParams | InternalError, McpServerClient>;
|
|
84
455
|
}>;
|
|
85
456
|
/**
|
|
86
457
|
* Service that stores and serves an MCP server's registered tools, resources,
|
|
@@ -115,9 +486,10 @@ export declare class McpServer extends McpServer_base {
|
|
|
115
486
|
readonly addTool: (options: {
|
|
116
487
|
readonly tool: McpTool;
|
|
117
488
|
readonly annotations: Context.Context<never>;
|
|
489
|
+
readonly services?: Context.Context<never> | undefined;
|
|
118
490
|
readonly handle: (payload: any) => Effect.Effect<CallToolResult | McpSchema.InputRequired, InternalError | InvalidParams, McpRequestContext>;
|
|
119
491
|
}) => Effect.Effect<void>;
|
|
120
|
-
readonly callTool: (requests: typeof CallTool.payloadSchema.Type) => Effect.Effect<CallToolResult, InternalError | InvalidParams, McpServerClient>;
|
|
492
|
+
readonly callTool: (requests: typeof CallTool.payloadSchema.Type) => Effect.Effect<CallToolResult, McpErrorBase | InternalError | InvalidParams, McpServerClient>;
|
|
121
493
|
readonly resources: ReadonlyArray<{
|
|
122
494
|
readonly resource: Resource;
|
|
123
495
|
readonly annotations: Context.Context<never>;
|
|
@@ -125,6 +497,7 @@ export declare class McpServer extends McpServer_base {
|
|
|
125
497
|
readonly addResource: (options: {
|
|
126
498
|
readonly resource: Resource;
|
|
127
499
|
readonly annotations: Context.Context<never>;
|
|
500
|
+
readonly services?: Context.Context<never> | undefined;
|
|
128
501
|
readonly handle: Effect.Effect<ReadResourceResult, InternalError, McpRequestContext>;
|
|
129
502
|
}) => Effect.Effect<void>;
|
|
130
503
|
readonly resourceTemplates: ReadonlyArray<{
|
|
@@ -134,6 +507,7 @@ export declare class McpServer extends McpServer_base {
|
|
|
134
507
|
readonly addResourceTemplate: (options: {
|
|
135
508
|
readonly template: ResourceTemplate;
|
|
136
509
|
readonly annotations: Context.Context<never>;
|
|
510
|
+
readonly services?: Context.Context<never> | undefined;
|
|
137
511
|
readonly routerPath: string;
|
|
138
512
|
readonly completions: Record<string, (input: string, context: CompletionContext) => Effect.Effect<CompleteResult, InternalError>>;
|
|
139
513
|
readonly handle: (uri: string, params: Array<string>) => Effect.Effect<ReadResourceResult, InvalidParams | InternalError, McpRequestContext>;
|
|
@@ -146,19 +520,76 @@ export declare class McpServer extends McpServer_base {
|
|
|
146
520
|
readonly addPrompt: (options: {
|
|
147
521
|
readonly prompt: Prompt;
|
|
148
522
|
readonly annotations: Context.Context<never>;
|
|
523
|
+
readonly services?: Context.Context<never> | undefined;
|
|
149
524
|
readonly completions: Record<string, (input: string, context: CompletionContext) => Effect.Effect<CompleteResult, InternalError, McpRequestContext>>;
|
|
150
525
|
readonly handle: (params: Record<string, string>) => Effect.Effect<GetPromptResult | McpSchema.InputRequired, InternalError | InvalidParams, McpRequestContext>;
|
|
151
526
|
}) => Effect.Effect<void>;
|
|
152
|
-
readonly getPromptResult: (request: typeof GetPrompt.payloadSchema.Type) => Effect.Effect<GetPromptResult, InternalError | InvalidParams, McpServerClient>;
|
|
153
|
-
readonly completion: (complete: typeof Complete.payloadSchema.Type) => Effect.Effect<CompleteResult, InvalidParams | InternalError, McpServerClient>;
|
|
527
|
+
readonly getPromptResult: (request: typeof GetPrompt.payloadSchema.Type) => Effect.Effect<GetPromptResult, McpErrorBase | InternalError | InvalidParams, McpServerClient>;
|
|
528
|
+
readonly completion: (complete: typeof Complete.payloadSchema.Type) => Effect.Effect<CompleteResult, McpErrorBase | InvalidParams | InternalError, McpServerClient>;
|
|
154
529
|
}, never, Scope.Scope>;
|
|
155
530
|
/**
|
|
156
|
-
* Layer that provides the MCP server
|
|
531
|
+
* Layer that provides the MCP server service.
|
|
532
|
+
*
|
|
533
|
+
* **Details**
|
|
534
|
+
*
|
|
535
|
+
* It doesn't run a transport or discharge request-level dependencies. Use it
|
|
536
|
+
* to call registrations in process, providing their request-level
|
|
537
|
+
* dependencies with MCP middleware.
|
|
157
538
|
*
|
|
158
539
|
* @stability unstable
|
|
159
540
|
* @since 4.0.0
|
|
160
541
|
*/
|
|
161
|
-
static readonly layer: Layer.Layer<McpServer
|
|
542
|
+
static readonly layer: Layer.Layer<McpServer>;
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* A client cache hint for one kind of `v2026_07_28` result.
|
|
546
|
+
*
|
|
547
|
+
* **Details**
|
|
548
|
+
*
|
|
549
|
+
* `ttl` is how long a client may treat the result as fresh. It is sent as a
|
|
550
|
+
* whole number of milliseconds, rounded down, so it must be finite,
|
|
551
|
+
* nonnegative and at most `Number.MAX_SAFE_INTEGER` milliseconds. Only
|
|
552
|
+
* `"private"` scope is supported, so shared caches must not store the result.
|
|
553
|
+
*
|
|
554
|
+
* @stability unstable
|
|
555
|
+
* @category models
|
|
556
|
+
* @since 4.1.0
|
|
557
|
+
*/
|
|
558
|
+
export interface CacheHint {
|
|
559
|
+
readonly ttl: Duration.Input;
|
|
560
|
+
readonly cacheScope: "private";
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* Client cache hints for `v2026_07_28` discovery and list results.
|
|
564
|
+
*
|
|
565
|
+
* **Details**
|
|
566
|
+
*
|
|
567
|
+
* Each entry sets the freshness and `cacheScope` of one result kind:
|
|
568
|
+
* `server/discover`, `tools/list`, `resources/list`,
|
|
569
|
+
* `resources/templates/list` and `prompts/list`. Omitted entries, and
|
|
570
|
+
* `resources/read` results, keep `{ ttlMs: 0, cacheScope: "private" }`.
|
|
571
|
+
* Earlier protocol revisions have no cache hints and ignore this option.
|
|
572
|
+
*
|
|
573
|
+
* These are hints for clients. The server does not cache results, and
|
|
574
|
+
* visibility and invocation checks still run on every request.
|
|
575
|
+
*
|
|
576
|
+
* **Gotchas**
|
|
577
|
+
*
|
|
578
|
+
* A positive `ttl` lets a client keep showing a list after registrations or
|
|
579
|
+
* per-request visibility change, until the hint expires. Private scope does
|
|
580
|
+
* not key a client's cache by user, so a client shared between users can
|
|
581
|
+
* reuse one user's list for another.
|
|
582
|
+
*
|
|
583
|
+
* @stability unstable
|
|
584
|
+
* @category models
|
|
585
|
+
* @since 4.1.0
|
|
586
|
+
*/
|
|
587
|
+
export interface CacheHints {
|
|
588
|
+
readonly discover?: CacheHint | undefined;
|
|
589
|
+
readonly tools?: CacheHint | undefined;
|
|
590
|
+
readonly resources?: CacheHint | undefined;
|
|
591
|
+
readonly resourceTemplates?: CacheHint | undefined;
|
|
592
|
+
readonly prompts?: CacheHint | undefined;
|
|
162
593
|
}
|
|
163
594
|
/**
|
|
164
595
|
* Runs an MCP server over the current `RpcServer.Protocol`.
|
|
@@ -182,7 +613,26 @@ export declare const run: (options: {
|
|
|
182
613
|
readonly icons?: ReadonlyArray<McpSchema.Icon> | undefined;
|
|
183
614
|
readonly protocols: Arr.NonEmptyReadonlyArray<McpProtocol.ProtocolAdapter>;
|
|
184
615
|
readonly extensions?: ServerExtensions | undefined;
|
|
616
|
+
readonly cacheHints?: CacheHints | undefined;
|
|
185
617
|
}) => Effect.Effect<never, Cause.IllegalArgumentError, McpServer | RpcServer.Protocol>;
|
|
618
|
+
type StatefulProtocolAdapter = McpProtocol.ProtocolAdapter<McpProtocol.ProtocolVersion, McpProtocol.StatefulRuntimeDescriptor>;
|
|
619
|
+
/**
|
|
620
|
+
* Request-level services supplied by a transport.
|
|
621
|
+
*
|
|
622
|
+
* **Details**
|
|
623
|
+
*
|
|
624
|
+
* Every transport supplies `Scope`. `McpServerClient` is supplied only when
|
|
625
|
+
* every configured protocol is known to be sessionful: a `v2026_07_28` request
|
|
626
|
+
* has no client session, and a protocol array widened to `ProtocolAdapter`
|
|
627
|
+
* might contain one. HTTP transports also supply `HttpServerRequest`.
|
|
628
|
+
*
|
|
629
|
+
* @stability unstable
|
|
630
|
+
* @category utility types
|
|
631
|
+
* @since 4.0.0
|
|
632
|
+
*/
|
|
633
|
+
export type ProvidedServices<Protocols extends ReadonlyArray<McpProtocol.ProtocolAdapter>, Http extends boolean = false> = Scope.Scope | (Protocols[number] extends StatefulProtocolAdapter ? McpServerClient : never) | (Http extends true ? HttpServerRequest.HttpServerRequest : never);
|
|
634
|
+
type RemainingRequestServices<RR, Provided> = Exclude<McpRequest.Only<"Requires", RR>, Provided>;
|
|
635
|
+
type RegistrationServices<RR> = Exclude<McpRequest.Without<RR>, McpServer>;
|
|
186
636
|
/**
|
|
187
637
|
* Creates a layer that starts an MCP server over an existing
|
|
188
638
|
* `RpcServer.Protocol` and provides `McpServer`. Request handlers receive
|
|
@@ -201,6 +651,11 @@ export declare const run: (options: {
|
|
|
201
651
|
* `McpServer.layer`, so registration layers can use the `McpServer` service
|
|
202
652
|
* while the server is running.
|
|
203
653
|
*
|
|
654
|
+
* Pass registration layers as `registrations` to build them before the server
|
|
655
|
+
* reads its first request. The transport discharges the request-level
|
|
656
|
+
* dependencies it supplies (see `ProvidedServices`); any other `McpRequest`
|
|
657
|
+
* marker stays in the layer's requirements and must be met by MCP middleware.
|
|
658
|
+
*
|
|
204
659
|
* **Gotchas**
|
|
205
660
|
*
|
|
206
661
|
* Unlike `layerStdio` and `layerHttp`, this layer does not install a concrete
|
|
@@ -214,16 +669,18 @@ export declare const run: (options: {
|
|
|
214
669
|
* @category layers
|
|
215
670
|
* @since 4.0.0
|
|
216
671
|
*/
|
|
217
|
-
export declare const layer: (options: {
|
|
672
|
+
export declare const layer: <const Protocols extends Arr.NonEmptyReadonlyArray<McpProtocol.ProtocolAdapter>, RA = never, RE = never, RR = never>(options: {
|
|
218
673
|
readonly name: string;
|
|
219
674
|
readonly version: string;
|
|
220
675
|
readonly instructions?: string | undefined;
|
|
221
676
|
readonly description?: string | undefined;
|
|
222
677
|
readonly websiteUrl?: string | undefined;
|
|
223
678
|
readonly icons?: ReadonlyArray<McpSchema.Icon> | undefined;
|
|
224
|
-
readonly protocols:
|
|
679
|
+
readonly protocols: Protocols;
|
|
225
680
|
readonly extensions?: ServerExtensions | undefined;
|
|
226
|
-
|
|
681
|
+
readonly cacheHints?: CacheHints | undefined;
|
|
682
|
+
readonly registrations?: Layer.Layer<RA, RE, RR> | undefined;
|
|
683
|
+
}) => Layer.Layer<McpServer | McpRequest.From<"Requires", ProvidedServices<Protocols>>, Cause.IllegalArgumentError | RE, RpcServer.Protocol | RegistrationServices<RR> | McpRequest.From<"Requires", RemainingRequestServices<RR, ProvidedServices<Protocols>>>>;
|
|
227
684
|
/**
|
|
228
685
|
* Creates a layer that runs an MCP server over standard input and output.
|
|
229
686
|
*
|
|
@@ -239,6 +696,11 @@ export declare const layer: (options: {
|
|
|
239
696
|
* `McpRequestContext` and legacy `McpServerClient` services to handlers, and
|
|
240
697
|
* requires `Stdio`.
|
|
241
698
|
*
|
|
699
|
+
* Pass registration layers as `registrations` to build them before the server
|
|
700
|
+
* reads its first request. The transport discharges the request-level
|
|
701
|
+
* dependencies it supplies (see `ProvidedServices`); any other `McpRequest`
|
|
702
|
+
* marker stays in the layer's requirements and must be met by MCP middleware.
|
|
703
|
+
*
|
|
242
704
|
* @see {@link layer} for running over an existing `RpcServer.Protocol`
|
|
243
705
|
* @see {@link layerHttp} for the single-endpoint HTTP transport
|
|
244
706
|
*
|
|
@@ -246,16 +708,18 @@ export declare const layer: (options: {
|
|
|
246
708
|
* @category layers
|
|
247
709
|
* @since 4.0.0
|
|
248
710
|
*/
|
|
249
|
-
export declare const layerStdio: (options: {
|
|
711
|
+
export declare const layerStdio: <const Protocols extends Arr.NonEmptyReadonlyArray<McpProtocol.ProtocolAdapter>, RA = never, RE = never, RR = never>(options: {
|
|
250
712
|
readonly name: string;
|
|
251
713
|
readonly version: string;
|
|
252
714
|
readonly instructions?: string | undefined;
|
|
253
715
|
readonly description?: string | undefined;
|
|
254
716
|
readonly websiteUrl?: string | undefined;
|
|
255
717
|
readonly icons?: ReadonlyArray<McpSchema.Icon> | undefined;
|
|
256
|
-
readonly protocols:
|
|
718
|
+
readonly protocols: Protocols;
|
|
257
719
|
readonly extensions?: ServerExtensions | undefined;
|
|
258
|
-
|
|
720
|
+
readonly cacheHints?: CacheHints | undefined;
|
|
721
|
+
readonly registrations?: Layer.Layer<RA, RE, RR> | undefined;
|
|
722
|
+
}) => Layer.Layer<McpServer | McpRequest.From<"Requires", ProvidedServices<Protocols>>, Cause.IllegalArgumentError | RE, Stdio | RegistrationServices<RR> | McpRequest.From<"Requires", RemainingRequestServices<RR, ProvidedServices<Protocols>>>>;
|
|
259
723
|
/**
|
|
260
724
|
* Registers a Streamable HTTP MCP endpoint at `options.path`.
|
|
261
725
|
*
|
|
@@ -293,6 +757,13 @@ export declare const layerStdio: (options: {
|
|
|
293
757
|
* serverless hosts where execution must belong to each request, use
|
|
294
758
|
* `layerHttpRequestScoped` instead.
|
|
295
759
|
*
|
|
760
|
+
* Pass registration layers as `registrations` to build them before the
|
|
761
|
+
* endpoint serves its first request. The transport discharges the
|
|
762
|
+
* request-level dependencies it supplies (see `ProvidedServices`) and converts
|
|
763
|
+
* the remaining `McpRequest` markers into `HttpRouter.Request` markers, so
|
|
764
|
+
* `HttpRouter.middleware` can provide them, for example to authenticate the
|
|
765
|
+
* request and resolve the current user.
|
|
766
|
+
*
|
|
296
767
|
* `layerHttp` always implements the single-endpoint Streamable HTTP topology.
|
|
297
768
|
* Using `v2024_11_05` here is a custom compatibility transport for that
|
|
298
769
|
* revision's schema. It does not implement the historical two-endpoint
|
|
@@ -310,7 +781,7 @@ export declare const layerStdio: (options: {
|
|
|
310
781
|
* @category layers
|
|
311
782
|
* @since 4.0.0
|
|
312
783
|
*/
|
|
313
|
-
export declare const layerHttp: (options: {
|
|
784
|
+
export declare const layerHttp: <const Protocols extends Arr.NonEmptyReadonlyArray<McpProtocol.ProtocolAdapter>, RA = never, RE = never, RR = never>(options: {
|
|
314
785
|
readonly name: string;
|
|
315
786
|
readonly version: string;
|
|
316
787
|
readonly instructions?: string | undefined;
|
|
@@ -318,12 +789,14 @@ export declare const layerHttp: (options: {
|
|
|
318
789
|
readonly websiteUrl?: string | undefined;
|
|
319
790
|
readonly icons?: ReadonlyArray<McpSchema.Icon> | undefined;
|
|
320
791
|
readonly path: HttpRouter.PathInput;
|
|
321
|
-
readonly protocols:
|
|
792
|
+
readonly protocols: Protocols;
|
|
322
793
|
readonly extensions?: ServerExtensions | undefined;
|
|
794
|
+
readonly cacheHints?: CacheHints | undefined;
|
|
323
795
|
readonly allowedOrigins?: ReadonlyArray<string> | undefined;
|
|
324
796
|
readonly allowSessionTermination?: boolean | undefined;
|
|
325
797
|
readonly allowSubscriptions?: boolean | undefined;
|
|
326
|
-
|
|
798
|
+
readonly registrations?: Layer.Layer<RA, RE, RR> | undefined;
|
|
799
|
+
}) => Layer.Layer<McpServer | McpRequest.From<"Requires", ProvidedServices<Protocols, true>>, Cause.IllegalArgumentError | RE, HttpRouter.HttpRouter | RegistrationServices<RR> | HttpRouter.Request.From<"Requires", RemainingRequestServices<RR, ProvidedServices<Protocols, true>>>>;
|
|
327
800
|
/**
|
|
328
801
|
* Registers a request-scoped Streamable HTTP MCP endpoint at `options.path`.
|
|
329
802
|
*
|
|
@@ -352,13 +825,17 @@ export declare const layerHttp: (options: {
|
|
|
352
825
|
* Configuring a sessionful protocol through an untyped caller fails layer
|
|
353
826
|
* construction with `IllegalArgumentError`.
|
|
354
827
|
*
|
|
828
|
+
* Registrations passed as `registrations` are built once, before the routes
|
|
829
|
+
* are added, and shared by every POST. Remaining `McpRequest` markers become
|
|
830
|
+
* `HttpRouter.Request` markers, as with `layerHttp`.
|
|
831
|
+
*
|
|
355
832
|
* @see {@link layerHttp} for the long-lived HTTP transport and HTTP admission policy
|
|
356
833
|
*
|
|
357
834
|
* @stability unstable
|
|
358
835
|
* @category layers
|
|
359
836
|
* @since 4.0.0
|
|
360
837
|
*/
|
|
361
|
-
export declare const layerHttpRequestScoped: (options: {
|
|
838
|
+
export declare const layerHttpRequestScoped: <const Protocols extends Arr.NonEmptyReadonlyArray<McpProtocol.ProtocolAdapter<McpProtocol.ProtocolVersion, McpProtocol.StatelessRuntimeDescriptor>>, RA = never, RE = never, RR = never>(options: {
|
|
362
839
|
readonly name: string;
|
|
363
840
|
readonly version: string;
|
|
364
841
|
readonly instructions?: string | undefined;
|
|
@@ -366,26 +843,59 @@ export declare const layerHttpRequestScoped: (options: {
|
|
|
366
843
|
readonly websiteUrl?: string | undefined;
|
|
367
844
|
readonly icons?: ReadonlyArray<McpSchema.Icon> | undefined;
|
|
368
845
|
readonly path: HttpRouter.PathInput;
|
|
369
|
-
readonly protocols:
|
|
846
|
+
readonly protocols: Protocols;
|
|
370
847
|
readonly extensions?: ServerExtensions | undefined;
|
|
848
|
+
readonly cacheHints?: CacheHints | undefined;
|
|
371
849
|
readonly allowedOrigins?: ReadonlyArray<string> | undefined;
|
|
372
|
-
|
|
850
|
+
readonly registrations?: Layer.Layer<RA, RE, RR> | undefined;
|
|
851
|
+
}) => Layer.Layer<McpServer | McpRequest.From<"Requires", ProvidedServices<Protocols, true>>, Cause.IllegalArgumentError | RE, HttpRouter.HttpRouter | RegistrationServices<RR> | HttpRouter.Request.From<"Requires", RemainingRequestServices<RR, ProvidedServices<Protocols, true>>>>;
|
|
852
|
+
/**
|
|
853
|
+
* The requirements of a toolkit registration.
|
|
854
|
+
*
|
|
855
|
+
* **Details**
|
|
856
|
+
*
|
|
857
|
+
* Services a tool declares with `dependencies` or `Tool.addDependency` are
|
|
858
|
+
* request-level: they are carried as `McpRequest<"Requires", S>` markers and
|
|
859
|
+
* must be provided by MCP middleware or the transport. Parameter decoding and
|
|
860
|
+
* result encoding services are required when the toolkit is registered,
|
|
861
|
+
* unless a tool also declares them.
|
|
862
|
+
*
|
|
863
|
+
* @stability unstable
|
|
864
|
+
* @category utility types
|
|
865
|
+
* @since 4.0.0
|
|
866
|
+
*/
|
|
867
|
+
export type ToolkitRequirements<Tools extends Record<string, Tool.Any>> = 0 extends (1 & Tool.Requirements<Tools[keyof Tools]>) ? any : Tool.HandlersFor<Tools> | RegistrationRequirements<Tool.SchemaServices<Tools[keyof Tools]>, Tool.Requirements<Tools[keyof Tools]>>;
|
|
868
|
+
type RegistrationRequirements<SchemaServices, RequestServices> = McpServer | Exclude<SchemaServices, RequestServices | McpRequestContext> | McpRequest.From<"Requires", Exclude<RequestServices, McpRequestContext>>;
|
|
373
869
|
/**
|
|
374
870
|
* Registers a `Toolkit` with the `McpServer`.
|
|
375
871
|
*
|
|
872
|
+
* **Details**
|
|
873
|
+
*
|
|
874
|
+
* The MCP middleware in the current context, provided with
|
|
875
|
+
* `Effect.provide(middleware.layer)`, runs around every call to the toolkit.
|
|
876
|
+
*
|
|
877
|
+
* @see {@link ToolkitRequirements} for which services are request-level
|
|
878
|
+
*
|
|
376
879
|
* @stability unstable
|
|
377
880
|
* @category handlers
|
|
378
881
|
* @since 4.0.0
|
|
379
882
|
*/
|
|
380
|
-
export declare const registerToolkit: <Tools extends Record<string, Tool.Any>>(toolkit: Toolkit.Toolkit<Tools>) => Effect.Effect<void, never,
|
|
883
|
+
export declare const registerToolkit: <Tools extends Record<string, Tool.Any>>(toolkit: Toolkit.Toolkit<Tools>) => Effect.Effect<void, never, ToolkitRequirements<Tools>>;
|
|
381
884
|
/**
|
|
382
|
-
*
|
|
885
|
+
* Creates a layer that registers a `Toolkit` with the `McpServer`.
|
|
886
|
+
*
|
|
887
|
+
* **Details**
|
|
888
|
+
*
|
|
889
|
+
* The layer requires `McpServer`. Pass it to a transport through the
|
|
890
|
+
* `registrations` option, or provide the transport layer to it.
|
|
891
|
+
*
|
|
892
|
+
* @see {@link ToolkitRequirements} for which services are request-level
|
|
383
893
|
*
|
|
384
894
|
* @stability unstable
|
|
385
895
|
* @category layers
|
|
386
896
|
* @since 4.0.0
|
|
387
897
|
*/
|
|
388
|
-
export declare const toolkit: <Tools extends Record<string, Tool.Any>>(toolkit: Toolkit.Toolkit<Tools>) => Layer.Layer<never, never,
|
|
898
|
+
export declare const toolkit: <Tools extends Record<string, Tool.Any>>(toolkit: Toolkit.Toolkit<Tools>) => Layer.Layer<never, never, ToolkitRequirements<Tools>>;
|
|
389
899
|
/**
|
|
390
900
|
* Utility type that validates a completion-handler record against the allowed
|
|
391
901
|
* parameter keys.
|
|
@@ -424,6 +934,50 @@ export type CompletionServices<Completions> = {
|
|
|
424
934
|
export type ResourceCompletions<Schemas extends ReadonlyArray<Schema.Constraint>> = {
|
|
425
935
|
readonly [K in Extract<keyof Schemas, `${number}`> as Schemas[K] extends Param<infer Id, infer _S> ? Id : `param${K}`]: (input: string, context: CompletionContext) => Effect.Effect<Array<Schemas[K]["Type"]>, any, any>;
|
|
426
936
|
};
|
|
937
|
+
type TemplateParamKey<Schemas extends ReadonlyArray<Schema.Constraint>, K extends keyof Schemas> = Schemas[K] extends Param<infer Id, infer _S> ? Id : `param${K & string}`;
|
|
938
|
+
type TemplateSchemaServices<Schemas extends ReadonlyArray<Schema.Constraint>, Completions> = Schemas[number]["DecodingServices"] | {
|
|
939
|
+
[K in Extract<keyof Schemas, `${number}`>]: TemplateParamKey<Schemas, K> extends keyof Completions ? Schemas[K]["EncodingServices"] : never;
|
|
940
|
+
}[Extract<keyof Schemas, `${number}`>];
|
|
941
|
+
type PromptSchemaServices<Params extends Schema.Struct.Fields, Completions> = Schema.Struct.DecodingServices<Params> | Params[Extract<keyof Completions, keyof Params>]["EncodingServices"];
|
|
942
|
+
/**
|
|
943
|
+
* The requirements of a resource registration: the content handler's services
|
|
944
|
+
* are request-level.
|
|
945
|
+
*
|
|
946
|
+
* @stability unstable
|
|
947
|
+
* @category utility types
|
|
948
|
+
* @since 4.0.0
|
|
949
|
+
*/
|
|
950
|
+
export type ResourceRequirements<R> = RegistrationRequirements<never, R>;
|
|
951
|
+
/**
|
|
952
|
+
* The requirements of a resource template registration.
|
|
953
|
+
*
|
|
954
|
+
* **Details**
|
|
955
|
+
*
|
|
956
|
+
* Services read by the content and completion handlers are request-level.
|
|
957
|
+
* Parameter decoding services, and the encoding services of parameters with a
|
|
958
|
+
* completion handler, are required when the template is registered, unless a
|
|
959
|
+
* handler also reads them.
|
|
960
|
+
*
|
|
961
|
+
* @stability unstable
|
|
962
|
+
* @category utility types
|
|
963
|
+
* @since 4.0.0
|
|
964
|
+
*/
|
|
965
|
+
export type ResourceTemplateRequirements<Schemas extends ReadonlyArray<Schema.Constraint>, R, Completions> = RegistrationRequirements<TemplateSchemaServices<Schemas, Completions>, R | CompletionServices<Completions>>;
|
|
966
|
+
/**
|
|
967
|
+
* The requirements of a prompt registration.
|
|
968
|
+
*
|
|
969
|
+
* **Details**
|
|
970
|
+
*
|
|
971
|
+
* Services read by the content and completion handlers are request-level.
|
|
972
|
+
* Parameter decoding services, and the encoding services of parameters with a
|
|
973
|
+
* completion handler, are required when the prompt is registered, unless a
|
|
974
|
+
* handler also reads them.
|
|
975
|
+
*
|
|
976
|
+
* @stability unstable
|
|
977
|
+
* @category utility types
|
|
978
|
+
* @since 4.0.0
|
|
979
|
+
*/
|
|
980
|
+
export type PromptRequirements<Params extends Schema.Struct.Fields, R, Completions> = RegistrationRequirements<PromptSchemaServices<Params, Completions>, R | CompletionServices<Completions>>;
|
|
427
981
|
/**
|
|
428
982
|
* Registers an MCP resource or resource template from an Effect program.
|
|
429
983
|
*
|
|
@@ -452,7 +1006,7 @@ export declare const registerResource: {
|
|
|
452
1006
|
readonly priority?: number | undefined;
|
|
453
1007
|
readonly content: Effect.Effect<ReadResourceResult | string | Uint8Array, E, R>;
|
|
454
1008
|
readonly annotations?: Context.Context<never> | undefined;
|
|
455
|
-
}): Effect.Effect<void, never,
|
|
1009
|
+
}): Effect.Effect<void, never, ResourceRequirements<R>>;
|
|
456
1010
|
/**
|
|
457
1011
|
* Registers an MCP resource or resource template from an Effect program.
|
|
458
1012
|
*
|
|
@@ -473,12 +1027,20 @@ export declare const registerResource: {
|
|
|
473
1027
|
readonly [K in keyof Schemas]: Schemas[K]["Type"];
|
|
474
1028
|
}) => Effect.Effect<ReadResourceResult | string | Uint8Array, E, R>;
|
|
475
1029
|
readonly annotations?: Context.Context<never> | undefined;
|
|
476
|
-
}) => Effect.Effect<void, never,
|
|
1030
|
+
}) => Effect.Effect<void, never, ResourceTemplateRequirements<Schemas, R, Completions>>;
|
|
477
1031
|
};
|
|
478
1032
|
/**
|
|
479
1033
|
* Creates a layer that registers an MCP resource or resource template.
|
|
480
1034
|
*
|
|
1035
|
+
* **Details**
|
|
1036
|
+
*
|
|
1037
|
+
* Services read by the content and completion handlers are request-level, so
|
|
1038
|
+
* providing them with `Layer.provide` doesn't satisfy them. Read
|
|
1039
|
+
* construction-time services in an enclosing `Layer.unwrap` and close over
|
|
1040
|
+
* them, and provide per-request services with MCP middleware.
|
|
1041
|
+
*
|
|
481
1042
|
* @see {@link registerResource} for the Effect-level resource registration API
|
|
1043
|
+
* @see {@link middleware} for providing request-level dependencies
|
|
482
1044
|
*
|
|
483
1045
|
* @stability unstable
|
|
484
1046
|
* @category layers
|
|
@@ -488,7 +1050,15 @@ export declare const resource: {
|
|
|
488
1050
|
/**
|
|
489
1051
|
* Creates a layer that registers an MCP resource or resource template.
|
|
490
1052
|
*
|
|
1053
|
+
* **Details**
|
|
1054
|
+
*
|
|
1055
|
+
* Services read by the content and completion handlers are request-level, so
|
|
1056
|
+
* providing them with `Layer.provide` doesn't satisfy them. Read
|
|
1057
|
+
* construction-time services in an enclosing `Layer.unwrap` and close over
|
|
1058
|
+
* them, and provide per-request services with MCP middleware.
|
|
1059
|
+
*
|
|
491
1060
|
* @see {@link registerResource} for the Effect-level resource registration API
|
|
1061
|
+
* @see {@link middleware} for providing request-level dependencies
|
|
492
1062
|
*
|
|
493
1063
|
* @stability unstable
|
|
494
1064
|
* @category layers
|
|
@@ -502,11 +1072,19 @@ export declare const resource: {
|
|
|
502
1072
|
readonly audience?: ReadonlyArray<"user" | "assistant"> | undefined;
|
|
503
1073
|
readonly priority?: number | undefined;
|
|
504
1074
|
readonly content: Effect.Effect<ReadResourceResult | string | Uint8Array, E, R>;
|
|
505
|
-
}): Layer.Layer<never, never,
|
|
1075
|
+
}): Layer.Layer<never, never, ResourceRequirements<R>>;
|
|
506
1076
|
/**
|
|
507
1077
|
* Creates a layer that registers an MCP resource or resource template.
|
|
508
1078
|
*
|
|
1079
|
+
* **Details**
|
|
1080
|
+
*
|
|
1081
|
+
* Services read by the content and completion handlers are request-level, so
|
|
1082
|
+
* providing them with `Layer.provide` doesn't satisfy them. Read
|
|
1083
|
+
* construction-time services in an enclosing `Layer.unwrap` and close over
|
|
1084
|
+
* them, and provide per-request services with MCP middleware.
|
|
1085
|
+
*
|
|
509
1086
|
* @see {@link registerResource} for the Effect-level resource registration API
|
|
1087
|
+
* @see {@link middleware} for providing request-level dependencies
|
|
510
1088
|
*
|
|
511
1089
|
* @stability unstable
|
|
512
1090
|
* @category layers
|
|
@@ -522,7 +1100,7 @@ export declare const resource: {
|
|
|
522
1100
|
readonly content: (uri: string, ...params: {
|
|
523
1101
|
readonly [K in keyof Schemas]: Schemas[K]["Type"];
|
|
524
1102
|
}) => Effect.Effect<ReadResourceResult | string | Uint8Array, E, R>;
|
|
525
|
-
}) => Layer.Layer<never, never,
|
|
1103
|
+
}) => Layer.Layer<never, never, ResourceTemplateRequirements<Schemas, R, Completions>>;
|
|
526
1104
|
};
|
|
527
1105
|
/**
|
|
528
1106
|
* Registers an MCP prompt from an Effect program.
|
|
@@ -546,11 +1124,19 @@ export declare const registerPrompt: <E, R, Params extends Schema.Struct.Fields
|
|
|
546
1124
|
readonly completion?: ValidateCompletions<Completions, Extract<keyof Params, string>> | undefined;
|
|
547
1125
|
readonly content: (params: Schema.Struct.Type<Params>) => Effect.Effect<Array<PromptMessage> | string, E, R>;
|
|
548
1126
|
readonly annotations?: Context.Context<never> | undefined;
|
|
549
|
-
}) => Effect.Effect<void, never,
|
|
1127
|
+
}) => Effect.Effect<void, never, PromptRequirements<Params, R, Completions>>;
|
|
550
1128
|
/**
|
|
551
1129
|
* Creates a layer that registers an MCP prompt.
|
|
552
1130
|
*
|
|
1131
|
+
* **Details**
|
|
1132
|
+
*
|
|
1133
|
+
* Services read by the content and completion handlers are request-level, so
|
|
1134
|
+
* providing them with `Layer.provide` doesn't satisfy them. Read
|
|
1135
|
+
* construction-time services in an enclosing `Layer.unwrap` and close over
|
|
1136
|
+
* them, and provide per-request services with MCP middleware.
|
|
1137
|
+
*
|
|
553
1138
|
* @see {@link registerPrompt} for the Effect-level prompt registration API
|
|
1139
|
+
* @see {@link middleware} for providing request-level dependencies
|
|
554
1140
|
*
|
|
555
1141
|
* @stability unstable
|
|
556
1142
|
* @category layers
|
|
@@ -564,7 +1150,7 @@ export declare const prompt: <E, R, Params extends Schema.Struct.Fields = {}, co
|
|
|
564
1150
|
readonly completion?: ValidateCompletions<Completions, Extract<keyof Params, string>> | undefined;
|
|
565
1151
|
readonly content: (params: Schema.Struct.Type<Params>) => Effect.Effect<Array<PromptMessage> | string, E, R>;
|
|
566
1152
|
readonly annotations?: Context.Context<never> | undefined;
|
|
567
|
-
}) => Layer.Layer<never, never,
|
|
1153
|
+
}) => Layer.Layer<never, never, PromptRequirements<Params, R, Completions>>;
|
|
568
1154
|
/**
|
|
569
1155
|
* Collects structured input from the current MCP client and decodes the
|
|
570
1156
|
* accepted response with `schema`.
|
|
@@ -590,5 +1176,20 @@ export declare const elicit: <S extends Schema.ConstraintEncoder<Record<string,
|
|
|
590
1176
|
* @since 4.0.0
|
|
591
1177
|
*/
|
|
592
1178
|
export declare const clientCapabilities: Effect.Effect<ClientCapabilities, never, McpRequestContext>;
|
|
1179
|
+
/**
|
|
1180
|
+
* Decodes an `Mcp-Name` header, including base64-wrapped values.
|
|
1181
|
+
* Returns `undefined` for malformed values.
|
|
1182
|
+
*
|
|
1183
|
+
* **Details**
|
|
1184
|
+
*
|
|
1185
|
+
* Use in `HttpRouter.middleware` to identify the tool, prompt or resource
|
|
1186
|
+
* targeted by a `2026-07-28` request. Earlier protocols carry the name only
|
|
1187
|
+
* in the JSON-RPC body.
|
|
1188
|
+
*
|
|
1189
|
+
* @stability unstable
|
|
1190
|
+
* @category decoding
|
|
1191
|
+
* @since 4.0.0
|
|
1192
|
+
*/
|
|
1193
|
+
export declare const decodeNameHeader: (value: string) => string | undefined;
|
|
593
1194
|
export {};
|
|
594
1195
|
//# sourceMappingURL=McpServer.d.ts.map
|