Content
<div align="center">
<table align="center">
<tr>
<td>
<pre>
███ ███ ██████ ███████ ██████ ████████ ██████ ██████ ███████
████ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ████ ██ ██ ███████ ██████ ██ ██ ██ ██████ █████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██████ ██ ██████ ██ ██████ ██ ██ ███████
</pre>
</td>
</tr>
</table>
---
   
[English](README_en.md) |
[Online Experience](https://web.mcpstore.wiki) | [Documentation](https://doc.mcpstore.wiki/) | [Quick Start](###Quick-Start)
</div>
### What is mcpstore?
The best MCP management package for developers, for quickly maintaining MCP services and applications.
### Quick Start
```bash
pip install mcpstore
```
### Rust-first Architecture
The current `mcpstore` uses Rust as the only real runtime:
- `mcpstore api` starts a complete HTTP API service directly with a Rust binary.
- `mcpstore mcp-server` exposes the MCP Server directly with a Rust binary, supporting `stdio` and `streamable-http`.
- The Python package mainly provides a PyO3 store facade, Python adapter, and a few compatibility entries required by the Python ecosystem.
If you only want to use `mcpstore` as an independent service, directly call the Rust CLI:
```bash
mcpstore api --config-path ./mcp.json --port 18200
mcpstore mcp-server --config-path ./mcp.json
mcpstore mcp-server --config-path ./mcp.json --transport streamable-http --port 18300 --path /mcp
```
### Simple Example
The beginning of everything: initialize a store
```python
from mcpstore import MCPStore
store = MCPStore.setup_store()
```
Now you have a `store`. Use `store` to use your MCP service. `store` will maintain and manage these MCP services.
#### Add the First Service to the Store
```python
# Add the following code below
store.for_store().add_service({"mcpServers": {"mcpstore_wiki": {"url": "https://www.mcpstore.wiki/mcp"}}})
store.for_store().wait_service("mcpstore_wiki")
```
The `add_service` method supports multiple MCP service configuration formats. `wait_service` is used to wait for the service to be ready.
#### Convert MCP to LangChain Objects
```python
# Add the following code below
tools = store.for_store().for_langchain().list_tools()
print("loaded langchain tools:", len(tools))
```
Easily convert MCP services to LangChain tool lists.
##### Framework Adaptation
Actively supports more frameworks.
| Supported Frameworks | Get Tools |
| --- | --- |
| LangChain | `tools = store.for_store().for_langchain().list_tools()` |
| LangGraph | `tools = store.for_store().for_langgraph().list_tools()` |
| AutoGen | `tools = store.for_store().for_autogen().list_tools()` |
| CrewAI | `tools = store.for_store().for_crewai().list_tools()` |
| LlamaIndex | `tools = store.for_store().for_llamaindex().list_tools()` |
#### Code Usage (LangChain Example)
```python
# Add the above code
from langchain.agents import create_agent
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
temperature=0,
model="your-model",
api_key="sk-*****",
base_url="https://api.xxx.com"
)
agent = create_agent(model=llm, tools=tools, system_prompt="You are an assistant. Please answer with an emoji.")
events = agent.invoke({"messages": [{"role": "user", "content": "How to add services with mcpstore?"}]})
print(events)
```
As you can see, the LangChain agent can now call the MCP services managed by `store`.
#### Grouping Agents
Use `for_agent(agent_id)` to implement grouping.
```python
# Different agents require different MCP collections.
agent_id1 = "agent1"
store.for_agent(agent_id1).add_service({"name": "mcpstore_wiki", "url": "https://www.mcpstore.wiki/mcp"})
agent_id2 = "agent2"
store.for_agent(agent_id2).add_service({"name": "gitodo", "command": "uvx", "args": ["gitodo"]})
agent1_tools = store.for_agent(agent_id1).list_tools()
agent2_tools = store.for_agent(agent_id2).list_tools()
```
`store.for_agent(agent_id)` and `store.for_store()` mirror most function interfaces. The agent grouping is a logical subset of `store`.
By isolating MCP services for different agents, avoid lengthy context and let `store` uniformly maintain.
#### Rust API and MCP Server
Currently, it is recommended to directly use the Rust CLI to expose services, rather than relying on historical Python hub interfaces:
```bash
# Start Rust HTTP API
mcpstore api --config-path ./mcp.json --host 127.0.0.1 --port 18200
# Start Rust MCP Server with stdio
mcpstore mcp-server --config-path ./mcp.json
# Start Rust MCP Server with streamable-http
mcpstore mcp-server --config-path ./mcp.json --transport streamable-http --host 127.0.0.1 --port 18300 --path /mcp
```
The Python side no longer provides an embedded API server. Please directly use the Rust CLI to start services.
#### Common Interfaces
| Action | Command Example |
| --- | --- |
| Locate Service | `store.for_store().find_service("service_name")` |
| Update Service | `store.for_store().update_service("service_name", new_config)` |
| Incremental Update | `store.for_store().patch_service("service_name", {"headers": {"X-API-Key": "..."}})` |
| Delete Service | `store.for_store().delete_service("service_name")` |
| Restart Service | `store.for_store().restart_service("service_name")` |
| Disconnect Service | `store.for_store().disconnect_service("service_name")` |
| Health Check | `store.for_store().check_services()` |
| View Configuration | `store.for_store().show_config()` |
| Service Details | `store.for_store().service_info("service_name")` |
| Wait for Readiness | `store.for_store().wait_service("service_name", timeout=30)` |
| List Agents | `store.for_store().list_agents()` |
| List Services | `store.for_store().list_services()` |
| List Tools | `store.for_store().list_tools()` |
| List Resources | `store.for_store().list_resources()` |
| Read Resource | `store.for_store().read_resource("resource://uri")` |
| List Prompts | `store.for_store().list_prompts()` |
| Get Prompt | `store.for_store().get_prompt("prompt_name", {"k": "v"})` |
| Execute Tool | `store.for_store().call_tool("tool_name", {"k": "v"})` |
#### Hot-swappable Data Source and Sharing
Supports using a KV database as a shared cache backend (e.g., Redis) for cross-process/multi-instance shared services and tools.
```bash
pip install mcpstore[redis]
# or directly install redis
# or other databases supported by pyvk
```
##### Quick Usage
```python
from mcpstore import MCPStore
from mcpstore.config import RedisConfig
redis_config = RedisConfig(
host="127.0.0.1",
port=6379,
password=None,
namespace="demo_namespace" # isolation prefix to prevent conflicts
)
store = MCPStore.setup_store(cache=redis_config)
```
With the database configuration defined in `cache`, all data will be saved. This means that as long as different instances of `store` can access the database, they can share MCP service data and collaborate.
This also means you can manage your MCP services in a distributed manner. In resource-constrained environments, you can share MCP services maintained by `store`.
You can start a `store` configured with `RedisConfig` in a resource-rich environment.
Then, in several resource-constrained environments, you can use the `only_db` method to abandon management and maintenance of MCP services. All operations on MCP services will be notified to the shared environment to maintain `store` and processes.
```python
from mcpstore import MCPStore
from mcpstore.config import RedisConfig
redis_config = RedisConfig(
host="127.0.0.1",
port=6379,
password=None,
namespace="demo_namespace" # use the same namespace to isolate different keys in the same database
)
store = MCPStore.setup_store(cache=redis_config, only_db=True) # configure only_db here
store.for_store().list_services()
```
For more details, refer to the `setup_store` configuration documentation.
### API and MCP Services
The current version has built-in Rust API and Rust MCP Server:
- `mcpstore api`: starts a complete HTTP API service
- `mcpstore mcp-server`: starts an MCP Server
Therefore, external service capabilities should be understood as Rust-first. Python no longer carries independent API/MCP core implementations.
### Docker Deployment
Some Docker configurations are provided for convenience. The goal of this project is to create a more convenient and user-friendly MCP management package, not to complete a project build. Therefore, the project design may not be perfect or mature. Welcome to provide suggestions.
## Star History
<div align="center">
[](https://star-history.com/#whillhill/mcpstore&Date)
</div>
---
McpStore is still under high-frequency updates. Welcome feedback and suggestions.