Skip to content

Commit 6f5e424

Browse files
saqadriandrew-lastmile
authored andcommitted
Revert "Feat/update basic quickstart template (lastmile-ai#575)"
This reverts commit 4f6558d.
1 parent 677ccaa commit 6f5e424

File tree

5 files changed

+40
-123
lines changed

5 files changed

+40
-123
lines changed

src/mcp_agent/cli/commands/init.py

Lines changed: 11 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -75,34 +75,18 @@ def _write_readme(dir_path: Path, content: str, force: bool) -> str | None:
7575
return None
7676

7777

78-
def _write_requirements(dir_path: Path, content: str, force: bool) -> str | None:
79-
"""Create a requirements.txt file with fallback logging if one already exists.
80-
81-
Returns the filename created, or None if it could not be written (in which case
82-
the content is printed to console as a fallback).
83-
"""
84-
path = dir_path / "requirements.txt"
85-
if not path.exists() or force:
86-
ok = _write(path, content, force)
87-
if ok:
88-
return "requirements.txt"
89-
# Fallback: print content to console if we couldn't write the file
90-
console.print(
91-
"\n[yellow]A requirements.txt already exists and could not be overwritten.[/yellow]"
92-
)
93-
console.print("[bold]Suggested requirements.txt contents:[/bold]\n")
94-
console.print(content)
95-
return None
96-
97-
9878
def _copy_pkg_tree(pkg_rel: str, dst: Path, force: bool) -> int:
9979
"""Copy packaged examples from mcp_agent.data/examples/<pkg_rel> into dst.
10080
10181
Uses importlib.resources to locate files installed with the package.
10282
Returns 1 on success, 0 on failure.
10383
"""
10484
try:
105-
root = resources.files("mcp_agent.data").joinpath("examples").joinpath(pkg_rel)
85+
root = (
86+
resources.files("mcp_agent.data")
87+
.joinpath("examples")
88+
.joinpath(pkg_rel)
89+
)
10690
except Exception:
10791
return 0
10892
if not root.exists():
@@ -132,9 +116,7 @@ def init(
132116
ctx: typer.Context,
133117
dir: Path = typer.Option(Path("."), "--dir", "-d", help="Target directory"),
134118
template: str = typer.Option("basic", "--template", "-t", help="Template to use"),
135-
quickstart: str = typer.Option(
136-
None, "--quickstart", help="Quickstart mode: copy example without config files"
137-
),
119+
quickstart: str = typer.Option(None, "--quickstart", help="Quickstart mode: copy example without config files"),
138120
force: bool = typer.Option(False, "--force", "-f", help="Overwrite existing files"),
139121
no_gitignore: bool = typer.Option(
140122
False, "--no-gitignore", help="Skip creating .gitignore"
@@ -190,10 +172,7 @@ def init(
190172
"mcp-basic-agent": ("mcp_basic_agent", "basic/mcp_basic_agent"),
191173
"token-counter": ("token_counter", "basic/token_counter"),
192174
"agent-factory": ("agent_factory", "basic/agent_factory"),
193-
"reference-agent-server": (
194-
"reference_agent_server",
195-
"mcp_agent_server/reference",
196-
),
175+
"reference-agent-server": ("reference_agent_server", "mcp_agent_server/reference"),
197176
"elicitation": ("elicitation", "mcp_agent_server/elicitation"),
198177
"sampling": ("sampling", "mcp_agent_server/sampling"),
199178
"notifications": ("notifications", "mcp_agent_server/notifications"),
@@ -208,9 +187,7 @@ def init(
208187

209188
# Templates table
210189
console.print("[bold cyan]Templates:[/bold cyan]")
211-
console.print(
212-
"[dim]Creates minimal project structure with config files[/dim]\n"
213-
)
190+
console.print("[dim]Creates minimal project structure with config files[/dim]\n")
214191
table1 = Table(show_header=True, header_style="cyan")
215192
table1.add_column("Template", style="green")
216193
table1.add_column("Description")
@@ -256,9 +233,7 @@ def init(
256233
if copied:
257234
console.print(f"Copied {copied} set(s) to {dst}")
258235
else:
259-
console.print(
260-
f"[yellow]Could not copy '{quickstart}' - destination may already exist[/yellow]"
261-
)
236+
console.print(f"[yellow]Could not copy '{quickstart}' - destination may already exist[/yellow]")
262237
console.print("Use --force to overwrite")
263238

264239
return
@@ -310,19 +285,15 @@ def init(
310285
copied = _copy_pkg_tree(pkg_rel, dst, force)
311286

312287
if copied:
313-
console.print(
314-
f"\n[green]✅ Successfully copied example '{template}'![/green]"
315-
)
288+
console.print(f"\n[green]✅ Successfully copied example '{template}'![/green]")
316289
console.print(f"Created: [cyan]{dst}[/cyan]\n")
317290
console.print("[bold]Next steps:[/bold]")
318291
console.print(f"1. cd [cyan]{dst}[/cyan]")
319292
console.print("2. Review the README for instructions")
320293
console.print("3. Add your API keys to config/secrets files if needed")
321294
else:
322295
console.print(f"[yellow]Example '{template}' could not be copied[/yellow]")
323-
console.print(
324-
"The destination may already exist. Use --force to overwrite."
325-
)
296+
console.print("The destination may already exist. Use --force to overwrite.")
326297

327298
return
328299

@@ -366,13 +337,6 @@ def init(
366337
if created:
367338
files_created.append(created)
368339

369-
# Add basic requirements.txt
370-
requirements_content = _load_template("requirements.txt")
371-
if requirements_content:
372-
created = _write_requirements(dir, requirements_content, force)
373-
if created:
374-
files_created.append(created)
375-
376340
elif template == "server":
377341
server_path = dir / "main.py"
378342
server_content = _load_template("basic_agent_server.py")

src/mcp_agent/data/templates/README_basic.md

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

1616
## Quick start
1717

18-
1. Add your OpenAI API key to `mcp_agent.secrets.yaml` (or set `OPENAI_API_KEY` env var).
18+
1. Add API keys to `mcp_agent.secrets.yaml` (or set env vars):
1919

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`.
20+
- `OPENAI_API_KEY` (recommended)
21+
- `ANTHROPIC_API_KEY` (optional)
2122

2223
2. Review `mcp_agent.config.yaml`:
2324

@@ -29,7 +30,6 @@ NOTE: You can use another supported provider (e.g. Anthropic) instead, just be s
2930
3. Run locally:
3031

3132
```bash
32-
uv pip install -r requirements.txt
3333
uv run main.py
3434
```
3535

@@ -38,58 +38,23 @@ You’ll see two summaries printed:
3838
- A summary of `README.md` from your current directory.
3939
- A summary of the intro page at modelcontextprotocol.io.
4040

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

4345
- In `main.py`, UNCOMMENT the server lines that call `create_mcp_server_for_app(agent_app)` and `run_sse_async()`.
4446
- Start the server: `uv run main.py`
45-
- Once you see the server started, e.g.
46-
```bash
47-
Uvicorn running on http://127.0.0.1:8000
48-
```
49-
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:
50-
51-
```bash
52-
npx @modelcontextprotocol/inspector --transport sse --server-url http://127.0.0.1:8000/sse
53-
```
54-
55-
5. Deploy as a remote MCP server:
56-
57-
When you're ready to deploy, ensure the required API keys are set in `mcp_agent.secrets.yaml` and then run:
58-
59-
```bash
60-
uv run mcp-agent login
61-
```
62-
63-
to authenticate to mcp-agent cloud. You will be redirected to the login page, create an mcp-agent cloud account through Google or Github.
6447

65-
Set up your mcp-agent cloud API Key and copy & paste it into your terminal
48+
When you're ready to deploy, simply run:
6649

6750
```bash
68-
INFO: Directing to MCP Agent Cloud API login...
69-
Please enter your API key 🔑:
51+
mcp-agent deploy "hello_world"
7052
```
7153

72-
In your terminal, deploy the MCP app:
73-
74-
```bash
75-
uv run mcp-agent deploy hello_world
76-
```
77-
78-
You will then be prompted to specify the type of secret to save your OpenAI API key as. Select (1) deployment secret so that it is available to the deployed server.
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-
```
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.
9156

92-
## Notes
57+
Notes
9358

9459
- `app_ctx` is the MCPApp Context (configuration, logger, upstream session, etc.).
9560
- 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: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
- @app.tool and @app.async_tool decorators to expose your agents as long-running tools on an MCP server.
88
- Advanced MCP features: Notifications, sampling, and elicitation
99
10-
You can run this example locally using "uv run main.py", and also deploy it as an MCP server using "uv run mcp-agent deploy".
10+
You can run this example locally using "uv run main.py", and also deploy it as an MCP server using "mcp-agent deploy".
1111
1212
Let's get started!
1313
"""
@@ -21,12 +21,7 @@
2121
from mcp_agent.agents.agent import Agent
2222
from mcp_agent.agents.agent_spec import AgentSpec
2323
from mcp_agent.core.context import Context as AppContext
24-
25-
# UNCOMMENT to run this MCPApp as a server
26-
# from mcp_agent.server.app_server import create_mcp_server_for_app
2724
from mcp_agent.workflows.factory import create_agent
28-
29-
# We are using the OpenAI augmented LLM for this example but you can swap with others (e.g. AnthropicAugmentedLLM)
3025
from mcp_agent.workflows.llm.augmented_llm_openai import OpenAIAugmentedLLM
3126

3227
# Create the MCPApp, the root of mcp-agent.
@@ -139,8 +134,7 @@ async def main():
139134
print("Webpage summary:")
140135
print(webpage_summary)
141136

142-
# UNCOMMENT to run this MCPApp as an MCP server (also uncomment the import of create_mcp_server_for_app at the top)
143-
# NOTE: You can comment-out the above agent runs if you only want to run the server
137+
# UNCOMMENT to run this MCPApp as an MCP server
144138
#########################################################
145139
# Create the MCP server that exposes both workflows and agent configurations,
146140
# optionally using custom FastMCP settings
@@ -154,7 +148,7 @@ async def main():
154148
asyncio.run(main())
155149

156150
# When you're ready to deploy this MCPApp as a remote SSE server, run:
157-
# > uv run mcp-agent deploy "hello_world"
151+
# > mcp-agent deploy "hello_world"
158152
#
159153
# Congrats! You made it to the end of the getting-started example!
160154
# 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/requirements.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/mcp_agent/data/templates/secrets.yaml

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,26 @@
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.
65
# You can also set these as environment variables instead
76
openai:
8-
api_key: "" # Or remove and use OPENAI_API_KEY env var
7+
api_key: "" # Or use OPENAI_API_KEY env var
98

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

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

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
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
2120

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"
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"
2625

2726
# MCP Server environment variables
2827
# mcp:
@@ -32,4 +31,4 @@ openai:
3231
# GITHUB_PERSONAL_ACCESS_TOKEN: ghp_...
3332
# brave-search:
3433
# env:
35-
# BRAVE_API_KEY: BSA_...
34+
# BRAVE_API_KEY: BSA_...

0 commit comments

Comments
 (0)