MCP REST API and CLI Client
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
A **simple REST API** and **CLI client** to interact with Model Context Protocol (MCP) servers.
Key Features
1. MCP-Compatible Servers
- Supports any MCP-compatible servers servers.
- Pre-configured default servers:
- **SQLite** (test.db has been provided with sample products data)
- **Brave Search**
- Additional MCP servers can be added in the mcp-server-config.json file
2. Integrated with LangChain
- Leverages LangChain to execute LLM prompts.
- Enables multiple MCP servers to collaborate and respond to a specific query simultaneously.
3. LLM Provider Support
- Compatible with any LLM provider that supports APIs with function capabilities.
- Examples:
- **OpenAI**
- **Claude**
- **Gemini**
- **AWS Nova**
- **Groq**
- **Ollama**
- Essentially all LLM providers are supported as long as they provide a function-based API. Please refer langchain documentation for more details.
Setup
1. Clone the repository:
2. **Navigate to the Project Directory**
After cloning the repository, move to the project directory:
3. Set the OPENAI_API_KEY environment variable:
You can also set the OPENAI_API_KEY in the mcp-server-config.json file.
You can also set the provider and model in the mcp-server-config.json file.
e.g. provider can be ollama and model can be llama3.2:3b.
4.Set the BRAVE_API_KEY environment variable:
You can also set the BRAVE_API_KEY in the mcp-server-config.json file.
You can get the free BRAVE_API_KEY from Brave Search API.
5. Running from the CLI:
To explore the available commands, use the help option. You can chat with LLM using chat command.
Sample prompts:
6. Running from the REST API:
You can use the following curl command to chat with llm:
You can use the following curl command to chat with llm with streaming:
Contributing
Feel free to submit issues and pull requests for improvements or bug fixes.