Legion Demo
Enables interaction with the Agent Legion platform through MCP. Provides tools such as tool_say_hi to demo the server's capabilities.
README
legion-demo
Live demo agent for the 图灵星球 Agent Legion platform — connect over MCP and ask it about the platform.
A member agent of 图灵星球 Agent 军团, generated from agent-template with Copier. Run copier update to pull future template changes (your code is preserved; conflicts come out as markers to resolve).
Setup checklist
- Install & run locally → Run the MCP server (
poetry install, connect Claude). - Push to GitHub as its own repo — run from inside this folder so the repo root is the agent:
(If your deploy later says "root only contains subdirectories", you pushed a parent folder — redo this from inside the agent folder.)git init && git add -A && git commit -m "Scaffold from agent-template" gh repo create legion-demo --private --source . --push - Fleet auto-sync (optional but recommended) → grant the bot access.
- Deploy (optional) → Deploy remotely.
Layout
agent.manifest.yaml— the instruction card: toolchain, paths, and commands.config.py— THE one config file: every runtime knob (transport, port, model) plus the checklist of env vars/secrets a deployment needs. Changing model or platform later = read this one file.api/— your business logic (replace the placeholderrun();say_hi()is a working example).mcp_server/— one process, two surfaces over/api: an MCP server at/mcp(for Claude) and a REST API at/api(FastAPI, for humans/other services). Local runs use stdio (MCP only); deployed runs serve both over HTTP.tests/— smoke tests..github/workflows/review.yml— thin pointer to the central review flow.
Run the MCP server & connect Claude
poetry install # once
# register with Claude (run from the repo root; stores absolute paths):
claude mcp add legion-demo -- poetry -C "$(pwd)" run python "$(pwd)/mcp_server/server.py"
Then in Claude, ask it to call the tool_say_hi tool — it replies with this server's timezone and current time:
hello from PDT 2026-07-03 15:04:05: hi
Add your own tools by writing functions in api/ and exposing them with @mcp.tool() in mcp_server/server.py.
Deploy remotely (connect from anywhere)
The same server switches to HTTP mode automatically when the platform injects a PORT (Railway, Render, Fly.io — any always-on host; serverless platforms like Vercel don't fit this Python server). No code change needed:
- Make sure
poetry.lockis committed (created at scaffold time; builders detect a Poetry project by it). - Push this repo to GitHub and create a project on your platform (e.g. Railway → Deploy from GitHub repo). The start command ships in
railpack.json— Railway picks it up with zero configuration; the injectedPORTflips the server to HTTP, serving MCP at/mcp. - Your deployed app serves both surfaces (replace
<your-app-url>with your real deployment URL):- MCP at
https://<your-app-url>/mcp— connect Claude from any machine. The-cloudsuffix keeps this remote registration separate from your local stdio one (same server name would clash):
Then in a new Claude session:claude mcp add --transport http --scope user legion-demo-cloud https://<your-app-url>/mcp/mcpshowslegion-demo-cloudconnected → ask it to calltool_say_hi→ the time comes back in the server's timezone (e.g. UTC on Railway), proof it's the remote one. - REST API at
https://<your-app-url>/api/...— for humans, scripts, or other services:Add more endpoints incurl https://<your-app-url>/api/say_hi # {"message":"hello from UTC …: hi"}mcp_server/server.py(build_http_app), reusing your/apilogic.
- MCP at
Everything configurable about the deployment (transport, port, model, which secrets to set) is documented in config.py — that's the only file to read when you change platform or model.
⚠️ A deployed server is public: anyone with the URL can call your tools. Fine for the harmless starter tools; add auth before exposing tools that touch real data.
Fleet auto-sync (keep this repo on the latest template)
This agent can be tracked by the fleet migration bot: when a new agent-template version ships, the bot opens a PR here bumping you to it (you review + merge — never auto-merged). Two things must be true:
- You're listed in the fleet's
members.yaml. The scaffold offers to open that PR for you (the first Copier question). If you skipped it or lacked registry access, ask the platform admin to add:- name: legion-demo repo: <owner>/legion-demo - The bot's GitHub App can access this repo. ⚠️ Registration alone is NOT enough — a GitHub App can't grant itself access; the owner of this repo's account grants it once:
- GitHub → Settings → Applications → Installed GitHub Apps →
fleet-migration-bot→ Configure - Under Repository access: add this repo, or choose All repositories (simplest for a personal account — the bot only ever touches repos in
members.yaml). - On an org you don't administer, ask the platform admin to grant it.
- GitHub → Settings → Applications → Installed GitHub Apps →
If a sync run fails with "Not Found" on your repo, it's always #2 — the App hasn't been granted access yet.
How review works
Open a pull request → the review flow from policies reads the manifest, installs, runs the tests, lints, scans for security issues, lets the AI reviewer advise — and the gate (the hard checks) decides pass/fail. See the platform overview for the full picture.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。