展示HN:PolyMCP技能 – 基于MCP的AI代理的可扩展工具组织

1作者: justvugg3 天前原帖
大家好, 我在PolyMCP中添加了一个技能系统,以解决大规模MCP服务器常见的问题。 当工具数量增加时: - 代理在加载原始模式时消耗令牌 - 工具发现变得嘈杂 - 不同的代理需要不同子集的工具 - 编排逻辑泄漏到提示中 技能是经过整理的、结构化的MCP工具集,并附有文档。代理只加载它们所需的技能,而不是完整的工具模式。 技能是通过从MCP服务器发现工具并自动分类生成的。 示例:从Playwright MCP服务器生成技能: ``` polymcp skills generate --servers "npx @playwright/mcp@latest" ``` HTTP MCP服务器: ``` polymcp skills generate \ --servers "http://localhost:8000/mcp" \ --output ./mcp_skills ``` 标准输入MCP服务器: ``` polymcp skills generate \ --stdio \ --servers "npx -y @playwright/mcp@latest" \ --output ./mcp_skills ``` 在代理中启用技能: ```python agent = UnifiedPolyAgent( llm_provider=llm, skills_enabled=True, skills_dir="./mcp_skills", ) ``` 好处: - 更小的代理上下文 - 可扩展到大型工具集 - 代理之间可重用的能力 - 工具访问控制无需更改提示 - 适用于HTTP和标准输入MCP服务器 仓库链接: [https://github.com/poly-mcp/Polymcp](https://github.com/poly-mcp/Polymcp)
查看原文
Hi everyone, I added a skills system to PolyMCP to solve a common issue with MCP servers at scale.<p>When the number of tools grows: • Agents burn tokens loading raw schemas • Tool discovery becomes noisy • Different agents need different subsets of tools • Orchestration logic leaks into prompts<p>Skills are curated, structured sets of MCP tools with documentation. Agents load only the skills they need instead of full tool schemas.<p>Skills are generated by discovering tools from MCP servers and auto-categorizing them.<p>Example: generate skills from a Playwright MCP server:<p>polymcp skills generate --servers &quot;npx @playwright&#x2F;mcp@latest&quot;<p>HTTP MCP servers:<p>polymcp skills generate \ --servers &quot;http:&#x2F;&#x2F;localhost:8000&#x2F;mcp&quot; \ --output .&#x2F;mcp_skills<p>Stdio MCP servers:<p>polymcp skills generate \ --stdio \ --servers &quot;npx -y @playwright&#x2F;mcp@latest&quot; \ --output .&#x2F;mcp_skills<p>Enable skills in an agent:<p>agent = UnifiedPolyAgent( llm_provider=llm, skills_enabled=True, skills_dir=&quot;.&#x2F;mcp_skills&quot;, )<p>Benefits: • Smaller agent context • Scales to large tool sets • Reusable capabilities across agents • Tool access control without prompt changes • Works with HTTP and stdio MCP servers<p>Repo: <a href="https:&#x2F;&#x2F;github.com&#x2F;poly-mcp&#x2F;Polymcp" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;poly-mcp&#x2F;Polymcp</a>