2.7 KiB
How to test on different platforms
-
Create a local test registry. We are using Verdaccio. During the actual process, we publish to npm instead.
# install npm install -g verdaccio # start server verdaccioThe output will show the config file location and the URL. Open your browser to: http://localhost:4873
Note: You can use
npm unpublish @toolbox-sdk/server --force --registry http://localhost:4873to unpublish the package. -
Pack all 4 packages and publish them to the local registry. Go in each package (eg. server-darwin-arm64) and run
npm ci --force npm pack .Then publish to the local registry
npm publish --registry http://localhost:4873 -
Go to the server package and run
npm ci --force npm pack . npm publish --registry http://localhost:4873Now, you have published your package.
-
Now create a new folder (let's call it testing.) Add a tools.yaml file to the folder. It should look like this:
sources: my-pg-source: kind: postgres host: 127.0.0.1 port: 5432 database: toolbox_db user: postgres password: password tools: search-hotels-by-name: kind: postgres-sql source: my-pg-source description: Search for hotels based on name. parameters: - name: name type: string description: The name of the hotel. statement: SELECT * FROM hotels WHERE name ILIKE '%' || $1 || '%'; prompts: code-review: description: "Asks the LLM to analyze code quality and suggest improvements." messages: - role: "user" content: "Please review the following code for quality, correctness, and potential improvements: \n\n{{.code}}" arguments: - name: "code" description: "The code to review" required: trueNote: Do not test this directly to the server folder. The registry might pick up local packages instead of global installation. Use a separate testing folder outside the server folder for this testing.
-
From the testing folder, run
npx --registry=http://localhost:4873/ -y @toolbox-sdk/serverThis should start up the toolbox server with the tools.yaml file.
-
Run the command to verify that the tools are available:
curl --location 'http://127.0.0.1:5000/mcp' \ --header 'Content-Type: application/json' \ --data '{ "jsonrpc": "2.0", "method": "tools/list", "params": {}, "id": 1 }'