-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add config schema and example auth call
- Loading branch information
Showing
7 changed files
with
146 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,49 @@ | ||
export const REGISTRY_URL = "https://registry.smithery.ai" | ||
import { | ||
ProgressTokenSchema, | ||
RequestSchema, | ||
ResultSchema, | ||
} from "@modelcontextprotocol/sdk/types.js" | ||
import { z } from "zod" | ||
|
||
// Copied from MCP | ||
export const BaseRequestSchema = z | ||
.object({ | ||
_meta: z.optional( | ||
z | ||
.object({ | ||
/** | ||
* If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications. | ||
*/ | ||
progressToken: z.optional(ProgressTokenSchema), | ||
}) | ||
.passthrough(), | ||
), | ||
}) | ||
.passthrough() | ||
|
||
/** | ||
* A custom method to set the configuration of the server deployed on Smithery. | ||
* This must be called after initialization and before using the SSE server. | ||
*/ | ||
export const ConfigRequestSchema = RequestSchema.extend({ | ||
method: z.literal("config"), | ||
params: BaseRequestSchema.extend({ | ||
config: z.any(), | ||
}), | ||
}) | ||
|
||
export type ConfigRequest = z.infer<typeof ConfigRequestSchema> | ||
|
||
/** | ||
* A custom response schema to expected when creating a config request. | ||
*/ | ||
export const ConfigResultSchema = ResultSchema.extend({ | ||
error: z | ||
.any() | ||
.optional() | ||
.describe( | ||
"An object containing the error. If no error is present, it meanas the config succeeded.", | ||
), | ||
}).describe("The result of a config request.") | ||
|
||
export type ConfigResult = z.infer<typeof ConfigResultSchema> |
Oops, something went wrong.