{"id":24401609,"url":"https://github.com/hideya/langchain-mcp-tools-ts-usage","last_synced_at":"2025-04-23T00:42:35.492Z","repository":{"id":271189361,"uuid":"912652974","full_name":"hideya/langchain-mcp-tools-ts-usage","owner":"hideya","description":"MCP Tools Usage From LangChain ReAct Agent / Example in TypeScript","archived":false,"fork":false,"pushed_at":"2025-04-22T03:23:25.000Z","size":94,"stargazers_count":12,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-23T00:42:27.786Z","etag":null,"topics":["langchain","langchain-typescript","mcp","mcp-client","modelcontextprotocol","nodejs","tool-call","tool-calling","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hideya.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-01-06T05:44:45.000Z","updated_at":"2025-04-22T03:23:29.000Z","dependencies_parsed_at":"2025-01-28T23:27:41.685Z","dependency_job_id":"5d1490b9-ca3c-429b-be92-a1cdfb4b6ee7","html_url":"https://github.com/hideya/langchain-mcp-tools-ts-usage","commit_stats":null,"previous_names":["hideya/mcp-langchain-tools-usage","hideya/mcp-langchain-tools-ts-usage","hideya/langchain-mcp-tools-ts-usage"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hideya%2Flangchain-mcp-tools-ts-usage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hideya%2Flangchain-mcp-tools-ts-usage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hideya%2Flangchain-mcp-tools-ts-usage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hideya%2Flangchain-mcp-tools-ts-usage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hideya","download_url":"https://codeload.github.com/hideya/langchain-mcp-tools-ts-usage/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250348891,"owners_count":21415907,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["langchain","langchain-typescript","mcp","mcp-client","modelcontextprotocol","nodejs","tool-call","tool-calling","typescript"],"created_at":"2025-01-20T00:32:32.510Z","updated_at":"2025-04-23T00:42:35.479Z","avatar_url":"https://github.com/hideya.png","language":"TypeScript","funding_links":[],"categories":["🌐 Web Development"],"sub_categories":[],"readme":"# MCP Tools Usage From LangChain / Example in TypeScript [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/hideya/mcp-langchain-tools-ts-usage/blob/main/LICENSE)\n\nThis simple [Model Context Protocol (MCP)](https://modelcontextprotocol.io/)\nclient demonstrates the use of MCP server tools by LangChain ReAct Agent.\n\nIt leverages a utility function `convertMcpToLangchainTools()` from\n[`@h1deya/langchain-mcp-tools`](https://www.npmjs.com/package/@h1deya/langchain-mcp-tools).  \nThis function handles parallel initialization of specified multiple MCP servers\nand converts their available tools into an array of LangChain-compatible tools\n([`StructuredTool[]`](https://api.js.langchain.com/classes/_langchain_core.tools.StructuredTool.html)).\n\nAnthropic's `claude-3-5-sonnet-latest` is used as the LLM.\nFor convenience, code for OpenAI's `gpt-4o` is also included and commented out.\n\nA bit more realistic (conversational) MCP Client is available\n[here](https://github.com/hideya/mcp-client-langchain-ts)\n\nA python equivalent of this app is available\n[here](https://github.com/hideya/langchain-mcp-tools-py-usage)\n\n## Prerequisites\n\n- Node.js 16+\n- npm 7+ (`npx`) to run Node.js-based MCP servers\n- [optional] [`uv` (`uvx`)](https://docs.astral.sh/uv/getting-started/installation/)\n  installed to run Python-based MCP servers\n- API key from [Anthropic](https://console.anthropic.com/settings/keys)\n  (or [OpenAI](https://platform.openai.com/api-keys))\n\n## Usage\n\n1. Install dependencies:\n\n    ```bash\n    npm install\n    ```\n\n2. Setup API key:\n    ```bash\n    cp .env.template .env\n    ```\n    - Update `.env` as needed.\n    - `.gitignore` is configured to ignore `.env`\n      to prevent accidental commits of the credentials.\n\n3. Run the app:\n    ```bash\n    npm start\n    ```\n\n## Sample Code for SSE Authentiocation\n\nA simple example of showing how to implement an OAuth client provider and\nuse it with the `langchain-mcp-tools` library can be found\nin [`src/sse-auth-test-client.ts`](src/sse-auth-test-client.ts).  \n\nFor testing purposes, a sample MCP server with OAuth authentication support\nthat works with the above client is provided\nin [`src/sse-auth-test-server.ts`](src/sse-auth-test-server.ts).  \n\nYou can run the server with `npm run sse-auth-test-server`\nand the client with `npm run sse-auth-test-client`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhideya%2Flangchain-mcp-tools-ts-usage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhideya%2Flangchain-mcp-tools-ts-usage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhideya%2Flangchain-mcp-tools-ts-usage/lists"}