This package defines Typescript types (.d.ts) for the WebMCP specification.
Use this package to augment the ambient "dom" type definitions with the new definitions for WebMCP.
See the TypeScript handbook.
- npm:
npm install --save-dev webmcp-types - yarn:
yarn add --dev webmcp-types - pnpm:
pnpm add -D webmcp-types
Since this package is outside DefinitelyTyped, the dependency won't be picked up automatically. There are several ways to add a additional TypeScript type definition dependencies to your TypeScript project:
In tsconfig.json:
{
// ...
"compilerOptions": {
// ...
"types": ["webmcp-types"]
}
}Or you can use typeRoots:
{
// ...
"compilerOptions": {
// ...
"typeRoots": ["./node_modules/webmcp-types", "./node_modules/@types"]
}
}This may work better if your toolchain doesn't read tsconfig.json.
/// <reference types="webmcp-types" />If you use Webpack and the options above aren't sufficient (this has not been verified),
you may need the following in webpack.config.js:
"types": ["webmcp-types"](only for people who have npm publish access)
- Make sure you are in the upstream repo, not your forked one. And make sure you are synced to latest commit intended for publish
git checkout maingit pull https://github.com/webmachinelearning/webmcp-types.git main- (If you are using HTTPS regularly. You can use remote names like
origin, just make sure you are referring to the right repo)
- (If you are using HTTPS regularly. You can use remote names like
- Create the version tag and commit, and push
npm version patchgit push https://github.com/webmachinelearning/webmcp-types.git main --tags
- publish the package
npm publish --otp=<code>- Replace
<code>with the one-time password from your authenticator, since two-factors authentication is required to publish. - If you are doing for the first time, you will do
npm adduserfirst and it will guide you through adding the npm account.
- Replace