{"id":24634491,"url":"https://github.com/hideya/langchain-mcp-tools-py-usage","last_synced_at":"2026-01-19T00:33:44.789Z","repository":{"id":272396421,"uuid":"916441376","full_name":"hideya/langchain-mcp-tools-py-usage","owner":"hideya","description":"MCP Tools Usage From LangChain ReAct Agent / Example in Python","archived":false,"fork":false,"pushed_at":"2025-09-11T06:41:53.000Z","size":351,"stargazers_count":6,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-11T09:56:12.778Z","etag":null,"topics":["langchain","langchain-python","mcp","mcp-client","modelcontextprotocol","python","tool-call","tool-calling"],"latest_commit_sha":null,"homepage":"","language":"Python","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-01-14T05:14:53.000Z","updated_at":"2025-09-11T06:41:56.000Z","dependencies_parsed_at":"2025-03-13T12:24:52.826Z","dependency_job_id":"7dc074af-b500-44d6-81cb-78781f8c1d4e","html_url":"https://github.com/hideya/langchain-mcp-tools-py-usage","commit_stats":null,"previous_names":["hideya/langchain-mcp-tools-py-usage"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hideya/langchain-mcp-tools-py-usage","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hideya%2Flangchain-mcp-tools-py-usage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hideya%2Flangchain-mcp-tools-py-usage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hideya%2Flangchain-mcp-tools-py-usage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hideya%2Flangchain-mcp-tools-py-usage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hideya","download_url":"https://codeload.github.com/hideya/langchain-mcp-tools-py-usage/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hideya%2Flangchain-mcp-tools-py-usage/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28554397,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T23:48:35.235Z","status":"ssl_error","status_checked_at":"2026-01-18T23:47:49.178Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-python","mcp","mcp-client","modelcontextprotocol","python","tool-call","tool-calling"],"created_at":"2025-01-25T09:12:52.564Z","updated_at":"2026-01-19T00:33:44.783Z","avatar_url":"https://github.com/hideya.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MCP Tools Usage From LangChain / Example in Python [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/hideya/langchain-mcp-tools-py-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 `convert_mcp_to_langchain_tools()` from\n[`langchain_mcp_tools`](https://pypi.org/project/langchain-mcp-tools/).  \nThis function handles parallel initialization of specified multiple MCP servers\nand converts their available tools into a list of LangChain-compatible tools\n([list[BaseTool]](https://python.langchain.com/api_reference/core/tools/langchain_core.tools.base.BaseTool.html#langchain_core.tools.base.BaseTool)).\n\nGoogle GenAI's `gemini-2.5-flash` is used as the LLM.\nFor convenience, code for OpenAI's and Anthropic's LLMs are also included and commented out.\n\nA bit more realistic (conversational) MCP Client is available\n[here](https://github.com/hideya/mcp-client-langchain-py)\n\nA typescript equivalent of this MCP client is available\n[here](https://github.com/hideya/langchain-mcp-tools-ts-usage)\n\n## Prerequisites\n\n- Python 3.11+\n- [optional] [`uv` (`uvx`)](https://docs.astral.sh/uv/getting-started/installation/)\n  installed to run Python package-based MCP servers\n- [optional] [npm 7+ (`npx`)](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)\n  to run Node.js package-based MCP servers\n- LLM API keys from\n  [OpenAI](https://platform.openai.com/api-keys),\n  [Anthropic](https://console.anthropic.com/settings/keys),\n  and/or\n  [Google GenAI](https://aistudio.google.com/apikey)\n  as needed\n\n## Usage\n\n1. Install dependencies:\n    ```bash\n    make 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    make start\n    ```\n    It takes a while on the first run.\n\n## Simple Exapmle Code for Streamable HTTP 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/streamable_http_oauth_test_client.py`](src/streamable_http_oauth_test_client.py).  \n\nFor testing purposes, a sample MCP server with OAuth authentication support\nthat works with the above client is provided\nin [`src/streamable_http_oauth_test_server.py`](src/streamable_http_oauth_test_server.py).  \n\nYou can run the server with `make run-streamable-http-oauth-test-server`\nand the client with make `run-streamable-http-oauth-test-client`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhideya%2Flangchain-mcp-tools-py-usage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhideya%2Flangchain-mcp-tools-py-usage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhideya%2Flangchain-mcp-tools-py-usage/lists"}