Skip to content

Commit 282ada1

Browse files
CopilotOEvortex
andcommitted
docs: update README.md with MCP integration documentation
Co-authored-by: OEvortex <158988478+OEvortex@users.noreply.github.com>
1 parent 7563c16 commit 282ada1

File tree

1 file changed

+128
-0
lines changed

1 file changed

+128
-0
lines changed

README.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ The official Python library for the [HelpingAI](https://helpingai.co) API - Adva
1010

1111
- **OpenAI-Compatible API**: Drop-in replacement with familiar interface
1212
- **Emotional Intelligence**: Advanced AI models with emotional understanding
13+
- **MCP Integration**: Seamless connection to external tools via Multi-Channel Protocol servers
1314
- **Tool Calling Made Easy**: [`@tools decorator`](HelpingAI/tools/core.py:144) for effortless function-to-tool conversion
1415
- **Direct Tool Execution**: Simple `.call()` method for executing tools without registry manipulation
1516
- **Automatic Schema Generation**: Type hint-based JSON schema creation with docstring parsing
@@ -25,6 +26,13 @@ The official Python library for the [HelpingAI](https://helpingai.co) API - Adva
2526
pip install HelpingAI
2627
```
2728

29+
### Optional Features
30+
31+
```bash
32+
# Install with MCP (Multi-Channel Protocol) support
33+
pip install HelpingAI[mcp]
34+
```
35+
2836
## 🔑 Authentication
2937

3038
Get your API key from the [HelpingAI Dashboard](https://helpingai.co/dashboard).
@@ -158,6 +166,125 @@ response = hai.chat.completions.create(
158166
hide_think=False # Show reasoning process
159167
)
160168
```
169+
## 🛠️ MCP (Multi-Channel Protocol) Integration
170+
171+
Connect to external tools and services through MCP servers for expanded AI capabilities.
172+
173+
### Quick Start with MCP
174+
175+
```python
176+
from HelpingAI import HAI
177+
178+
client = HAI(api_key="your-api-key")
179+
180+
# Configure MCP servers
181+
tools = [
182+
{
183+
'mcpServers': {
184+
'time': {
185+
'command': 'uvx',
186+
'args': ['mcp-server-time', '--local-timezone=Asia/Shanghai']
187+
},
188+
"fetch": {
189+
"command": "uvx",
190+
"args": ["mcp-server-fetch"]
191+
}
192+
}
193+
}
194+
]
195+
196+
# Use MCP tools in chat completion
197+
response = client.chat.completions.create(
198+
model="Dhanishtha-2.0-preview",
199+
messages=[{"role": "user", "content": "What time is it in Shanghai?"}],
200+
tools=tools
201+
)
202+
203+
print(response.choices[0].message.content)
204+
```
205+
206+
### Supported Server Types
207+
208+
```python
209+
# Stdio-based servers (most common)
210+
{
211+
'command': 'uvx',
212+
'args': ['mcp-server-time'],
213+
'env': {'TIMEZONE': 'UTC'} # optional
214+
}
215+
216+
# HTTP SSE servers
217+
{
218+
'url': 'https://api.example.com/mcp',
219+
'headers': {'Authorization': 'Bearer token'},
220+
'sse_read_timeout': 300
221+
}
222+
223+
# Streamable HTTP servers
224+
{
225+
'type': 'streamable-http',
226+
'url': 'http://localhost:8000/mcp'
227+
}
228+
```
229+
230+
### Popular MCP Servers
231+
232+
- **mcp-server-time** - Time and timezone operations
233+
- **mcp-server-fetch** - HTTP requests and web scraping
234+
- **mcp-server-filesystem** - File system operations
235+
- **mcp-server-memory** - Persistent memory across conversations
236+
- **mcp-server-sqlite** - SQLite database operations
237+
- **Custom servers** - Any MCP-compliant server
238+
239+
### Combined Usage
240+
241+
Mix MCP servers with regular tools:
242+
243+
```python
244+
# Regular OpenAI tools
245+
regular_tools = [{
246+
"type": "function",
247+
"function": {
248+
"name": "calculate",
249+
"description": "Perform calculations",
250+
"parameters": {
251+
"type": "object",
252+
"properties": {
253+
"expression": {"type": "string"}
254+
}
255+
}
256+
}
257+
}]
258+
259+
# Combined with MCP servers
260+
all_tools = regular_tools + [{
261+
'mcpServers': {
262+
'time': {
263+
'command': 'uvx',
264+
'args': ['mcp-server-time']
265+
}
266+
}
267+
}]
268+
269+
response = client.chat.completions.create(
270+
model="Dhanishtha-2.0-preview",
271+
messages=[{"role": "user", "content": "Calculate 2+2 and tell me the current time"}],
272+
tools=all_tools
273+
)
274+
```
275+
276+
### Installation & Setup
277+
278+
```bash
279+
# Install MCP support
280+
pip install HelpingAI[mcp]
281+
282+
# Or install MCP package separately
283+
pip install -U mcp
284+
```
285+
286+
**Note**: MCP functionality requires the `mcp` package. The SDK provides graceful error handling when MCP is not installed.
287+
161288
## 🔧 Tool Calling with @tools Decorator
162289

163290
Transform any Python function into a powerful AI tool with zero boilerplate using the [`@tools`](HelpingAI/tools/core.py:144) decorator.
@@ -435,6 +562,7 @@ Comprehensive documentation is available:
435562
- [📖 Getting Started Guide](docs/getting_started.md) - Installation and basic usage
436563
- [🔧 API Reference](docs/api_reference.md) - Complete API documentation
437564
- [🛠️ Tool Calling Guide](docs/tool_calling.md) - Creating and using AI-callable tools
565+
- [🔌 MCP Integration Guide](docs/mcp_integration.md) - Multi-Channel Protocol integration
438566
- [💡 Examples](docs/examples.md) - Code examples and use cases
439567
- [❓ FAQ](docs/faq.md) - Frequently asked questions
440568

0 commit comments

Comments
 (0)