1
1
# mcp-langchain-ts-client
2
2
3
- A TypeScript client library for MCP Langchain.
3
+ A LangChain.js client for Model Context Protocol.
4
+
5
+ This is a port of [ rectalogic/langchain-mcp] ( https://github.com/rectalogic/langchain-mcp ) to the JS/TS LangChain and MCP APIs.
4
6
5
7
## Installation
6
8
@@ -11,29 +13,25 @@ npm install mcp-langchain-ts-client
11
13
## Usage
12
14
13
15
``` typescript
14
- import { StringUtils } from ' mcp-langchain-ts-client' ;
15
-
16
- // Use the client...
17
- ```
18
-
19
- ## Development
20
-
21
- 1 . Clone the repository
22
- 2 . Install dependencies: ` npm install `
23
- 3 . Run tests: ` npm test `
24
- 4 . Run tests with watch mode: ` npm run test:watch `
25
- 5 . Run tests with coverage: ` npm run test:coverage `
26
- 6 . Build: ` npm run build `
27
-
28
- ## Testing
29
-
30
- This project uses Vitest for testing, which offers:
31
- - Fast parallel test execution
32
- - Native TypeScript support
33
- - Built-in coverage reporting
34
- - Interactive watch mode
35
- - Compatible with Jest's expect API
36
-
37
- ## License
38
-
39
- MIT
16
+ const serverParams = {
17
+ command: " npx" ,
18
+ args: [
19
+ " -y" ,
20
+ " @modelcontextprotocol/server-everything"
21
+ ]
22
+ }
23
+
24
+ // Initialize the toolkit
25
+ const toolkit = new MCPToolkit (serverParams );
26
+ await toolkit .initialize ();
27
+
28
+ // Extract LangChain.js compatible tools
29
+ const tools = toolkit .tools ;
30
+
31
+ // Use the tools
32
+ import { createReactAgent } from " @langchain/langgraph/prebuilt" ;
33
+ import { ChatAnthropic } from " @langchain/anthropic" ;
34
+
35
+ const llm = new ChatAnthropic ({ model: ' claude-3-5-sonnet-20241022' });
36
+ const agent = createReactAgent ({ llm , tools });
37
+ ```
0 commit comments