Skip to content

Commit fdf44b2

Browse files
committed
Enhance MCP Documentation and Integration
- Updated `mint.json` to include additional MCP pages for improved navigation. - Added new documentation files for various MCP integrations, including AWS KB Retrieval, Everart, Filesystem, Google Drive, GitHub, GitLab, Google Maps, Memory, PostgreSQL, Puppeteer, Redis, Sequential Thinking, Slack, and Stock Price. - Introduced example scripts for each MCP integration to facilitate user understanding and implementation. - Ensured consistency in documentation format and clarity in instructions for setting up and using MCP tools.
1 parent 3622a8b commit fdf44b2

37 files changed

Lines changed: 1679 additions & 77 deletions

docs/mcp/aws-kb-retrieval.mdx

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
---
2+
title: "AWS KB Retrieval MCP Integration"
3+
sidebarTitle: "AWS KB Retrieval"
4+
description: "Guide for integrating AWS Knowledge Base retrieval capabilities with PraisonAI agents using MCP"
5+
icon: "aws"
6+
---
7+
8+
## Add AWS KB Retrieval Tool to AI Agent
9+
10+
```mermaid
11+
flowchart LR
12+
In[Query] --> Agent[AI Agent]
13+
Agent --> Tool[AWS KB Retrieval MCP]
14+
Tool --> Agent
15+
Agent --> Out[Answer]
16+
17+
style In fill:#8B0000,color:#fff
18+
style Agent fill:#2E8B57,color:#fff
19+
style Tool fill:#FF9900,color:#fff
20+
style Out fill:#8B0000,color:#fff
21+
```
22+
23+
## Quick Start
24+
25+
<Steps>
26+
<Step title="Install Dependencies">
27+
Make sure you have Node.js installed, as the MCP server requires it:
28+
```bash
29+
pip install praisonaiagents mcp
30+
```
31+
</Step>
32+
<Step title="Set API Keys">
33+
Set your AWS credentials as environment variables in your terminal:
34+
```bash
35+
export AWS_ACCESS_KEY_ID=your_aws_access_key_id_here
36+
export AWS_SECRET_ACCESS_KEY=your_aws_secret_access_key_here
37+
export AWS_REGION=your_aws_region_here
38+
export OPENAI_API_KEY=your_openai_api_key_here
39+
```
40+
</Step>
41+
42+
<Step title="Create a file">
43+
Create a new file `aws_kb_retrieval.py` with the following code:
44+
```python
45+
from praisonaiagents import Agent, MCP
46+
import os
47+
48+
# Get AWS credentials from environment
49+
aws_access_key = os.getenv("AWS_ACCESS_KEY_ID")
50+
aws_secret_key = os.getenv("AWS_SECRET_ACCESS_KEY")
51+
aws_region = os.getenv("AWS_REGION")
52+
53+
# Use a single string command with AWS KB Retrieval configuration
54+
aws_kb_agent = Agent(
55+
instructions="""You are a helpful assistant that can interact with AWS Knowledge Base.
56+
Use the available tools when relevant to retrieve and process AWS information.""",
57+
llm="gpt-4o-mini",
58+
tools=MCP("npx -y @modelcontextprotocol/server-aws-kb-retrieval",
59+
env={
60+
"AWS_ACCESS_KEY_ID": aws_access_key,
61+
"AWS_SECRET_ACCESS_KEY": aws_secret_key,
62+
"AWS_REGION": aws_region
63+
})
64+
)
65+
66+
aws_kb_agent.start("Search AWS documentation about EC2 instances")
67+
```
68+
</Step>
69+
70+
<Step title="Run the Agent">
71+
Execute your script:
72+
```bash
73+
python aws_kb_retrieval.py
74+
```
75+
</Step>
76+
</Steps>
77+
78+
<Note>
79+
**Requirements**
80+
- Python 3.10 or higher
81+
- Node.js installed on your system
82+
- AWS credentials (Access Key ID, Secret Access Key, and Region)
83+
- OpenAI API key (for the agent's LLM)
84+
</Note>

docs/mcp/bravesearch.mdx

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ description: "Guide for integrating Brave Search capabilities with PraisonAI age
55
icon: "searchengin"
66
---
77

8-
# Brave Search MCP Integration
8+
## Add Brave Search Tool to AI Agent
99

1010
```mermaid
1111
flowchart LR
12-
In[In] --> Agent[AI Agent]
12+
In[Query] --> Agent[AI Agent]
1313
Agent --> Tool[Brave Search MCP]
1414
Tool --> Agent
15-
Agent --> Out[Out]
15+
Agent --> Out[Answer]
1616
1717
style In fill:#8B0000,color:#fff
1818
style Agent fill:#2E8B57,color:#fff
@@ -23,6 +23,12 @@ flowchart LR
2323
## Quick Start
2424

2525
<Steps>
26+
<Step title="Install Dependencies">
27+
Make sure you have Node.js installed, as the MCP server requires it:
28+
```bash
29+
pip install praisonaiagents mcp
30+
```
31+
</Step>
2632
<Step title="Set API Key">
2733
Set your Brave Search API key as an environment variable in your terminal:
2834
```bash
@@ -54,13 +60,6 @@ flowchart LR
5460
```
5561
</Step>
5662

57-
<Step title="Install Dependencies">
58-
Make sure you have Node.js installed, as the MCP server requires it:
59-
```bash
60-
pip install praisonaiagents
61-
```
62-
</Step>
63-
6463
<Step title="Run the Agent">
6564
Execute your script:
6665
```bash
@@ -76,20 +75,3 @@ flowchart LR
7675
- Brave Search API key
7776
- OpenAI API key (for the agent's LLM)
7877
</Note>
79-
80-
## Features
81-
82-
<CardGroup cols={2}>
83-
<Card title="Web Search" icon="globe">
84-
Search the web for up-to-date information.
85-
</Card>
86-
<Card title="MCP Integration" icon="plug">
87-
Seamless integration with Model Context Protocol.
88-
</Card>
89-
<Card title="Environment Variables" icon="key">
90-
Secure API key handling through environment variables.
91-
</Card>
92-
<Card title="NPM Package" icon="js">
93-
Leverages the official Brave Search MCP server package.
94-
</Card>
95-
</CardGroup>

docs/mcp/custom-python-client.mdx

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
---
2+
title: "Custom Python MCP Client"
3+
sidebarTitle: "Custom Python Client"
4+
description: "Guide for creating a client to interact with a custom Python MCP server"
5+
icon: "person-digging"
6+
---
7+
8+
## Custom Python MCP Client
9+
10+
```mermaid
11+
flowchart LR
12+
In[Query] --> Agent[AI Agent]
13+
Agent --> Client[Python MCP Client]
14+
Client --> Server[Python MCP Server]
15+
Server --> Client
16+
Client --> Agent
17+
Agent --> Out[Answer]
18+
19+
style In fill:#8B0000,color:#fff
20+
style Agent fill:#2E8B57,color:#fff
21+
style Client fill:#3776AB,color:#fff
22+
style Server fill:#3776AB,color:#fff
23+
style Out fill:#8B0000,color:#fff
24+
```
25+
26+
## Overview
27+
28+
The Custom Python MCP Client demonstrates how to integrate a custom Python MCP server with a PraisonAI agent. This client connects to a stock price MCP server to retrieve real-time stock information.
29+
30+
## Quick Start
31+
32+
<Steps>
33+
<Step title="Install Dependencies">
34+
Install the required packages:
35+
```bash
36+
pip install praisonaiagents mcp
37+
```
38+
</Step>
39+
<Step title="Set Up the Server">
40+
First, set up the Custom Python MCP Server.
41+
</Step>
42+
<Step title="Create Custom Python Client">
43+
Save the code above to a file named `custom-python-client.py`.
44+
```python
45+
from praisonaiagents import Agent, MCP
46+
47+
agent = Agent(
48+
instructions="""You are a helpful assistant that can check stock prices and perform other tasks.
49+
Use the available tools when relevant to answer user questions.""",
50+
llm="gpt-4o-mini",
51+
tools = MCP("/Users/praison/miniconda3/envs/mcp/bin/python /Users/praison/stockprice/custom-python-server.py")
52+
)
53+
54+
# NOTE: Python Path replace with yours: /Users/praison/miniconda3/envs/mcp/bin/python
55+
# NOTE: custom-python-server.py file path, replace it with yours: /Users/praison/stockprice/custom-python-server.py
56+
57+
agent.start("What is the stock price of Tesla?")
58+
```
59+
</Step>
60+
<Step title="Run the Client">
61+
Execute the client script:
62+
```bash
63+
python custom-python-client.py
64+
```
65+
</Step>
66+
</Steps>
67+
68+
<Note>
69+
**Requirements**
70+
- Python 3.10 or higher
71+
- praisonaiagents and mcp packages
72+
- A properly configured custom Python MCP server
73+
- OpenAI API key (for the agent's LLM)
74+
</Note>
75+
76+
## Environment Variables
77+
78+
For better security and flexibility, you can modify the client to use environment variables:
79+
80+
```python
81+
import os
82+
from praisonaiagents import Agent, MCP
83+
84+
# Get paths from environment variables or use defaults
85+
python_path = os.getenv("PYTHON_PATH", "/path/to/python")
86+
server_path = os.getenv("SERVER_PATH", "/path/to/server.py")
87+
88+
agent = Agent(
89+
instructions="""You are a helpful assistant that can check stock prices and perform other tasks.
90+
Use the available tools when relevant to answer user questions.""",
91+
llm="gpt-4o-mini",
92+
tools=MCP(f"{python_path} {server_path}")
93+
)
94+
95+
agent.start("What is the stock price of Tesla?")
96+
```
97+
98+
This approach allows you to set the paths using environment variables:
99+
100+
```bash
101+
export PYTHON_PATH=/Users/praison/miniconda3/envs/mcp/bin/python
102+
export SERVER_PATH=/Users/praison/stockprice/app.py
103+
```

docs/mcp/custom-python-server.mdx

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
title: "Custom Python MCP Server"
3+
sidebarTitle: "Custom Python Server"
4+
description: "Guide for creating a custom Python MCP server for stock price retrieval"
5+
icon: "server"
6+
---
7+
8+
## Custom Python MCP Server
9+
10+
```mermaid
11+
flowchart LR
12+
In[Query] --> Agent[AI Agent]
13+
Agent --> Client[Python MCP Client]
14+
Client --> Server[Python MCP Server]
15+
Server --> Client
16+
Client --> Agent
17+
Agent --> Out[Answer]
18+
19+
style In fill:#8B0000,color:#fff
20+
style Agent fill:#2E8B57,color:#fff
21+
style Client fill:#3776AB,color:#fff
22+
style Server fill:#3776AB,color:#fff
23+
style Out fill:#8B0000,color:#fff
24+
```
25+
26+
## Overview
27+
28+
The Custom Python MCP Server is a simple implementation of the Model Context Protocol (MCP) that provides stock price information using the yfinance library. This server can be used with PraisonAI agents to retrieve real-time stock prices.
29+
30+
## Server Implementation
31+
32+
Below is the complete implementation of the custom Python MCP server:
33+
34+
35+
## Quick Start
36+
37+
<Steps>
38+
<Step title="Install Dependencies">
39+
Install the required packages:
40+
```bash
41+
pip install yfinance mcp
42+
```
43+
</Step>
44+
<Step title="Save the Server Code">
45+
Save the code above to a file named `custom-python-server.py`.
46+
```python
47+
import yfinance as yf
48+
from mcp.server.fastmcp import FastMCP
49+
50+
mcp = FastMCP("stock_prices")
51+
52+
@mcp.tool()
53+
async def get_stock_price(ticker: str) -> str:
54+
"""Get the current stock price for a given ticker symbol.
55+
56+
Args:
57+
ticker: Stock ticker symbol (e.g., AAPL, MSFT, GOOG)
58+
59+
Returns:
60+
Current stock price as a string
61+
"""
62+
if not ticker:
63+
return "No ticker provided"
64+
try:
65+
stock = yf.Ticker(ticker)
66+
info = stock.info
67+
current_price = info.get('currentPrice') or info.get('regularMarketPrice')
68+
if not current_price:
69+
return f"Could not retrieve price for {ticker}"
70+
return f"${current_price:.2f}"
71+
72+
except Exception as e:
73+
return f"Error: {str(e)}"
74+
75+
if __name__ == "__main__":
76+
mcp.run(transport='stdio')
77+
```
78+
</Step>
79+
</Steps>
80+
81+
<Note>
82+
**Requirements**
83+
- Python 3.10 or higher
84+
- yfinance package
85+
- mcp package
86+
</Note>

0 commit comments

Comments
 (0)