Skip to content

Commit c9bdea6

Browse files
chore(mcp)!: remove deprecated tool schemes
This removes all tool schemes except for "code mode" tools. Specifically, this removes "all tools" and "dynamic tools" schemes. Additionally, this removes support for resource filtering, tags, jq filtering, and compatibility controls in MCP servers, as they are no longer necessary when using code mode. # Migration To migrate, simply modify the command used to invoke the MCP server. Currently, the only supported tool scheme is code mode. Now, starting the server with just `node /path/to/mcp/server` or `npx package-name` will invoke code tools: changing your command to one of these is likely all you will need to do. Specifically, you must remove all flags including things like --resources, --tags, --client, --tools=dynamic, etc from your invocation command. The only supported flags are now `--port`, `--transport`, `--socket`, and `--tools=docs` (specifically for "docs"). These are also the only options available for http servers. migration-effort: small
1 parent 3f15efc commit c9bdea6

23 files changed

+51
-3798
lines changed

packages/mcp-server/Dockerfile

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ RUN corepack enable && corepack prepare pnpm@latest --activate
4242

4343
# Production stage
4444

45-
FROM denoland/deno:alpine
46-
RUN apk add --no-cache npm
47-
4845
# Add non-root user
4946
RUN addgroup -g 1001 -S nodejs && adduser -S nodejs -u 1001
5047

@@ -70,10 +67,6 @@ COPY --from=builder /build/node_modules ./node_modules
7067
# The MCP server uses stdio transport by default
7168
# No exposed ports needed for stdio communication
7269

73-
# This is needed for node to run on the deno:alpine image.
74-
# See <https://github.com/denoland/deno_docker/issues/373>.
75-
ENV LD_LIBRARY_PATH=/usr/lib:/usr/local/lib
76-
7770
# Set the entrypoint to the MCP server
7871
ENTRYPOINT ["node", "packages/mcp-server/dist/index.js"]
7972

packages/mcp-server/README.md

Lines changed: 13 additions & 203 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ For clients with a configuration JSON, it might look something like this:
2626
"mcpServers": {
2727
"dbahn_stations_api": {
2828
"command": "npx",
29-
"args": ["-y", "dbahn-stations-mcp", "--client=claude", "--tools=all"],
29+
"args": ["-y", "dbahn-stations-mcp"],
3030
"env": {
3131
"DBAHN_STATIONS_CLIENT_ID": "My Client ID",
3232
"DBAHN_STATIONS_CLIENT_SECRET": "My Client Secret"
@@ -59,110 +59,22 @@ environment variables in Claude Code's `.claude.json`, which can be found in you
5959
claude mcp add --transport stdio dbahn_stations_api --env DBAHN_STATIONS_CLIENT_ID="Your DBAHN_STATIONS_CLIENT_ID here." DBAHN_STATIONS_CLIENT_SECRET="Your DBAHN_STATIONS_CLIENT_SECRET here." -- npx -y dbahn-stations-mcp
6060
```
6161

62-
## Exposing endpoints to your MCP Client
62+
## Code Mode
6363

64-
There are three ways to expose endpoints as tools in the MCP server:
64+
This MCP server is built on the "Code Mode" tool scheme. In this MCP Server,
65+
your agent will write code against the TypeScript SDK, which will then be executed in an
66+
isolated sandbox. To accomplish this, the server will expose two tools to your agent:
6567

66-
1. Exposing one tool per endpoint, and filtering as necessary
67-
2. Exposing a set of tools to dynamically discover and invoke endpoints from the API
68-
3. Exposing a docs search tool and a code execution tool, allowing the client to write code to be executed against the TypeScript client
68+
- The first tool is a docs search tool, which can be used to generically query for
69+
documentation about your API/SDK.
6970

70-
### Filtering endpoints and tools
71+
- The second tool is a code tool, where the agent can write code against the TypeScript SDK.
72+
The code will be executed in a sandbox environment without web or filesystem access. Then,
73+
anything the code returns or prints will be returned to the agent as the result of the
74+
tool call.
7175

72-
You can run the package on the command line to discover and filter the set of tools that are exposed by the
73-
MCP Server. This can be helpful for large APIs where including all endpoints at once is too much for your AI's
74-
context window.
75-
76-
You can filter by multiple aspects:
77-
78-
- `--tool` includes a specific tool by name
79-
- `--resource` includes all tools under a specific resource, and can have wildcards, e.g. `my.resource*`
80-
- `--operation` includes just read (get/list) or just write operations
81-
82-
### Dynamic tools
83-
84-
If you specify `--tools=dynamic` to the MCP server, instead of exposing one tool per endpoint in the API, it will
85-
expose the following tools:
86-
87-
1. `list_api_endpoints` - Discovers available endpoints, with optional filtering by search query
88-
2. `get_api_endpoint_schema` - Gets detailed schema information for a specific endpoint
89-
3. `invoke_api_endpoint` - Executes any endpoint with the appropriate parameters
90-
91-
This allows you to have the full set of API endpoints available to your MCP Client, while not requiring that all
92-
of their schemas be loaded into context at once. Instead, the LLM will automatically use these tools together to
93-
search for, look up, and invoke endpoints dynamically. However, due to the indirect nature of the schemas, it
94-
can struggle to provide the correct properties a bit more than when tools are imported explicitly. Therefore,
95-
you can opt-in to explicit tools, the dynamic tools, or both.
96-
97-
See more information with `--help`.
98-
99-
All of these command-line options can be repeated, combined together, and have corresponding exclusion versions (e.g. `--no-tool`).
100-
101-
Use `--list` to see the list of available tools, or see below.
102-
103-
### Code execution
104-
105-
If you specify `--tools=code` to the MCP server, it will expose just two tools:
106-
107-
- `search_docs` - Searches the API documentation and returns a list of markdown results
108-
- `execute` - Runs code against the TypeScript client
109-
110-
This allows the LLM to implement more complex logic by chaining together many API calls without loading
111-
intermediary results into its context window.
112-
113-
The code execution itself happens in a Deno sandbox that has network access only to the base URL for the API.
114-
115-
### Specifying the MCP Client
116-
117-
Different clients have varying abilities to handle arbitrary tools and schemas.
118-
119-
You can specify the client you are using with the `--client` argument, and the MCP server will automatically
120-
serve tools and schemas that are more compatible with that client.
121-
122-
- `--client=<type>`: Set all capabilities based on a known MCP client
123-
124-
- Valid values: `openai-agents`, `claude`, `claude-code`, `cursor`
125-
- Example: `--client=cursor`
126-
127-
Additionally, if you have a client not on the above list, or the client has gotten better
128-
over time, you can manually enable or disable certain capabilities:
129-
130-
- `--capability=<name>`: Specify individual client capabilities
131-
- Available capabilities:
132-
- `top-level-unions`: Enable support for top-level unions in tool schemas
133-
- `valid-json`: Enable JSON string parsing for arguments
134-
- `refs`: Enable support for $ref pointers in schemas
135-
- `unions`: Enable support for union types (anyOf) in schemas
136-
- `formats`: Enable support for format validations in schemas (e.g. date-time, email)
137-
- `tool-name-length=N`: Set maximum tool name length to N characters
138-
- Example: `--capability=top-level-unions --capability=tool-name-length=40`
139-
- Example: `--capability=top-level-unions,tool-name-length=40`
140-
141-
### Examples
142-
143-
1. Filter for read operations on cards:
144-
145-
```bash
146-
--resource=cards --operation=read
147-
```
148-
149-
2. Exclude specific tools while including others:
150-
151-
```bash
152-
--resource=cards --no-tool=create_cards
153-
```
154-
155-
3. Configure for Cursor client with custom max tool name length:
156-
157-
```bash
158-
--client=cursor --capability=tool-name-length=40
159-
```
160-
161-
4. Complex filtering with multiple criteria:
162-
163-
```bash
164-
--resource=cards,accounts --operation=read --tag=kyc --no-tool=create_cards
165-
```
76+
Using this scheme, agents are capable of performing very complex tasks deterministically
77+
and repeatably.
16678

16779
## Running remotely
16880

@@ -188,105 +100,3 @@ A configuration JSON for this server might look like this, assuming the server i
188100
}
189101
}
190102
```
191-
192-
The command-line arguments for filtering tools and specifying clients can also be used as query parameters in the URL.
193-
For example, to exclude specific tools while including others, use the URL:
194-
195-
```
196-
http://localhost:3000?resource=cards&resource=accounts&no_tool=create_cards
197-
```
198-
199-
Or, to configure for the Cursor client, with a custom max tool name length, use the URL:
200-
201-
```
202-
http://localhost:3000?client=cursor&capability=tool-name-length%3D40
203-
```
204-
205-
## Importing the tools and server individually
206-
207-
```js
208-
// Import the server, generated endpoints, or the init function
209-
import { server, endpoints, init } from "dbahn-stations-mcp/server";
210-
211-
// import a specific tool
212-
import retrieveStations from "dbahn-stations-mcp/tools/stations/retrieve-stations";
213-
214-
// initialize the server and all endpoints
215-
init({ server, endpoints });
216-
217-
// manually start server
218-
const transport = new StdioServerTransport();
219-
await server.connect(transport);
220-
221-
// or initialize your own server with specific tools
222-
const myServer = new McpServer(...);
223-
224-
// define your own endpoint
225-
const myCustomEndpoint = {
226-
tool: {
227-
name: 'my_custom_tool',
228-
description: 'My custom tool',
229-
inputSchema: zodToJsonSchema(z.object({ a_property: z.string() })),
230-
},
231-
handler: async (client: client, args: any) => {
232-
return { myResponse: 'Hello world!' };
233-
})
234-
};
235-
236-
// initialize the server with your custom endpoints
237-
init({ server: myServer, endpoints: [retrieveStations, myCustomEndpoint] });
238-
```
239-
240-
## Available Tools
241-
242-
The following tools are available in this MCP server.
243-
244-
### Resource `stations`:
245-
246-
- `retrieve_stations` (`read`): Get a QueryResult object containing one station object specified by its id.
247-
- `list_stations` (`read`): Get a QueryResult object containing station objects from the database applying to the parameters described below.
248-
249-
QueryResult is a container providing the following information about the query result.
250-
251-
1. the total number of hits
252-
2. the maximum number of hits to be returned in that QueryResult object
253-
3. the offset of the first hit returned in that QueryResult object with respect to all hits returned by the query
254-
4. the result objects
255-
256-
The parameters described below work as filters to reduce the number of hits returned. Some of these parameters must be used only once, others are allowed to be used multiple times. Valid parameters that are allowed to be used only once are _offset_, _limit_ and _logicaloperator_.
257-
258-
All other parameters described below may be used multiple times.
259-
260-
If a parameter is given more than once, the result will contain all hits that match all given parameter values.
261-
262-
E.g. _federalstate=berlin&federalstate=saarland_ returns all stations in Berlin and Saarland.
263-
264-
If more than one filter criterion is used at the same time, the different filter criteria are interpreted as if they are combined by a logical AND operator, unless the parameter _logicaloperator_ is set to _or_.
265-
266-
E.g. _category=1-2&federalstate=hamburg_ returns all stations in Hamburg having category 1 or 2.
267-
268-
_category=1-2&federalstate=hamburg&federalsate=hessen_ returns all stations in Hamburg and Hessen having category 1 or 2, while
269-
270-
_searchstring=berlin\*&federalstate=hamburg&federalsate=hessen&logicaloperator=or_ will return all stations with a name starting with 'berlin' as well as all stations in Hamburg and Hessen.
271-
272-
If no 'limit' parameter is given, the number of hits (stations) is set to its maximum value of 10000.
273-
274-
To specify parameter values containing German umlauts, the following encoding has to be used
275-
276-
- ä => %C3%A4
277-
- ö => %C3%B6
278-
- ü => %C3%BC
279-
- Ä => %C3%84
280-
- Ö => %C3%96
281-
- Ü => %C3%9C
282-
- ß => %C3%9F
283-
284-
### Resource `szentralen`:
285-
286-
- `retrieve_szentralen` (`read`): Get a QueryResult object containing one SZentralen object specified by its id.
287-
- `list_szentralen` (`read`): Get a QueryResult object containing SZentralen objects from the database applying to the parameters described below.
288-
QueryResult is a container providing the following information about the query result.
289-
1. the total number of hits
290-
2. the maximum number of hits to be returned in that QueryResult object
291-
3. the offset of the first hit returned in that QueryResult object with respect to all hits returned by the query
292-
4. the result objects

packages/mcp-server/src/code-tool.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
import { Metadata, ToolCallResult, asTextContentResult } from './tools/types';
3+
import { McpTool, Metadata, ToolCallResult, asTextContentResult } from './types';
44
import { Tool } from '@modelcontextprotocol/sdk/types.js';
55
import { readEnv } from './server';
66
import { WorkerSuccess } from './code-tool-types';
@@ -13,7 +13,7 @@ import { WorkerSuccess } from './code-tool-types';
1313
*
1414
* @param endpoints - The endpoints to include in the list.
1515
*/
16-
export async function codeTool() {
16+
export function codeTool(): McpTool {
1717
const metadata: Metadata = { resource: 'all', operation: 'write', tags: [] };
1818
const tool: Tool = {
1919
name: 'execute',

0 commit comments

Comments
 (0)