Skip to content

Commit c392f5f

Browse files
release: 0.1.1 (#2)
* codegen metadata * codegen metadata * chore: configure new SDK language * release: 0.1.1 --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
1 parent ff6c6de commit c392f5f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+9025
-11
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Set up Node
2525
uses: actions/setup-node@v4
2626
with:
27-
node-version: '20'
27+
node-version: '22'
2828

2929
- name: Bootstrap
3030
run: ./scripts/bootstrap
@@ -46,7 +46,7 @@ jobs:
4646
- name: Set up Node
4747
uses: actions/setup-node@v4
4848
with:
49-
node-version: '20'
49+
node-version: '22'
5050

5151
- name: Bootstrap
5252
run: ./scripts/bootstrap
@@ -68,6 +68,15 @@ jobs:
6868
AUTH: ${{ steps.github-oidc.outputs.github_token }}
6969
SHA: ${{ github.sha }}
7070
run: ./scripts/utils/upload-artifact.sh
71+
72+
- name: Upload MCP Server tarball
73+
if: github.repository == 'stainless-sdks/schools-typescript'
74+
env:
75+
URL: https://pkg.stainless.com/s?subpackage=mcp-server
76+
AUTH: ${{ steps.github-oidc.outputs.github_token }}
77+
SHA: ${{ github.sha }}
78+
BASE_PATH: packages/mcp-server
79+
run: ./scripts/utils/upload-artifact.sh
7180
test:
7281
timeout-minutes: 10
7382
name: test
@@ -79,10 +88,13 @@ jobs:
7988
- name: Set up Node
8089
uses: actions/setup-node@v4
8190
with:
82-
node-version: '20'
91+
node-version: '22'
8392

8493
- name: Bootstrap
8594
run: ./scripts/bootstrap
8695

96+
- name: Build
97+
run: ./scripts/build
98+
8799
- name: Run tests
88100
run: ./scripts/test

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ dist-deno
88
/*.tgz
99
.idea/
1010
.eslintcache
11-
11+
dist-bundle
12+
*.mcpb

.prettierignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ CHANGELOG.md
44
/deno
55

66
# don't format tsc output, will break source maps
7-
/dist
7+
dist

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.1.0"
2+
".": "0.1.1"
33
}

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 11
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/yufugumi%2Fschools-8b2bd24c42e8cbbe595f5ff86d5b647b19c5db3fe7b0b88e89ac62579e87e0b2.yml
33
openapi_spec_hash: 3585f4f3c71183b9e2275426853a1cd2
4-
config_hash: 2c255d0cb2ebe374b8702a252dfe01a9
4+
config_hash: 922170ad50ac6f28eaec9e268efa4a66

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 0.1.1 (2025-11-04)
4+
5+
Full Changelog: [v0.1.0...v0.1.1](https://github.com/et0and/schools-sdk-typescript/compare/v0.1.0...v0.1.1)
6+
7+
### Chores
8+
9+
* configure new SDK language ([7b7101d](https://github.com/et0and/schools-sdk-typescript/commit/7b7101d3856f3ce0e338ce2e1af17248350feeb5))
10+
311
## 0.1.0 (2025-10-17)
412

513
Full Changelog: [v0.0.1...v0.1.0](https://github.com/et0and/schools-sdk-typescript/compare/v0.0.1...v0.1.0)

eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export default tseslint.config(
3434
},
3535
},
3636
{
37-
files: ['tests/**', 'examples/**'],
37+
files: ['tests/**', 'examples/**', 'packages/**'],
3838
rules: {
3939
'no-restricted-imports': 'off',
4040
},

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "schools-sdk",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"description": "The official TypeScript library for the Schools API",
55
"author": "Schools <info@yufugumi.com>",
66
"types": "dist/index.d.ts",

packages/mcp-server/README.md

Lines changed: 245 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,245 @@
1+
# Schools TypeScript MCP Server
2+
3+
It is generated with [Stainless](https://www.stainless.com/).
4+
5+
## Installation
6+
7+
### Building
8+
9+
Because it's not published yet, clone the repo and build it:
10+
11+
```sh
12+
git clone git@github.com:et0and/schools-sdk-typescript.git
13+
cd schools-sdk-typescript
14+
./scripts/bootstrap
15+
./scripts/build
16+
```
17+
18+
### Running
19+
20+
```sh
21+
# set env vars as needed
22+
export SCHOOLS_API_KEY="My API Key"
23+
export SCHOOLS_ENVIRONMENT="production"
24+
node ./packages/mcp-server/dist/index.js
25+
```
26+
27+
> [!NOTE]
28+
> Once this package is [published to npm](https://www.stainless.com/docs/guides/publish), this will become: `npx -y schools-sdk-mcp`
29+
30+
### Via MCP Client
31+
32+
[Build the project](#building) as mentioned above.
33+
34+
There is a partial list of existing clients at [modelcontextprotocol.io](https://modelcontextprotocol.io/clients). If you already
35+
have a client, consult their documentation to install the MCP server.
36+
37+
For clients with a configuration JSON, it might look something like this:
38+
39+
```json
40+
{
41+
"mcpServers": {
42+
"schools_sdk_api": {
43+
"command": "node",
44+
"args": ["/path/to/local/schools-sdk-typescript/packages/mcp-server", "--client=claude", "--tools=all"],
45+
"env": {
46+
"SCHOOLS_API_KEY": "My API Key",
47+
"SCHOOLS_ENVIRONMENT": "production"
48+
}
49+
}
50+
}
51+
}
52+
```
53+
54+
## Exposing endpoints to your MCP Client
55+
56+
There are two ways to expose endpoints as tools in the MCP server:
57+
58+
1. Exposing one tool per endpoint, and filtering as necessary
59+
2. Exposing a set of tools to dynamically discover and invoke endpoints from the API
60+
61+
### Filtering endpoints and tools
62+
63+
You can run the package on the command line to discover and filter the set of tools that are exposed by the
64+
MCP Server. This can be helpful for large APIs where including all endpoints at once is too much for your AI's
65+
context window.
66+
67+
You can filter by multiple aspects:
68+
69+
- `--tool` includes a specific tool by name
70+
- `--resource` includes all tools under a specific resource, and can have wildcards, e.g. `my.resource*`
71+
- `--operation` includes just read (get/list) or just write operations
72+
73+
### Dynamic tools
74+
75+
If you specify `--tools=dynamic` to the MCP server, instead of exposing one tool per endpoint in the API, it will
76+
expose the following tools:
77+
78+
1. `list_api_endpoints` - Discovers available endpoints, with optional filtering by search query
79+
2. `get_api_endpoint_schema` - Gets detailed schema information for a specific endpoint
80+
3. `invoke_api_endpoint` - Executes any endpoint with the appropriate parameters
81+
82+
This allows you to have the full set of API endpoints available to your MCP Client, while not requiring that all
83+
of their schemas be loaded into context at once. Instead, the LLM will automatically use these tools together to
84+
search for, look up, and invoke endpoints dynamically. However, due to the indirect nature of the schemas, it
85+
can struggle to provide the correct properties a bit more than when tools are imported explicitly. Therefore,
86+
you can opt-in to explicit tools, the dynamic tools, or both.
87+
88+
See more information with `--help`.
89+
90+
All of these command-line options can be repeated, combined together, and have corresponding exclusion versions (e.g. `--no-tool`).
91+
92+
Use `--list` to see the list of available tools, or see below.
93+
94+
### Specifying the MCP Client
95+
96+
Different clients have varying abilities to handle arbitrary tools and schemas.
97+
98+
You can specify the client you are using with the `--client` argument, and the MCP server will automatically
99+
serve tools and schemas that are more compatible with that client.
100+
101+
- `--client=<type>`: Set all capabilities based on a known MCP client
102+
103+
- Valid values: `openai-agents`, `claude`, `claude-code`, `cursor`
104+
- Example: `--client=cursor`
105+
106+
Additionally, if you have a client not on the above list, or the client has gotten better
107+
over time, you can manually enable or disable certain capabilities:
108+
109+
- `--capability=<name>`: Specify individual client capabilities
110+
- Available capabilities:
111+
- `top-level-unions`: Enable support for top-level unions in tool schemas
112+
- `valid-json`: Enable JSON string parsing for arguments
113+
- `refs`: Enable support for $ref pointers in schemas
114+
- `unions`: Enable support for union types (anyOf) in schemas
115+
- `formats`: Enable support for format validations in schemas (e.g. date-time, email)
116+
- `tool-name-length=N`: Set maximum tool name length to N characters
117+
- Example: `--capability=top-level-unions --capability=tool-name-length=40`
118+
- Example: `--capability=top-level-unions,tool-name-length=40`
119+
120+
### Examples
121+
122+
1. Filter for read operations on cards:
123+
124+
```bash
125+
--resource=cards --operation=read
126+
```
127+
128+
2. Exclude specific tools while including others:
129+
130+
```bash
131+
--resource=cards --no-tool=create_cards
132+
```
133+
134+
3. Configure for Cursor client with custom max tool name length:
135+
136+
```bash
137+
--client=cursor --capability=tool-name-length=40
138+
```
139+
140+
4. Complex filtering with multiple criteria:
141+
142+
```bash
143+
--resource=cards,accounts --operation=read --tag=kyc --no-tool=create_cards
144+
```
145+
146+
## Running remotely
147+
148+
Launching the client with `--transport=http` launches the server as a remote server using Streamable HTTP transport. The `--port` setting can choose the port it will run on, and the `--socket` setting allows it to run on a Unix socket.
149+
150+
Authorization can be provided via the `Authorization` header using the Bearer scheme.
151+
152+
Additionally, authorization can be provided via the following headers:
153+
| Header | Equivalent client option | Security scheme |
154+
| ------------------- | ------------------------ | --------------- |
155+
| `x-schools-api-key` | `apiKey` | bearerAuth |
156+
157+
A configuration JSON for this server might look like this, assuming the server is hosted at `http://localhost:3000`:
158+
159+
```json
160+
{
161+
"mcpServers": {
162+
"schools_sdk_api": {
163+
"url": "http://localhost:3000",
164+
"headers": {
165+
"Authorization": "Bearer <auth value>"
166+
}
167+
}
168+
}
169+
}
170+
```
171+
172+
The command-line arguments for filtering tools and specifying clients can also be used as query parameters in the URL.
173+
For example, to exclude specific tools while including others, use the URL:
174+
175+
```
176+
http://localhost:3000?resource=cards&resource=accounts&no_tool=create_cards
177+
```
178+
179+
Or, to configure for the Cursor client, with a custom max tool name length, use the URL:
180+
181+
```
182+
http://localhost:3000?client=cursor&capability=tool-name-length%3D40
183+
```
184+
185+
## Importing the tools and server individually
186+
187+
```js
188+
// Import the server, generated endpoints, or the init function
189+
import { server, endpoints, init } from "schools-sdk-mcp/server";
190+
191+
// import a specific tool
192+
import checkHealth from "schools-sdk-mcp/tools/health/check-health";
193+
194+
// initialize the server and all endpoints
195+
init({ server, endpoints });
196+
197+
// manually start server
198+
const transport = new StdioServerTransport();
199+
await server.connect(transport);
200+
201+
// or initialize your own server with specific tools
202+
const myServer = new McpServer(...);
203+
204+
// define your own endpoint
205+
const myCustomEndpoint = {
206+
tool: {
207+
name: 'my_custom_tool',
208+
description: 'My custom tool',
209+
inputSchema: zodToJsonSchema(z.object({ a_property: z.string() })),
210+
},
211+
handler: async (client: client, args: any) => {
212+
return { myResponse: 'Hello world!' };
213+
})
214+
};
215+
216+
// initialize the server with your custom endpoints
217+
init({ server: myServer, endpoints: [checkHealth, myCustomEndpoint] });
218+
```
219+
220+
## Available Tools
221+
222+
The following tools are available in this MCP server.
223+
224+
### Resource `health`:
225+
226+
- `check_health` (`read`): API health check
227+
228+
### Resource `root`:
229+
230+
- `retrieve_root` (`read`): API root information
231+
232+
### Resource `schools`:
233+
234+
- `retrieve_schools` (`read`): Get school by School ID
235+
- `list_schools` (`read`): Get all schools with filtering
236+
- `by_authority_schools` (`read`): Get schools by authority
237+
- `by_city_schools` (`read`): Get schools by city
238+
- `by_status_schools` (`read`): Get schools by status
239+
- `by_suburb_schools` (`read`): Get schools by suburb
240+
- `search_schools` (`read`): Full-text search schools by name
241+
242+
### Resource `sync`:
243+
244+
- `get_status_sync` (`read`): Get sync status
245+
- `trigger_sync` (`write`): Trigger manual data sync

0 commit comments

Comments
 (0)