Skip to content

Commit d4efd98

Browse files
authored
Fix package.json verison, and update examples (#2)
* Fix package.json verison, and update examples * Update package-lock.json * Updating linting GHA to check package-lock.json
1 parent e4d00d4 commit d4efd98

File tree

8 files changed

+159
-5
lines changed

8 files changed

+159
-5
lines changed

.github/workflows/lint.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ jobs:
2222
- name: Install dependencies
2323
run: npm ci
2424

25+
- name: Check package-lock.json is up to date
26+
run: |
27+
npm install --package-lock-only
28+
if [ -n "$(git status --porcelain package-lock.json)" ]; then
29+
echo "Error: package-lock.json is out of date. Please run 'npm install' locally and commit the changes."
30+
git diff package-lock.json
31+
exit 1
32+
fi
33+
2534
- name: Run linting and typecheck
2635
run: npm run lint
2736

examples/basic/README.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Basic mcpd SDK Example
2+
3+
Basic example demonstrating core features of the mcpd JavaScript/TypeScript SDK.
4+
5+
## Features Demonstrated
6+
7+
- Connecting to an mcpd daemon
8+
- Listing available servers
9+
- Checking server health
10+
- Listing tools for a specific server
11+
- Calling tools dynamically
12+
- Error handling
13+
14+
## Prerequisites
15+
16+
- Node.js 22 LTS or higher
17+
- mcpd daemon running locally on port 8090
18+
- At least one MCP server configured (example uses 'time' server)
19+
20+
## Installation
21+
22+
```bash
23+
npm install
24+
```
25+
26+
## Running
27+
28+
```bash
29+
npm start
30+
```
31+
32+
Or with auto-reload during development:
33+
34+
```bash
35+
npm run dev
36+
```
37+
38+
## What This Example Shows
39+
40+
The example connects to a local mcpd daemon and demonstrates:
41+
42+
1. **Server Discovery** - Lists all configured MCP servers
43+
2. **Health Checking** - Checks health status of all servers
44+
3. **Tool Discovery** - Lists available tools on the 'time' server
45+
4. **Dynamic Tool Calls** - Calls the `get_current_time` tool with different timezones
46+
5. **Error Handling** - Demonstrates proper error handling with typed exceptions
47+
48+
## Expected Output
49+
50+
```
51+
Available servers:
52+
[ 'time', 'fetch', ... ]
53+
54+
Server health:
55+
time: ok
56+
fetch: ok
57+
58+
Time server tools:
59+
- get_current_time: Get current time in a specific timezone
60+
61+
Getting current time in different timezones:
62+
UTC: { content: [...], isError: false }
63+
Tokyo: { content: [...], isError: false }
64+
New York: { content: [...], isError: false }
65+
```
66+
67+
## Learn More
68+
69+
- [Main SDK Documentation](../../README.md)
70+
- [LangChain Example](../langchain/)
71+
- [Vercel AI Example](../vercel-ai/)

examples/basic/package-lock.json

Lines changed: 52 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/basic/package.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "mcpd-basic-example",
3+
"version": "0.0.1",
4+
"private": true,
5+
"type": "module",
6+
"description": "Basic example of using the mcpd SDK",
7+
"scripts": {
8+
"start": "node index.js",
9+
"dev": "node --watch index.js"
10+
},
11+
"dependencies": {
12+
"@mozilla-ai/mcpd": "file:../.."
13+
},
14+
"engines": {
15+
"node": ">=22.0.0"
16+
},
17+
"keywords": [
18+
"mcp",
19+
"mcpd",
20+
"example"
21+
]
22+
}

examples/langchain/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/vercel-ai/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mozilla-ai/mcpd",
3-
"version": "0.1.0",
3+
"version": "0.0.1",
44
"description": "JavaScript/TypeScript SDK for interacting with mcpd",
55
"main": "./dist/index.js",
66
"module": "./dist/index.mjs",

0 commit comments

Comments
 (0)