mcpstore
开盒即用的优雅管理mcp服务 | 结合Agent框架 | 作者听劝 | 已发布pypi | Vue页面demo Python-based implementation.
Documentation
mcpstore 是什么?
mcpstore 是一个基于 Rust 构建的 MCP 管理平台,覆盖 MCP 服务的配置、运行、调用与生命周期管理,并提供可复用的 SDK、命令行工具(CLI)以及 App/Web 应用等多种使用方式。
快速开始
SDK
Python(PyPI Lib)
pip install mcpstore
# 或:uv add mcpstoreRust Lib
cargo add mcpstoreCLI
# macOS / Linux
curl -fsSL https://raw.githubusercontent.com/ip2a/mcpstore/main/install.sh | bash
# 或使用 npm(macOS / Linux / Windows)
npm install -g mcpstoreApp
从 GitHub Releases 下载发行版。
App 功能
会话管理
统一查看和管理 MCP 会话,掌握当前连接状态与运行情况。
> 截图:`docs/assets/images/app-sessions.png`
会话转移
在不同 Agent 或工作区之间转移会话,保持上下文连续。
> 截图:`docs/assets/images/app-session-transfer.png`
技能管理
集中管理可用工具和技能,按需配置 Agent 的能力范围。
> 截图:`docs/assets/images/app-skills.png`
Agent 管理
创建和管理不同 Agent,为每个 Agent 配置独立的服务与工具。
> 截图:`docs/assets/images/app-agents.png`
CLI 使用
通过 CLI 管理 MCP 服务、查看运行状态,并为 Agent 提供命令行工作流。
SDK 使用
通过 Python SDK 或 Rust Lib 将 mcpstore 集成到自己的应用中。
简单示例
初始化 `store`:
from mcpstore import MCPStore
store = MCPStore.setup_store()通过 `store.for_store()` 管理全局作用域内的 MCP 服务和工具。
添加第一个服务
store.for_store().add_service({
"mcpServers": {
"mcpstore_wiki": {
"url": "https://example.com/mcp"
}
}
}).wait_service("mcpstore_wiki")`add_service` 接受 MCP 服务配置;`wait_service` 等待指定服务就绪。
转换为 LangChain 工具
tools = store.for_store().for_langchain().list_tools()
print("loaded langchain tools:", len(tools))适配器从 `store.for_store()` 读取工具,并转换为对应框架使用的对象。
框架适配
| 框架 | 获取工具 |
|---|---|
| LangChain | `tools = store.for_store().for_langchain().list_tools()` |
| LangGraph | `tools = store.for_store().for_langgraph().list_tools()` |
| OpenAI | `tools = store.for_store().for_openai().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()` |
| Semantic Kernel | `tools = store.for_store().for_semantic_kernel().list_tools()` |
在 LangChain 中使用
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="你是一个助手")
events = agent.invoke({
"messages": [{"role": "user", "content": "mcpstore 怎么添加服务?"}]
})
print(events)这里的 `tools` 由 `store.for_store()` 提供。
为 Agent 分组
使用 `for_agent(agent_id)` 为不同 Agent 建立独立作用域:
store.for_agent("agent1").add_service({
"name": "mcpstore_wiki",
"url": "https://example.com/mcp",
})
store.for_agent("agent2").add_service({
"name": "gitodo",
"command": "uvx",
"args": ["gitodo"],
})
agent1_tools = store.for_agent("agent1").list_tools()
agent2_tools = store.for_agent("agent2").list_tools()`store.for_agent(agent_id)` 与 `store.for_store()` 提供相同的操作,服务和工具按 Agent 作用域隔离。
Rust API 与 MCP Server
当前推荐直接使用 Rust CLI 暴露服务,而不是再依赖历史 Python hub 接口:
# 启动 Rust HTTP API
mcpstore api --config-path ./mcp.json --host 127.0.0.1 --port 1820
# 以 stdio 启动 Rust MCP Server
mcpstore mcp --config-path ./mcp.json
# 以 streamable-http 启动 Rust MCP Server
mcpstore mcp --config-path ./mcp.json --transport streamable-http --host 127.0.0.1 --port 1830 --path /mcpPython SDK 不再启动嵌入式 API server;需要对外提供服务时,请使用 Rust CLI。
常用接口
以下示例使用完整调用链:
| 动作 | 示例 |
|---|---|
| 添加服务 | `store.for_store().add_service(config)` |
| 定位服务 | `store.for_store().find_service("service_name")` |
| 查看服务信息 | `store.for_store().find_service("service_name").info()` |
| 查看服务状态 | `store.for_store().find_service("service_name").state()` |
| 更新服务 | `store.for_store().update_service("service_name", new_config)` |
| 增量更新 | `store.for_store().patch_service("service_name", updates)` |
| 等待就绪 | `store.for_store().wait_service("service_name", timeout=30)` |
| 重启服务 | `store.for_store().restart_service("service_name")` |
| 断开服务 | `store.for_store().disconnect_service("service_name")` |
| 删除服务 | `store.for_store().remove_service(service_name="service_name")` |
| 列出服务 | `store.for_store().list_services()` |
| 列出工具 | `store.for_store().list_tools()` |
| 列出当前作用域资源 | `store.for_store().list_resources()` |
| 列出当前作用域资源模板 | `store.for_store().list_resource_templates()` |
| 读取指定服务资源 | `store.for_store().find_service("service_name").read_resource("resource://uri")` |
| 列出当前作用域 Prompts | `store.for_store().list_prompts()` |
| 获取指定服务 Prompt | `store.for_store().find_service("service_name").get_prompt("prompt_name", {"k": "v"})` |
| 调用工具 | `store.for_store().find_tool("tool_name").call({"k": "v"})` |
| 查看配置 | `store.for_store().show_config()` |
| 列出 Agent | `store.list_agents()` |
数据源共享
可以使用 Redis 等 KV 后端,在多个进程或实例之间共享服务与工具数据。
Redis 示例
from mcpstore import MCPStore
from mcpstore.config import RedisConfig
redis_config = RedisConfig(
host="127.0.0.1",
port=6379,
password=None,
namespace="demo_namespace",
)
store = MCPStore.setup_store(source=redis_config)使用相同后端和 `namespace` 的实例可以共享数据。若当前进程只使用共享数据源、不维护本地服务实例,可设置 `mode="data_plane"`:
from mcpstore import MCPStore
from mcpstore.config import RedisConfig
redis_config = RedisConfig(
host="127.0.0.1",
port=6379,
password=None,
namespace="demo_namespace",
)
store = MCPStore.setup_store(source=redis_config, mode="data_plane")
services = store.for_store().list_services()Docker 部署
仓库提供 Docker 配置,可用于本地试用和部署。
Star History
欢迎通过 Issues 提交问题与建议。
Frequently asked questions
What is mcpstore?
mcpstore is 开盒即用的优雅管理mcp服务 | 结合Agent框架 | 作者听劝 | 已发布pypi | Vue页面demo Python-based implementation.
How do I install mcpstore?
Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.
Is mcpstore open source?
Yes — it is hosted on GitHub at https://github.com/whillhill/mcpstore and has 375 stars.
Related MCP tools
AWS MCP Servers — helping you get the most out of AWS, wherever you use MCP. Python-based implementation. Trusted by 6900+ developers.
🚀 The fast, Pythonic way to build MCP servers and clients Trusted by 19900+ developers. Trusted by 19900+ developers. Trusted by 19900+ developers.
Official MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
MCP 资源精选, MCP指南,Claude MCP,MCP Servers, MCP Clients Trusted by 4800+ developers. Trusted by 4800+ developers. Trusted by 4800+ developers.
🌐Web Agent Protocol (WAP) - Record and replay user interactions in the browser with MCP support Python-based implementation.
A text-based user interface (TUI) client for interacting with MCP servers using Ollama. Features include multi-server, dynamic model switching, streaming res...
Run your own MCP server? See who uses it and what to fix.
Measure it with TrackMCP