@@ -25,7 +25,7 @@ For clients with a configuration JSON, it might look something like this:
2525 "mcpServers" : {
2626 "cas_parser_node_api" : {
2727 "command" : " npx" ,
28- "args" : [" -y" , " cas-parser-node-mcp" , " --client=claude " , " --tools=all " ],
28+ "args" : [" -y" , " cas-parser-node-mcp" ],
2929 "env" : {
3030 "CAS_PARSER_API_KEY" : " My API Key"
3131 }
@@ -57,110 +57,22 @@ environment variables in Claude Code's `.claude.json`, which can be found in you
5757claude mcp add --transport stdio cas_parser_node_api --env CAS_PARSER_API_KEY="Your CAS_PARSER_API_KEY here." -- npx -y cas-parser-node-mcp
5858```
5959
60- ## Exposing endpoints to your MCP Client
60+ ## Code Mode
6161
62- There are three ways to expose endpoints as tools in the MCP server:
62+ This MCP server is built on the "Code Mode" tool scheme. In this MCP Server,
63+ your agent will write code against the TypeScript SDK, which will then be executed in an
64+ isolated sandbox. To accomplish this, the server will expose two tools to your agent:
6365
64- 1 . Exposing one tool per endpoint, and filtering as necessary
65- 2 . Exposing a set of tools to dynamically discover and invoke endpoints from the API
66- 3 . Exposing a docs search tool and a code execution tool, allowing the client to write code to be executed against the TypeScript client
66+ - The first tool is a docs search tool, which can be used to generically query for
67+ documentation about your API/SDK.
6768
68- ### Filtering endpoints and tools
69+ - The second tool is a code tool, where the agent can write code against the TypeScript SDK.
70+ The code will be executed in a sandbox environment without web or filesystem access. Then,
71+ anything the code returns or prints will be returned to the agent as the result of the
72+ tool call.
6973
70- You can run the package on the command line to discover and filter the set of tools that are exposed by the
71- MCP Server. This can be helpful for large APIs where including all endpoints at once is too much for your AI's
72- context window.
73-
74- You can filter by multiple aspects:
75-
76- - ` --tool ` includes a specific tool by name
77- - ` --resource ` includes all tools under a specific resource, and can have wildcards, e.g. ` my.resource* `
78- - ` --operation ` includes just read (get/list) or just write operations
79-
80- ### Dynamic tools
81-
82- If you specify ` --tools=dynamic ` to the MCP server, instead of exposing one tool per endpoint in the API, it will
83- expose the following tools:
84-
85- 1 . ` list_api_endpoints ` - Discovers available endpoints, with optional filtering by search query
86- 2 . ` get_api_endpoint_schema ` - Gets detailed schema information for a specific endpoint
87- 3 . ` invoke_api_endpoint ` - Executes any endpoint with the appropriate parameters
88-
89- This allows you to have the full set of API endpoints available to your MCP Client, while not requiring that all
90- of their schemas be loaded into context at once. Instead, the LLM will automatically use these tools together to
91- search for, look up, and invoke endpoints dynamically. However, due to the indirect nature of the schemas, it
92- can struggle to provide the correct properties a bit more than when tools are imported explicitly. Therefore,
93- you can opt-in to explicit tools, the dynamic tools, or both.
94-
95- See more information with ` --help ` .
96-
97- All of these command-line options can be repeated, combined together, and have corresponding exclusion versions (e.g. ` --no-tool ` ).
98-
99- Use ` --list ` to see the list of available tools, or see below.
100-
101- ### Code execution
102-
103- If you specify ` --tools=code ` to the MCP server, it will expose just two tools:
104-
105- - ` search_docs ` - Searches the API documentation and returns a list of markdown results
106- - ` execute ` - Runs code against the TypeScript client
107-
108- This allows the LLM to implement more complex logic by chaining together many API calls without loading
109- intermediary results into its context window.
110-
111- The code execution itself happens in a Deno sandbox that has network access only to the base URL for the API.
112-
113- ### Specifying the MCP Client
114-
115- Different clients have varying abilities to handle arbitrary tools and schemas.
116-
117- You can specify the client you are using with the ` --client ` argument, and the MCP server will automatically
118- serve tools and schemas that are more compatible with that client.
119-
120- - ` --client=<type> ` : Set all capabilities based on a known MCP client
121-
122- - Valid values: ` openai-agents ` , ` claude ` , ` claude-code ` , ` cursor `
123- - Example: ` --client=cursor `
124-
125- Additionally, if you have a client not on the above list, or the client has gotten better
126- over time, you can manually enable or disable certain capabilities:
127-
128- - ` --capability=<name> ` : Specify individual client capabilities
129- - Available capabilities:
130- - ` top-level-unions ` : Enable support for top-level unions in tool schemas
131- - ` valid-json ` : Enable JSON string parsing for arguments
132- - ` refs ` : Enable support for $ref pointers in schemas
133- - ` unions ` : Enable support for union types (anyOf) in schemas
134- - ` formats ` : Enable support for format validations in schemas (e.g. date-time, email)
135- - ` tool-name-length=N ` : Set maximum tool name length to N characters
136- - Example: ` --capability=top-level-unions --capability=tool-name-length=40 `
137- - Example: ` --capability=top-level-unions,tool-name-length=40 `
138-
139- ### Examples
140-
141- 1 . Filter for read operations on cards:
142-
143- ``` bash
144- --resource=cards --operation=read
145- ```
146-
147- 2 . Exclude specific tools while including others:
148-
149- ``` bash
150- --resource=cards --no-tool=create_cards
151- ```
152-
153- 3 . Configure for Cursor client with custom max tool name length:
154-
155- ``` bash
156- --client=cursor --capability=tool-name-length=40
157- ```
158-
159- 4 . Complex filtering with multiple criteria:
160-
161- ``` bash
162- --resource=cards,accounts --operation=read --tag=kyc --no-tool=create_cards
163- ```
74+ Using this scheme, agents are capable of performing very complex tasks deterministically
75+ and repeatably.
16476
16577## Running remotely
16678
@@ -185,71 +97,3 @@ A configuration JSON for this server might look like this, assuming the server i
18597 }
18698}
18799```
188-
189- The command-line arguments for filtering tools and specifying clients can also be used as query parameters in the URL.
190- For example, to exclude specific tools while including others, use the URL:
191-
192- ```
193- http://localhost:3000?resource=cards&resource=accounts&no_tool=create_cards
194- ```
195-
196- Or, to configure for the Cursor client, with a custom max tool name length, use the URL:
197-
198- ```
199- http://localhost:3000?client=cursor&capability=tool-name-length%3D40
200- ```
201-
202- ## Importing the tools and server individually
203-
204- ``` js
205- // Import the server, generated endpoints, or the init function
206- import { server , endpoints , init } from " cas-parser-node-mcp/server" ;
207-
208- // import a specific tool
209- import camsKfintechCasParser from " cas-parser-node-mcp/tools/cas-parser/cams-kfintech-cas-parser" ;
210-
211- // initialize the server and all endpoints
212- init ({ server, endpoints });
213-
214- // manually start server
215- const transport = new StdioServerTransport ();
216- await server .connect (transport);
217-
218- // or initialize your own server with specific tools
219- const myServer = new McpServer (... );
220-
221- // define your own endpoint
222- const myCustomEndpoint = {
223- tool: {
224- name: ' my_custom_tool' ,
225- description: ' My custom tool' ,
226- inputSchema: zodToJsonSchema (z .object ({ a_property: z .string () })),
227- },
228- handler: async (client : client , args : any ) => {
229- return { myResponse: ' Hello world!' };
230- })
231- };
232-
233- // initialize the server with your custom endpoints
234- init ({ server: myServer, endpoints: [camsKfintechCasParser, myCustomEndpoint] });
235- ```
236-
237- ## Available Tools
238-
239- The following tools are available in this MCP server.
240-
241- ### Resource ` CAS Parser ` :
242-
243- - ` cams_kfintech_cas_parser ` (` write ` ): This endpoint specifically parses CAMS/KFintech CAS (Consolidated Account Statement) PDF files and returns data in a unified format.
244- Use this endpoint when you know the PDF is from CAMS or KFintech.
245- - ` cdsl_cas_parser ` (` write ` ): This endpoint specifically parses CDSL CAS (Consolidated Account Statement) PDF files and returns data in a unified format.
246- Use this endpoint when you know the PDF is from CDSL.
247- - ` nsdl_cas_parser ` (` write ` ): This endpoint specifically parses NSDL CAS (Consolidated Account Statement) PDF files and returns data in a unified format.
248- Use this endpoint when you know the PDF is from NSDL.
249- - ` smart_parse_cas_parser ` (` write ` ): This endpoint parses CAS (Consolidated Account Statement) PDF files from NSDL, CDSL, or CAMS/KFintech and returns data in a unified format.
250- It auto-detects the CAS type and transforms the data into a consistent structure regardless of the source.
251-
252- ### Resource ` CAS Generator ` :
253-
254- - ` generate_cas_cas_generator ` (` write ` ): This endpoint generates CAS (Consolidated Account Statement) documents by submitting a mailback request to the specified CAS authority.
255- Currently only supports KFintech, with plans to support CAMS, CDSL, and NSDL in the future.
0 commit comments