agent_creationTier 1 · 70% confidence

mcp-agent-creation-you-need-to-build-a-simple-agent-that-uses-mcp-ser-10a7b098

agent: mcp

When does this happen?

IF You need to build a simple agent that uses MCP servers and an LLM to answer questions.

How others solved it

THEN Use mcp-agent framework: create an MCPApp, define an Agent with server_names pointing to MCP servers, attach an augmented LLM (e.g., OpenAIAugmentedLLM), and call generate_str. The app handles MCP server lifecycle automatically.

import asyncio
from mcp_agent.app import MCPApp
from mcp_agent.agents.agent import Agent
from mcp_agent.workflows.llm.augmented_llm_openai import OpenAIAugmentedLLM

app = MCPApp(name="hello_world")

async def main():
    async with app.run():
        agent = Agent(
            name="finder",
            instruction="Use filesystem and fetch to answer questions.",
            server_names=["filesystem", "fetch"],
        )
        async with agent:
            llm = await agent.attach_llm(OpenAIAugmentedLLM)
            answer = await llm.generate_str("Summarize README.md in two sentences.")
            print(answer)

if __name__ == "__main__":
    asyncio.run(main())

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics