npcpy
The python library for research and development in NLP, multimodal LLMs, Agents, ML, Knowledge Graphs, and more.
claude mcp add --transport stdio npc-worldwide-npcpy python -m npcpy.mcp_server
How to use
npcpy is a flexible agent framework for building AI applications and conducting research with LLMs. Its MCP (Model Context Protocol) server enables coordinated multi-agent workflows, tool calling, and orchestration across agents and teams. With the server running, NPCs and teams can be connected to the MCP server to expose their tools and workflows to other agents, enabling complex, collaborative tasks such as data analysis, code review, file operations, and dynamic tool invocation. The server acts as a bridge between NPC-driven agents and external tools, enabling managed runtimes and consistent communication patterns for tool usage and result aggregation.
To use the MCP server, start the server process (see installation steps) and connect clients (NPCs) to it. Once connected, agents can call tools exposed by other agents or by the server itself, trigger multi-agent orchestration (e.g., a coordinator delegating tasks to a data analyst and a writer), and retrieve structured results including tool outputs and synthesized final responses. The server supports streaming responses, JSON-formatted outputs, and the ability to pass contextual information such as team context, models, and providers to guide agent behavior during tool calls.
How to install
Prerequisites
- Python 3.8+ installed on your system
- Access to a terminal/command prompt
- Internet connection to install dependencies
- Create a virtual environment (recommended)
- macOS/Linux: python3 -m venv venv source venv/bin/activate
- Windows: python -m venv venv .\venv\Scripts\activate
- Install the npcpy package (or install from source if developing)
pip install npcpy
- Verify installation
python -c "import npcpy; print(npcpy.__version__)"
- Start the MCP server
# From project root, using module-based execution as defined in mcp_config
python -m npcpy.mcp_server
- Connect clients to the MCP server (NPCs/teams) following the client documentation for npcpy.
Prerequisites recap
- Ensure Python is installed and accessible in your PATH
- Install npcpy and any optional providers/tools you plan to use
- Ensure network access if running server remotely or behind a firewall
Additional notes
Tips and common issues:
- If the MCP server fails to start due to port conflicts, specify a different port in the server startup configuration or via environment variables if supported by your setup.
- When connecting NPCs or teams, ensure the client is configured with the correct server address and authentication if required.
- Tools exposed via MCP should be well-scoped in their input/output formats; use consistent schemas for tool results to simplify downstream processing.
- For streaming responses, ensure the client is capable of handling incremental chunks and rendering or aggregating results as they arrive.
- If you run into import errors, verify that the Python environment where the server runs has npcpy and its dependencies installed (activate the correct virtual environment).
- Environment variables can be used to configure model/provider defaults, API keys, or logging levels; consult your deployment guide for recommended variables.
Related MCP Servers
nerve
The Simple Agent Development Kit.
mesh
One secure endpoint for every MCP server. Deploy anywhere.
mcp -odoo
A Model Context Protocol (MCP) server that enables AI assistants to securely interact with Odoo ERP systems through standardized resources and tools for data retrieval and manipulation.
mcp-in-action
极客时间MCP新课已经上线!超2000同学一起开启MCP学习之旅!
LLaMa -Streamlit
AI assistant built with Streamlit, NVIDIA NIM (LLaMa 3.3:70B) / Ollama, and Model Control Protocol (MCP).
mcpx-py
Python client library for https://mcp.run - call portable & secure tools for your AI Agents and Apps