-
Notifications
You must be signed in to change notification settings - Fork 766
Add mcp-agent cloud compatibility to financial analysis agent example #499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -62,12 +62,6 @@ Install requirements specific to this example: | |||||||||||||||||||||||||||||||||||
uv pip install -r requirements.txt | ||||||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
Install the g-search-mcp server (from https://github.com/jae-jae/g-search-mcp): | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
```bash | ||||||||||||||||||||||||||||||||||||
npm install -g g-search-mcp | ||||||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
## `2` Set up secrets and environment variables | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
Copy and configure your secrets: | ||||||||||||||||||||||||||||||||||||
|
@@ -96,3 +90,102 @@ Or run with a different company: | |||||||||||||||||||||||||||||||||||
```bash | ||||||||||||||||||||||||||||||||||||
uv run main.py "Microsoft" | ||||||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
## `4` [Beta] Deploy to MCP Agent Cloud | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
### Prerequisites | ||||||||||||||||||||||||||||||||||||
This agent is already cloud-compatible with the `@app.tool` decorator and uses only the `fetch` server for web data collection. | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
### Step 1: Login to MCP Agent Cloud | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
```bash | ||||||||||||||||||||||||||||||||||||
uv run mcp-agent login | ||||||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
### Step 2: Deploy your agent | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
```bash | ||||||||||||||||||||||||||||||||||||
uv run mcp-agent deploy financial-analyzer | ||||||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
During deployment, you'll be prompted to configure secrets. You'll see two options for the OpenAI API key: | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
#### For OpenAI API Key: | ||||||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||||||
Select secret type for 'openai.api_key' | ||||||||||||||||||||||||||||||||||||
1: Deployment Secret: The secret value will be stored securely and accessible to the deployed application runtime. | ||||||||||||||||||||||||||||||||||||
2: User Secret: No secret value will be stored. The 'configure' command must be used to create a configured application with this secret. | ||||||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||||||
Comment on lines
+114
to
+118
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick Add language to fenced code block (markdownlint MD040) Specify a language for linting/renderers. -```
+```text
Select secret type for 'openai.api_key' 🧰 Tools🪛 markdownlint-cli2 (0.18.1)114-114: Fenced code blocks should have a language specified (MD040, fenced-code-language) 🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
**Recommendation:** | ||||||||||||||||||||||||||||||||||||
- Choose **Option 1** if you're deploying for personal use and want immediate functionality | ||||||||||||||||||||||||||||||||||||
- Choose **Option 2** if you're sharing this agent publicly and want users to provide their own OpenAI API keys | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
### Step 3: Connect to your deployed agent | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
Once deployed, you'll receive a deployment URL like: `https://[your-agent-server-id].deployments.mcp-agent.com` | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
#### Claude Desktop Integration | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
Configure Claude Desktop to access your agent by updating your `~/.claude-desktop/config.json`: | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
```json | ||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||
"mcpServers": { | ||||||||||||||||||||||||||||||||||||
"financial-analyzer": { | ||||||||||||||||||||||||||||||||||||
"command": "/path/to/npx", | ||||||||||||||||||||||||||||||||||||
"args": [ | ||||||||||||||||||||||||||||||||||||
"mcp-remote", | ||||||||||||||||||||||||||||||||||||
"https://[your-agent-server-id].deployments.mcp-agent.com/sse", | ||||||||||||||||||||||||||||||||||||
"--header", | ||||||||||||||||||||||||||||||||||||
"Authorization: Bearer ${BEARER_TOKEN}" | ||||||||||||||||||||||||||||||||||||
], | ||||||||||||||||||||||||||||||||||||
"env": { | ||||||||||||||||||||||||||||||||||||
"BEARER_TOKEN": "your-mcp-agent-cloud-api-token" | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
#### MCP Inspector | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
Test your deployed agent using MCP Inspector: | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
```bash | ||||||||||||||||||||||||||||||||||||
npx @modelcontextprotocol/inspector | ||||||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
Configure the inspector with these settings: | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
| Setting | Value | | ||||||||||||||||||||||||||||||||||||
|---------|-------| | ||||||||||||||||||||||||||||||||||||
| Transport Type | SSE | | ||||||||||||||||||||||||||||||||||||
| SSE URL | `https://[your-agent-server-id].deployments.mcp-agent.com/sse` | | ||||||||||||||||||||||||||||||||||||
| Header Name | Authorization | | ||||||||||||||||||||||||||||||||||||
| Bearer Token | your-mcp-agent-cloud-api-token | | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
**💡 Tip:** Increase the request timeout in the Configuration since LLM calls take longer than simple API calls. | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
### Available Tools | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
Once deployed, your agent will expose the `analyze_stock` tool, which: | ||||||||||||||||||||||||||||||||||||
- Takes a company name as input (e.g., "Apple", "Microsoft") | ||||||||||||||||||||||||||||||||||||
- Conducts comprehensive financial research using web search | ||||||||||||||||||||||||||||||||||||
- Performs quality evaluation and improvement loops to ensure data accuracy | ||||||||||||||||||||||||||||||||||||
- Generates professional investment analysis with bull/bear cases | ||||||||||||||||||||||||||||||||||||
- Returns a complete financial report as formatted text | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
Comment on lines
+170
to
+178
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick Align wording: “web search” → “MCP fetch” Prerequisites state only the fetch server is used. Adjust for consistency. - - Conducts comprehensive financial research using web search
+ - Conducts comprehensive financial research using the MCP fetch server (HTTP retrieval) 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||||||||||||
### Example Usage | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
After deployment, you can use the agent through Claude Desktop or MCP Inspector: | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||||||
Please analyze Meta's financial performance and investment outlook. | ||||||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
Comment on lines
+183
to
+186
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick Add language to fenced code block (markdownlint MD040) Mark the example as text. -```
+```text
Please analyze Meta's financial performance and investment outlook. 🧰 Tools🪛 markdownlint-cli2 (0.18.1)183-183: Fenced code blocks should have a language specified (MD040, fenced-code-language) 🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||||||||||||
The agent will automatically: | ||||||||||||||||||||||||||||||||||||
1. Research Tesla's current stock price, earnings, and recent news | ||||||||||||||||||||||||||||||||||||
Comment on lines
+187
to
+188
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's an inconsistency in the example usage section. In line 184, the example shows analyzing Meta:
But in line 188, it states the agent will research Tesla:
The company name should be consistent between these lines - either both should reference Meta or both should reference Tesla.
Suggested change
Spotted by Diamond |
||||||||||||||||||||||||||||||||||||
2. Evaluate data quality and improve if needed | ||||||||||||||||||||||||||||||||||||
3. Analyze the financial data for investment insights | ||||||||||||||||||||||||||||||||||||
4. Generate a comprehensive report with recommendations | ||||||||||||||||||||||||||||||||||||
Comment on lines
+187
to
+191
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick Fix entity mismatch: Tesla vs Meta The narrative should match the Meta prompt above. -1. Research Tesla's current stock price, earnings, and recent news
+1. Research Meta's current stock price, earnings, and recent news 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
CLI commands may need verification
“uv run mcp-agent login|deploy …” looks plausible, but CLI subcommands/entrypoint names are brittle. Please confirm exact command names and flags.
🌐 Web query:
💡 Result:
Short answer — common CLI subcommands (Sep 2025) and example invocations:
agentauth-mcp generate. [1]
agentauth-mcp connect https://api.example.com/mcp --header "API-Key:${API_KEY}".
AGENTAUTH_TOKEN=aa-... agentauth-mcp connect https://api.example.com/mcp. [1]
command: "npx"
args: ["-y","@modelcontextprotocol/server-sse","https://localhost:8000/sse"]
mcp:
servers:
sse_server:
transport: "sse"
url: "https://localhost:8000/sse"
headers:
Authorization: "Bearer your-token"
args: ["-y","@modelcontextprotocol/server-sse","https://mcp.example.com/YOUR_API_TOKEN_HERE/sse"]. [2][3]
uv run main.py
Notes / sources
If you want, I can produce exact copy-paste-ready CLI snippets and a sample mcp_agent.config.yaml that shows auth headers + SSE URL for your environment.
Replace inaccurate CLI examples with agentauth-mcp / SSE-config usage
File: examples/usecases/mcp_financial_analyzer/README.md (lines 100–116) — the shown commands
uv run mcp-agent login
anduv run mcp-agent deploy …
are not standard. Replace with one of the common, copy-paste patterns below:Auth (replace
login
):SSE config (preferred inline example instead of a “login”): add in mcp_agent.config.yaml:
mcp:
servers:
sse_server:
transport: "sse"
url: "https://localhost:8000/sse"
headers:
Authorization: "Bearer your-token"
Run/deploy (replace
deploy
): show install + run or service config, e.g.:pip install mcp-agent
uv run main.py
—or— explain how to expose the agent using the mcp_agent.config.yaml + run command.
🤖 Prompt for AI Agents