MCP Integration
Agently can attach MCP tools to an agent. Once attached, the model can call those tools on demand.
Basic usage
python
import asyncio
from agently import Agently
agent = Agently.create_agent()
async def main():
result = await agent.use_mcp("http://localhost:8080/mcp").input("333+546=?").async_start()
print(result)
asyncio.run(main())Local MCP server
If you run an MCP server from a local script, pass its path:
python
from pathlib import Path
mcp_path = Path("cal_mcp_server.py").resolve()
result = await agent.use_mcp(str(mcp_path)).input("333+546=?").async_start()