Skip to main content

Universal MCP Agent & Toolkit for intelligent LLM tool orchestration

Project description

PolymCP Logo

PyPI version Python Versions License GitHub stars PyPI downloads Website

Universal MCP toolkit and agent framework for Python and TypeScript.

Overview

PolyMCP gives teams one consistent way to expose tools, connect MCP servers, and run agents that orchestrate those tools. It ships in Python and TypeScript, plus a standalone Inspector and an MCP Apps SDK.

Version: 1.3.6

What You Can Build

  • MCP servers from normal functions
  • MCP clients over HTTP, stdio, or in-process transports
  • Agents that orchestrate one or more MCP servers
  • 🦞 Autonomous OpenClaw-style execution agent workflows with PolyClaw (Docker-first)
  • Skills via skills.sh for tool selection and capability packaging
  • UI-based MCP Apps with HTML resources and tool bridges

Project Map

  • polymcp/ Python package (tools, agents, auth, sandbox, CLI)
  • polymcp-ts/ TypeScript implementation
  • polymcp-ts/use_cases/ TypeScript runnable B2B/B2C use cases
  • polymcp-inspector/ standalone Inspector app
  • polymcp_website/ marketing/docs website
  • use_cases/ Python runnable B2B/B2C use cases
  • polymcp_sdk_mcp_apps/ MCP Apps SDK
  • polymcp/cli/ CLI documentation
  • examples/ runnable examples
  • tests/ Python tests
  • registry/ sample registry files
  • my-project/ scaffold output from polymcp init

Quick Start (Python)

Requirements: Python 3.8+

pip install polymcp

Create an MCP HTTP server from plain functions:

from polymcp import expose_tools_http


def add(a: int, b: int) -> int:
    return a + b


app = expose_tools_http(
    tools=[add],
    title="Math Server",
    description="MCP tools over HTTP",
)

Run:

uvicorn server:app --host 0.0.0.0 --port 8000

Quick Start (TypeScript)

Requirements: Node.js 18+

cd polymcp-ts
npm install
npm run build

Skills (skills.sh)

PolyMCP delegates skills management to the skills.sh CLI. PolyAgent and UnifiedPolyAgent automatically inject relevant skills into prompts to improve tool selection and planning.

npx skills --help

# Install in current project (./.agents/skills)
npx skills add vercel-labs/agent-skills

# Install globally (~/.agents/skills)
npx skills add vercel-labs/agent-skills -g

npx skills list
npx skills list -g

Python helper:

from polymcp import run_skills_cli

run_skills_cli(["add", "vercel-labs/agent-skills"])

Agents load skills from:

  • ./.agents/skills
  • ./.skills
  • ~/.agents/skills

If Python agents find no project skills, they print:

[WARN] No project skills found in .agents/skills or .skills.
Use global skills: polymcp skills add vercel-labs/agent-skills -g
Or local skills: polymcp skills add vercel-labs/agent-skills

Skills.sh Agent Example (Python)

python examples/simple_example.py
polymcp skills add vercel-labs/agent-skills
python examples/skills_sh_agent_example.py

Minimal server:

import { tool, exposeToolsHttp } from 'polymcp-ts';
import { z } from 'zod';

const add = tool({
  name: 'add',
  description: 'Add two numbers',
  parameters: z.object({ a: z.number(), b: z.number() }),
  execute: async ({ a, b }) => a + b,
});

const app = await exposeToolsHttp([add], {
  title: 'Math Server',
  description: 'MCP tools over HTTP',
  version: '1.0.0',
});

app.listen(3000);

Inspector

The Inspector is the fastest way to test MCP servers, tools, prompts, and UI resources.

Run standalone Inspector:

cd polymcp-inspector
python -m polymcp_inspector --host 127.0.0.1 --port 6274 --no-browser

Open:

http://127.0.0.1:6274/

Features:

  • chat playground with independent multi-tab sessions (per-tab provider, model, servers, and history)
  • tool, resource, and prompt explorers
  • MCP Apps UI preview with tool-call bridge
  • LLM orchestration (Ollama, OpenAI, Anthropic)
  • settings page for Inspector/OpenAI/Claude API keys
  • auto-tools routing (LLM decides if tools are needed)
  • secure mode with API key and rate limits

MCP Apps SDK

Use polymcp_sdk_mcp_apps/ to build UI-first MCP Apps quickly.

cd polymcp_sdk_mcp_apps
npm install
npm run example:quickstart

Connect Inspector to your app server and open the app://... resource in Resources.

Agent Orchestration Examples

Python, multiple MCP servers:

from polymcp.polyagent import UnifiedPolyAgent, OpenAIProvider

agent = UnifiedPolyAgent(
    llm_provider=OpenAIProvider(model="gpt-4o-mini"),
    mcp_servers=[
        "http://localhost:8000/mcp",
        "http://localhost:8001/mcp",
    ],
    verbose=True,
)

answer = agent.run("Read sales data, compute totals, then summarize.")
print(answer)

TypeScript, HTTP + stdio:

import { UnifiedPolyAgent, OpenAIProvider } from 'polymcp-ts';

const agent = new UnifiedPolyAgent({
  llmProvider: new OpenAIProvider({
    apiKey: process.env.OPENAI_API_KEY!,
    model: 'gpt-4o-mini',
  }),
  mcpServers: ['http://localhost:3000/mcp'],
  stdioServers: [{ command: 'npx', args: ['@playwright/mcp@latest'] }],
  verbose: true,
});

await agent.start();
const answer = await agent.run('Collect data and summarize.');
console.log(answer);

🦞 PolyClaw (Autonomous OpenClaw-Style Agent)

PolyClaw is an autonomous agent inspired by OpenClaw, designed for end-to-end execution in PolyMCP workflows.

What it does:

  • Understands a goal and executes the workflow autonomously
  • Runs real shell actions inside Docker with the project mounted at /workspace
  • Can create, configure, register, and test MCP servers via polymcp CLI when useful
  • Adapts strategy from command output and continues until completion
  • Produces a final report with completed actions, failures, and next concrete step

Safety defaults:

  • Delete/remove commands require confirmation by default (--confirm-delete)
  • If destructive commands are denied, PolyClaw reports that no removal was executed
  • Recommended usage: isolated Docker environments for autonomous runs

Python examples:

  • examples/polyclaw_example.py
  • examples/polyclaw_mcp_workflow_example.py

CLI

polymcp init my-project --type http-server
polymcp server add http://localhost:8000/mcp
polymcp agent run
polymcp agent run --type polyclaw --query "Create and validate a local MCP workflow"
polymcp inspector

See polymcp/cli/README.md for full commands.

Development

Python:

pip install -e .[dev]
python -m pytest

TypeScript:

cd polymcp-ts
npm run build
npm test
npm run lint

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

polymcp-1.3.8.tar.gz (171.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

polymcp-1.3.8-py3-none-any.whl (180.6 kB view details)

Uploaded Python 3

File details

Details for the file polymcp-1.3.8.tar.gz.

File metadata

  • Download URL: polymcp-1.3.8.tar.gz
  • Upload date:
  • Size: 171.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for polymcp-1.3.8.tar.gz
Algorithm Hash digest
SHA256 c2b9fdd92579ac0b17bc5067943b23ace5eac1531717f997d9fa9076834da52a
MD5 90d4969de85bd6479f9d7340b6290073
BLAKE2b-256 792291a3c7c4076cf16d34c94985fc65ccb2b39d41b386122a57c6f1a6ee70a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for polymcp-1.3.8.tar.gz:

Publisher: publish.yml on poly-mcp/PolyMCP

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file polymcp-1.3.8-py3-none-any.whl.

File metadata

  • Download URL: polymcp-1.3.8-py3-none-any.whl
  • Upload date:
  • Size: 180.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for polymcp-1.3.8-py3-none-any.whl
Algorithm Hash digest
SHA256 dd665d3cdec179d46fd2ba365b66f01d412b61a0a04a0924d2f01433fb4bd65c
MD5 3dc5ef3c06df2527524741952df91529
BLAKE2b-256 6e2f8ae5f3f6c42298c99c5fd9acfaec0ebbee032c005ab12327d963ee56ce6e

See more details on using hashes here.

Provenance

The following attestation bundles were made for polymcp-1.3.8-py3-none-any.whl:

Publisher: publish.yml on poly-mcp/PolyMCP

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page