{"id":29360075,"url":"https://github.com/liteobject/langchain-mcp-server","last_synced_at":"2026-04-02T18:52:17.269Z","repository":{"id":302754986,"uuid":"1013496730","full_name":"LiteObject/langchain-mcp-server","owner":"LiteObject","description":"MCP server that provides LangChain documentation","archived":false,"fork":false,"pushed_at":"2025-07-05T14:18:35.000Z","size":54,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-05T15:31:54.682Z","etag":null,"topics":["ai","ai-agent","docker","fastapi","langchain","llm","mcp","mcp-server","modelcontextprotocol","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LiteObject.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-07-04T02:21:09.000Z","updated_at":"2025-07-05T14:18:38.000Z","dependencies_parsed_at":"2025-07-04T04:31:00.129Z","dependency_job_id":"eb6d9076-f763-45ee-b5a0-1c0de1a3169d","html_url":"https://github.com/LiteObject/langchain-mcp-server","commit_stats":null,"previous_names":["liteobject/mcp-server-with-fastapi","liteobject/langchain-mcp-server"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/LiteObject/langchain-mcp-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiteObject%2Flangchain-mcp-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiteObject%2Flangchain-mcp-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiteObject%2Flangchain-mcp-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiteObject%2Flangchain-mcp-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LiteObject","download_url":"https://codeload.github.com/LiteObject/langchain-mcp-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiteObject%2Flangchain-mcp-server/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264411163,"owners_count":23603804,"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":["ai","ai-agent","docker","fastapi","langchain","llm","mcp","mcp-server","modelcontextprotocol","python"],"created_at":"2025-07-09T07:09:45.619Z","updated_at":"2025-12-30T21:52:17.299Z","avatar_url":"https://github.com/LiteObject.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LangChain Documentation MCP Server\n\nA comprehensive dual-mode server that provides real-time access to LangChain documentation, API references, and code examples. Supports both FastAPI web service and native Model Context Protocol (MCP) server modes, fetching live data from official LangChain sources.\n\n## 🚀 Features\n\n- **�️ Dual Server Modes** - Run as FastAPI web service or native MCP server\n- **�📚 Live Documentation Search** - Search through official LangChain documentation in real-time\n- **🔍 API Reference Lookup** - Get detailed API references from GitHub source code\n- **🐙 GitHub Code Examples** - Fetch real code examples from the LangChain repository\n- **📖 Tutorial Discovery** - Find and access LangChain tutorials and guides\n- **📦 Version Tracking** - Get latest version information from PyPI\n- **🔗 Direct API Search** - Search specifically through API reference documentation\n- **🔌 MCP Protocol Support** - Native Model Context Protocol implementation\n\n## 🌐 Data Sources\n\nThis server fetches live data from:\n- **python.langchain.com** - Official LangChain documentation\n- **GitHub LangChain Repository** - Source code and examples\n- **PyPI** - Latest version and release information\n\n## 📋 API Endpoints\n\n### Core Endpoints\n- `GET /` - API documentation (Swagger UI)\n- `GET /health` - Health check and service status\n\n### LangChain Documentation\n- `GET /search` - Search general documentation\n- `GET /search/api` - Search API reference specifically\n- `GET /api-reference/{class_name}` - Get detailed API reference for a class\n- `GET /examples/github` - Get real code examples from GitHub\n- `GET /tutorials` - Get tutorials and guides\n- `GET /latest-version` - Get latest LangChain version info\n\n## 🚀 Quick Start\n\n### Option 1: Docker Compose (Recommended)\n\n1. **Clone the repository**\n   ```bash\n   git clone https://github.com/LiteObject/langchain-mcp-server.git\n   cd langchain-mcp-server\n   ```\n\n2. **Start the FastAPI server**\n   ```bash\n   docker-compose up --build\n   ```\n\n3. **Access the API**\n   - API Documentation: http://localhost:8080/docs\n   - Health Check: http://localhost:8080/health\n\n### Option 2: Local Development\n\n#### FastAPI Mode\n1. **Install dependencies**\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n2. **Run the FastAPI server**\n   ```bash\n   # Using the main entry point\n   python run.py\n   \n   # Or using the dedicated script\n   python scripts/run_fastapi.py\n   \n   # Or directly with uvicorn\n   uvicorn src.api.fastapi_app:app --host 0.0.0.0 --port 8000\n   ```\n\n#### MCP Server Mode\n1. **Install dependencies**\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n2. **Run the MCP server**\n   ```bash\n   # Using the main entry point\n   python run.py mcp\n   \n   # Or using the dedicated script\n   python scripts/run_mcp.py\n   ```\n\n## 📚 Usage Examples\n\n### Search Documentation\n```bash\n# Search for \"ChatOpenAI\" in documentation\ncurl \"http://localhost:8080/search?query=ChatOpenAI\u0026limit=5\"\n\n# Search API reference specifically\ncurl \"http://localhost:8080/search/api?query=embeddings\"\n```\n\n### Get API Reference\n```bash\n# Get detailed API reference for ChatOpenAI\ncurl \"http://localhost:8080/api-reference/ChatOpenAI\"\n\n# Get API reference for LLMChain\ncurl \"http://localhost:8080/api-reference/LLMChain\"\n```\n\n### Fetch Code Examples\n```bash\n# Get real examples from GitHub\ncurl \"http://localhost:8080/examples/github?query=chatbot\u0026limit=3\"\n\n# Get general examples\ncurl \"http://localhost:8080/examples/github\"\n```\n\n### Get Tutorials\n```bash\n# Fetch all available tutorials\ncurl \"http://localhost:8080/tutorials\"\n```\n\n### Version Information\n```bash\n# Get latest version from PyPI\ncurl \"http://localhost:8080/latest-version\"\n```\n\n## 🔌 MCP Server Usage\n\nWhen running in MCP mode, the server provides the following tools:\n\n### Available MCP Tools\n- `search_langchain_docs` - Search LangChain documentation\n- `search_api_reference` - Search API reference specifically  \n- `get_api_reference` - Get detailed API reference for a class\n- `get_github_examples` - Get code examples from GitHub\n- `get_tutorials` - Get available tutorials\n- `get_latest_version` - Get latest LangChain version\n\n### MCP Client Integration\n```json\n{\n  \"mcpServers\": {\n    \"langchain-docs\": {\n      \"command\": \"python\",\n      \"args\": [\"path/to/langchain-mcp-server/run.py\", \"mcp\"],\n      \"env\": {\n        \"PYTHONPATH\": \"path/to/langchain-mcp-server\"\n      }\n    }\n  }\n}\n```\n\n## 🛠️ Configuration\n\n### Environment Variables\n\n| Variable | Description | Default |\n|----------|-------------|---------|\n| `HOST` | Server host address | 0.0.0.0 |\n| `PORT` | Server port | 8000 |\n| `DEBUG` | Enable debug mode | False |\n| `LOG_LEVEL` | Logging level | INFO |\n| `REQUEST_TIMEOUT` | Timeout for external API calls | 30 seconds |\n| `GITHUB_TOKEN` | GitHub API token (optional) | None |\n\n### Docker Configuration\n\nThe service runs on port 8080 by default to avoid conflicts. You can modify this in `docker-compose.yml`:\n\n```yaml\nports:\n  - \"8080:8000\"  # Host:Container\n```\n\n## 🔧 Development\n\n### Project Structure\n```\n├── src/                    # Main source code package\n│   ├── main.py            # Main entry point with dual mode support\n│   ├── api/               # API layer\n│   │   ├── fastapi_app.py # FastAPI application\n│   │   └── mcp_server.py  # Native MCP server implementation\n│   ├── config/            # Configuration management\n│   │   ├── settings.py    # Application settings\n│   │   └── logging.py     # Logging configuration\n│   ├── models/            # Data models and schemas\n│   │   └── schemas.py     # Pydantic models\n│   ├── services/          # Business logic\n│   │   └── langchain_service.py # LangChain documentation service\n│   └── utils/             # Utility modules\n│       ├── exceptions.py  # Custom exceptions\n│       └── helpers.py     # Helper functions\n├── scripts/               # Convenience scripts\n│   ├── run_fastapi.py    # Run FastAPI mode\n│   ├── run_mcp.py        # Run MCP mode\n│   └── health_check.py   # Health check utility\n├── tests/                 # Test suite\n│   ├── test_api.py       # API tests\n│   ├── test_services.py  # Service tests\n│   └── test_integration.py # Integration tests\n├── docs/                  # Documentation\n│   └── API.md            # API documentation\n├── logs/                  # Log files\n├── run.py                # Simple entry point\n├── requirements.txt      # Python dependencies\n├── pyproject.toml        # Project configuration\n├── Dockerfile           # Docker configuration\n├── docker-compose.yml   # Docker Compose setup\n├── DOCKER.md           # Docker documentation\n└── README.md           # This file\n```\n\n### Key Dependencies\n- **FastAPI** - Web framework for REST API mode\n- **MCP** - Native Model Context Protocol support\n- **FastAPI-MCP** - MCP integration for FastAPI\n- **httpx** - Async HTTP client for external API calls\n- **BeautifulSoup4** - HTML parsing for documentation scraping\n- **Pydantic** - Data validation and settings management\n- **uvicorn** - ASGI server for FastAPI\n\n### Adding New Endpoints\n\n1. Define Pydantic models for request/response\n2. Add endpoint function with proper type hints\n3. Include comprehensive docstrings\n4. Add error handling with specific exceptions\n5. Update health check endpoint count\n\n## 🐛 Error Handling\n\nThe server includes robust error handling for:\n- **Network failures** - Graceful degradation when external APIs are unavailable\n- **Rate limiting** - Handles GitHub API rate limits\n- **Invalid requests** - Proper HTTP status codes and error messages\n- **Timeouts** - Configurable request timeouts\n\n## 📊 Health Monitoring\n\nThe `/health` endpoint provides:\n- Service status\n- Available endpoints count\n- Data source URLs\n- Current timestamp\n- Updated documentation sections\n\n## 🔒 Security Considerations\n\n- **Rate Limiting** - Consider implementing rate limiting for production\n- **CORS** - Configure CORS headers if needed for web access\n- **API Keys** - Add GitHub token for higher API limits\n- **Input Validation** - All inputs are validated using Pydantic\n\n## 🚀 Production Deployment\n\nFor production use, consider:\n\n1. **Caching** - Add Redis/Memcached for response caching\n2. **Rate Limiting** - Implement request rate limiting\n3. **Monitoring** - Add application monitoring and logging\n4. **Load Balancing** - Use multiple instances behind a load balancer\n5. **Database** - Store frequently accessed data\n6. **CI/CD** - Set up automated deployment pipeline\n\n## 🤝 Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Add tests if applicable\n5. Submit a pull request\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n\n## 🔗 Related Links\n\n- [LangChain Documentation](https://python.langchain.com)\n- [LangChain GitHub](https://github.com/langchain-ai/langchain)\n- [FastAPI Documentation](https://fastapi.tiangolo.com)\n- [Model Context Protocol](https://github.com/modelcontextprotocol/specification)\n- [MCP Python SDK](https://github.com/modelcontextprotocol/python-sdk)\n\n## 🆘 Support\n\nIf you encounter any issues:\n\n1. Check the [health endpoint](http://localhost:8080/health) for service status (FastAPI mode)\n2. Review Docker logs: `docker-compose logs`\n3. Check application logs in the `logs/` directory\n4. Ensure network connectivity to external APIs\n5. Verify all dependencies are installed correctly\n6. For MCP mode issues, check the MCP client configuration\n\n---\n\n**Note**: This server requires internet connectivity to fetch live data from LangChain's official sources. API rate limits may apply for GitHub API calls.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliteobject%2Flangchain-mcp-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliteobject%2Flangchain-mcp-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliteobject%2Flangchain-mcp-server/lists"}