Repository navigation
MCP
LightAgent can register tools from Model Context Protocol servers. In v1.0.0, install the optional mcp extra to use stdio, SSE, or Streamable HTTP. See the v1.0.0 integrations guide for installation, credentials, and session cleanup.
MCP settings are passed as a dictionary with mcpServers:
mcp_settings = {
"mcpServers": {
"weather-stdio": {
"command": "python",
"args": ["./mcp/mcpServers/mcpServer_demo_stdio.py"],
"disabled": False,
},
"weather-sse": {
"url": "http://localhost:8000/sse",
"headers": {
"Authorization": "Bearer token",
},
"disabled": True,
},
}
}Set disabled to False for servers that should be connected.
setup_mcp() is async:
import asyncio
from LightAgent import LightAgent
agent = LightAgent(
model="gpt-4.1",
api_key="your_api_key",
base_url="https://api.openai.com/v1",
)
asyncio.run(agent.setup_mcp(mcp_setting=mcp_settings))
response = agent.run("Use the available MCP tools to check the weather.")
print(response)During setup, LightAgent lists tools from enabled MCP servers and adds them to the agent tool registry.
Use stdio for local MCP servers:
{
"command": "python",
"args": ["./mcp/mcpServers/mcpServer_demo_stdio.py"],
"env": {"SOME_KEY": "value"},
"disabled": False,
}Validate the command independently before connecting it to LightAgent.
Use SSE for remote or long-running MCP servers:
{
"url": "http://localhost:8000/sse",
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer token",
},
"disabled": False,
}Confirm the SSE endpoint is reachable before debugging the agent layer.
- If no MCP tools appear, check
disabled, command paths, and server startup logs. - If a stdio server fails, run the command directly in a terminal.
- If an SSE server fails, test the endpoint and headers independently.
- If a tool call fails, check the MCP tool input schema and required arguments.
- Keep MCP server credentials out of committed files.
Reference files:
LightAgent Wiki - see the repository, releases, and issues.
- Installation and Your First Agent
- Tools and Integrations
- Memory, Sessions, and RAG
- Workflows and Multiple Agents
- Agent Backends and Codex
- Durable Execution, Jobs, and Subagents
- Safety, Observability, and Evaluation
- Usage, Cost Estimates, and Budgets
- Deployment, Migration, and Verification
- 安装与第一个 Agent
- 工具和集成
- 记忆、会话与 RAG
- 工作流与多 Agent
- 执行后端与 Codex
- 持久执行、Jobs 与 Subagents
- 安全、观测与评测
- 用量统计、费用估算与预算
- 部署、升级与验收
- Quick Start
- Core Concepts
- API Reference
- Examples Cookbook
- Migration Guide
- Tools
- Tool Generator
- Memory
- MCP
- Skills
- LightFlow
- Tree of Thought
- Self-Learning
- Multi-Agent
- Tracing and Debugging
- Langfuse Observability
- Model Providers
- browser-use Integration
- Testing and CI
- Deployment Guide
- Architecture
- Security
- Known Limitations
- FAQ
- FAQ 中文
- Roadmap
- Release Process
- Contributing