Skip to content

Commit b2211b7

Browse files
committed
Minor updates to REAMDE and usage examples
1 parent 62cbeb2 commit b2211b7

File tree

3 files changed

+47
-41
lines changed

3 files changed

+47
-41
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

88

9+
## [Unreleased]
10+
11+
### Changed
12+
- Minor updates to REAMDE and usage examples
13+
14+
915
## [0.3.8] - 2025-09-03
1016

1117
### Fixed

README.md

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,25 @@ const agent = createReactAgent({
9696
});
9797
```
9898

99+
The returned `cleanup` function properly handles resource cleanup:
100+
101+
- Closes all MCP server connections concurrently and logs any cleanup failures
102+
- Continues cleanup of remaining servers even if some fail
103+
- Should always be called when done using the tools
104+
105+
It is typically invoked in a finally block:
106+
107+
```ts
108+
const { tools, cleanup } = await convertMcpToLangchainTools(mcpServers);
109+
110+
try {
111+
// Use tools with your LLM
112+
} finally {
113+
// Always cleanup, even if errors occur
114+
await cleanup();
115+
}
116+
```
117+
99118
A minimal but complete working usage example can be found
100119
[in this example in the langchain-mcp-tools-ts-usage repo](https://github.com/hideya/langchain-mcp-tools-ts-usage/blob/main/src/index.ts)
101120

@@ -145,14 +164,6 @@ While MCP tools can return multiple content types (text, images, etc.), this lib
145164
[See below](https://github.com/hideya/langchain-mcp-tools-ts/blob/main/README.md#llm-provider-schema-compatibility) for details.
146165
- **Passing PATH Env Variable**: The library automatically adds the `PATH` environment variable to stdio server configrations if not explicitly provided to ensure servers can find required executables.
147166

148-
## API docs
149-
150-
Can be found [here](https://hideya.github.io/langchain-mcp-tools-ts/modules.html)
151-
152-
## Building from Source
153-
154-
See [README_DEV.md](https://github.com/hideya/langchain-mcp-tools-ts/blob/main/README_DEV.md) for details.
155-
156167
## Features
157168

158169
### `stderr` Redirection for Local MCP Server
@@ -260,7 +271,7 @@ Streamable HTTP is the modern MCP transport that replaces the older HTTP+SSE tra
260271

261272
### Accessing Remote MCP Servers with OAuth Quickly
262273

263-
If you need to use MCP servers that require OAuth quickly, consider using **"[mcp-remote](https://www.npmjs.com/package/mcp-remote)"**.
274+
If you need to use MCP servers that require OAuth, consider using **"[mcp-remote](https://www.npmjs.com/package/mcp-remote)"**.
264275

265276
```ts
266277
notionMCP: {
@@ -313,10 +324,18 @@ Test implementations are provided:
313324
- MCP client uses this library: [streamable-http-auth-test-client.ts](https://github.com/hideya/langchain-mcp-tools-ts/tree/main/testfiles/streamable-http-auth-test-client.ts)
314325
- Test MCP Server: [streamable-http-auth-test-server.ts](https://github.com/hideya/langchain-mcp-tools-ts/tree/main/testfiles/streamable-http-auth-test-server.ts)
315326

327+
## API docs
328+
329+
Can be found [here](https://hideya.github.io/langchain-mcp-tools-ts/modules.html)
330+
316331
## Change Log
317332

318333
Can be found [here](https://github.com/hideya/langchain-mcp-tools-ts/blob/main/CHANGELOG.md)
319334

335+
## Building from Source
336+
337+
See [README_DEV.md](https://github.com/hideya/langchain-mcp-tools-ts/blob/main/README_DEV.md) for details.
338+
320339
## Appendix
321340

322341
### Troubleshooting
@@ -408,27 +427,6 @@ const { tools, cleanup } = await convertMcpToLangchainTools(
408427
- [Gemini API Schema Requirements](https://ai.google.dev/api/caching#Schema)
409428
- [Anthropic Tool Use](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/overview)
410429

411-
412-
### Resource Management
413-
414-
The returned `cleanup` function properly handles resource cleanup:
415-
416-
- Closes all MCP server connections concurrently
417-
- Logs any cleanup failures
418-
- Continues cleanup of remaining servers even if some fail
419-
- Should always be called when done using the tools
420-
421-
```ts
422-
const { tools, cleanup } = await convertMcpToLangchainTools(mcpServers);
423-
424-
try {
425-
// Use tools with your LLM
426-
} finally {
427-
// Always cleanup, even if errors occur
428-
await cleanup();
429-
}
430-
```
431-
432430
### Debugging and Logging
433431

434432
The library provides configurable logging to help debug connection and tool execution issues:
@@ -458,5 +456,5 @@ Available log levels: `"fatal" | "error" | "warn" | "info" | "debug" | "trace"`
458456

459457
### For Developers
460458

461-
See [README_DEV.md](https://github.com/hideya/langchain-mcp-tools-ts/blob/main/README_DEV.md)
459+
See [./README_DEV.md](https://github.com/hideya/langchain-mcp-tools-ts/blob/main/README_DEV.md)
462460
for more information about development and testing.

testfiles/simple-usage.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,15 @@ export async function test(): Promise<void> {
109109
// }
110110
// },
111111

112+
// // NOTE: comment out "fetch" when you use "notion".
113+
// // They both have a tool named "fetch," which causes a conflict.
114+
//
115+
// // Run Notion remote MCP server via mcp-remote
116+
// notion: {
117+
// "command": "npx", // OAuth via "mcp-remote"
118+
// "args": ["-y", "mcp-remote", "https://mcp.notion.com/mcp"],
119+
// },
120+
//
112121
// // The following Notion local MCP server is not recommended anymore?
113122
// // Refs:
114123
// // - https://developers.notion.com/docs/get-started-with-mcp
@@ -121,12 +130,6 @@ export async function test(): Promise<void> {
121130
// }
122131
// },
123132

124-
// // Run Notion remote MCP server via mcp-remote
125-
// notion: {
126-
// "command": "npx",
127-
// "args": ["-y", "mcp-remote", "https://mcp.notion.com/mcp"],
128-
// },
129-
130133
// airtable: {
131134
// command: "npx",
132135
// "args": ["-y", "airtable-mcp-server"],
@@ -262,13 +265,12 @@ export async function test(): Promise<void> {
262265
// const query = "Tell me how LLMs work in a few sentences";
263266
// const query = "Read the news headlines on bbc.com";
264267
// const query = "Read and briefly summarize the LICENSE file";
265-
// const query = "Tell me how many of directories in `.`";
268+
// const query = "Tell me how many directories there are in `.`";
266269
// const query = "Tell me about my GitHub profile";
267270
// const query = "Make a new table in DB and put items apple and orange with counts 123 and 345 respectively, " +
268271
// "then increment the coutns by 1, and show all the items in the table.";
269-
// const query = "Use sequential thinking to arrange these events of backing bread " +
270-
// "in the correct sequence: baking, proofing, mixing, kneading, cooling";
271-
// const query = "Open bbc.com page";
272+
// const query = "Use sequential-thinking and plan a trip from Tokyo to San Francisco";
273+
// const query = "Open the BBC.com page, then close it";
272274
// const query = "Tell me about my Notion account";
273275
// const query = "Tell me about my Airtable account";
274276
// const query = "What's the news from Tokyo today?";

0 commit comments

Comments
 (0)