Skip to content

Commit b87f9f3

Browse files
saqadriandrew-lastmile
authored andcommitted
Update basic agent
1 parent 6f5e424 commit b87f9f3

File tree

3 files changed

+66
-27
lines changed

3 files changed

+66
-27
lines changed

src/mcp_agent/data/templates/README_basic.md

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ Welcome! This project was generated by `mcp-agent init`. It’s a minimal, reada
1717

1818
1. Add API keys to `mcp_agent.secrets.yaml` (or set env vars):
1919

20-
- `OPENAI_API_KEY` (recommended)
21-
- `ANTHROPIC_API_KEY` (optional)
20+
NOTE: You can use another supported provider (e.g. Anthropic) instead, just be sure to set its API key in the `mcp_agent.secrets.yaml` (or set its env var) and import/use the relevant `AugmentedLLM` in `main.py`.
21+
22+
- `OPENAI_API_KEY` (recommended)
23+
- `ANTHROPIC_API_KEY` (optional)
2224

2325
2. Review `mcp_agent.config.yaml`:
2426

@@ -38,23 +40,56 @@ You’ll see two summaries printed:
3840
- A summary of `README.md` from your current directory.
3941
- A summary of the intro page at modelcontextprotocol.io.
4042

41-
4. Deploy a remote MCP server:
42-
43-
### Run as an MCP server
43+
4. Run locally as an MCP server:
4444

4545
- In `main.py`, UNCOMMENT the server lines that call `create_mcp_server_for_app(agent_app)` and `run_sse_async()`.
46-
- Start the server: `uv run main.py`
4746

48-
When you're ready to deploy, simply run:
47+
- Once you see the server started, e.g.
48+
```bash
49+
Uvicorn running on http://127.0.0.1:8000
50+
```
51+
you can connect to it with your preferred MCP Client. For example, you can use [MCP Inspector](https://github.com/modelcontextprotocol/inspector) to explore and test the server:
4952

5053
```bash
51-
mcp-agent deploy "hello_world"
54+
npx @modelcontextprotocol/inspector --transport sse --server-url http://127.0.0.1:8000/sse
5255
```
5356

54-
- This wraps your app as a hosted MCP SSE server.
55-
- Anything decorated with `@app.tool` (or `@app.async_tool`) runs as a Temporal workflow in the cloud.
57+
5. Deploy a remote MCP server:
58+
59+
When you're ready to deploy, ensure the required API keys are set in `mcp_agent.secrets.yaml` and then run:
60+
61+
```bash
62+
uv run mcp-agent login
63+
```
64+
65+
to authenticate to mcp-agent cloud. You will be redirected to the login page, create an mcp-agent cloud account through Google or Github.
66+
67+
Set up your mcp-agent cloud API Key and copy & paste it into your terminal
68+
69+
```bash
70+
INFO: Directing to MCP Agent Cloud API login...
71+
Please enter your API key 🔑:
72+
```
73+
74+
In your terminal, deploy the MCP app:
75+
76+
```bash
77+
uv run mcp-agent deploy hello_world --no-auth
78+
```
79+
80+
The `deploy` command will bundle the app files and deploy them, wrapping your app as a hosted MCP SSE server with a URL of the form:
81+
`https://<server_id>.deployments.mcp-agent.com`.
82+
83+
Anything decorated with `@app.tool` (or `@app.async_tool`) runs as a Temporal workflow in the cloud.
84+
85+
Since the mcp-agent app is exposed as an MCP server, it can be used in any MCP client just
86+
like any other MCP server. For example, you can inspect and test the server using MCP Inspector:
87+
88+
```bash
89+
npx @modelcontextprotocol/inspector --transport sse --server-url https://<server_id>.deployments.mcp-agent.com/sse
90+
```
5691

57-
Notes
92+
## Notes
5893

5994
- `app_ctx` is the MCPApp Context (configuration, logger, upstream session, etc.).
6095
- Logging uses `app.logger` and is forwarded as notifications when connected to an MCP client.

src/mcp_agent/data/templates/basic_agent.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
from mcp_agent.agents.agent_spec import AgentSpec
2323
from mcp_agent.core.context import Context as AppContext
2424
from mcp_agent.workflows.factory import create_agent
25+
26+
# We are using the OpenAI augmented LLM for this example but you can swap with others (e.g. AnthropicAugmentedLLM)
2527
from mcp_agent.workflows.llm.augmented_llm_openai import OpenAIAugmentedLLM
2628

2729
# Create the MCPApp, the root of mcp-agent.
@@ -138,6 +140,7 @@ async def main():
138140
#########################################################
139141
# Create the MCP server that exposes both workflows and agent configurations,
140142
# optionally using custom FastMCP settings
143+
# from mcp_agent.server.app_server import create_mcp_server_for_app
141144
# mcp_server = create_mcp_server_for_app(agent_app)
142145

143146
# # Run the server
@@ -148,7 +151,7 @@ async def main():
148151
asyncio.run(main())
149152

150153
# When you're ready to deploy this MCPApp as a remote SSE server, run:
151-
# > mcp-agent deploy "hello_world"
154+
# > uv run mcp-agent deploy "hello_world" --no-auth
152155
#
153156
# Congrats! You made it to the end of the getting-started example!
154157
# There is a lot more that mcp-agent can do, and we hope you'll explore the rest of the documentation.

src/mcp_agent/data/templates/secrets.yaml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,27 @@
22
# WARNING: Keep this file secure and never commit to version control
33

44
# Provider API Keys
5+
# We default to OpenAI, but you can configure your preferred providers here.
56
# You can also set these as environment variables instead
67
openai:
7-
api_key: "" # Or use OPENAI_API_KEY env var
8+
api_key: "" # Or use OPENAI_API_KEY env var
89

9-
anthropic:
10-
api_key: "" # Or use ANTHROPIC_API_KEY env var
10+
# anthropic:
11+
# api_key: "" # Or remove and use ANTHROPIC_API_KEY env var
1112

12-
google:
13-
api_key: "" # Or use GOOGLE_API_KEY env var
13+
# google:
14+
# api_key: "" # Or remove and use GOOGLE_API_KEY env var
1415

15-
azure:
16-
api_key: "" # Or use AZURE_API_KEY env var
17-
base_url: "" # https://your-resource.openai.azure.com/
18-
api_version: "2024-02-01"
19-
# use_default_azure_credential: false # Set to true for DefaultAzureCredential
16+
# azure:
17+
# api_key: "" # Or remove and use AZURE_API_KEY env var
18+
# base_url: "" # https://your-resource.openai.azure.com/
19+
# api_version: "2024-02-01"
20+
# # use_default_azure_credential: false # Set to true for DefaultAzureCredential
2021

21-
bedrock:
22-
aws_access_key_id: "" # Or use AWS_ACCESS_KEY_ID env var
23-
aws_secret_access_key: "" # Or use AWS_SECRET_ACCESS_KEY env var
24-
aws_region: "us-east-1"
22+
# bedrock:
23+
# aws_access_key_id: "" # Or remove and use AWS_ACCESS_KEY_ID env var
24+
# aws_secret_access_key: "" # Or remove and use AWS_SECRET_ACCESS_KEY env var
25+
# aws_region: "us-east-1"
2526

2627
# MCP Server environment variables
2728
# mcp:
@@ -31,4 +32,4 @@ bedrock:
3132
# GITHUB_PERSONAL_ACCESS_TOKEN: ghp_...
3233
# brave-search:
3334
# env:
34-
# BRAVE_API_KEY: BSA_...
35+
# BRAVE_API_KEY: BSA_...

0 commit comments

Comments
 (0)