Token导航 LogoToken导航TokenDH.com
MCP Basic Architecture logo
AI代理stdio官方级别未说明来源级核验

MCP Basic Architecture

MCP Server

一个基于LangGraph的模型上下文协议(MCP)服务器,提供模块化、可扩展的工具和资源管理功能。

工具数

0

提示词数

0

GitHub Stars

1

资源数

0
工具管理Python模块化设计LangGraph

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

rezawr

提供方

rezawr

最后核验

2026/5/17 20:19

运行时

Python

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

python -m app.server

详细介绍

](https://mseep.ai/app/rezawr-mcp-basic-architecture)

LangGraph MCP服务器

用于LangGraph文档的模型上下文协议(MCP)服务器的干净、模块化实现。

建筑

该项目遵循干净的架构模式,随着更多功能的添加,使MCP服务器更易于维护和调试。

目录结构

app/
├── config.py                  # Configuration settings
├── server.py                  # Main server entry point
├── resources/                 # Resources that can be accessed by clients
│   ├── __init__.py            # Resource registration
│   └── langgraph_resources.py # LangGraph-specific resources
├── tools/                     # Tools that can be called by clients
│   ├── __init__.py            # Tool registration
│   └── langgraph_tools.py     # LangGraph-specific tools
└── utils/                     # Utility functions
    ├── __init__.py
    └── logging_utils.py       # Logging utilities

核心组件

  1. 服务器:初始化MCP服务器并注册所有工具和资源的主要入口点。
  2. 配置:所有配置设置的中心位置。
  3. 工具:客户端可以调用以执行特定任务的函数。
  4. 资源:客户端可以访问的数据源。
  5. 工具集:整个应用程序中使用的实用功能。

添加新功能

添加新工具

  1. 在中创建新文件 app/tools/ 目录(例如。, weather_tools.py).
  2. 在此文件中定义您的工具功能。
  3. 创建注册功能(例如。, register_weather_tools).
  4. 在中导入并调用此注册函数 app/tools/__init__.py.

例子:

# app/tools/weather_tools.py
def register_weather_tools(mcp):
    mcp.tool()(get_weather)

def get_weather(city: str):
    """Get weather for a city"""
    # Implementation
    return f"Weather for {city}: Sunny, 75°F"

# app/tools/__init__.py
from app.tools.langgraph_tools import register_langgraph_tools
from app.tools.weather_tools import register_weather_tools

def register_tools(mcp):
    register_langgraph_tools(mcp)
    register_weather_tools(mcp)

添加新资源

  1. 在中创建新文件 app/resources/ 目录(例如。, weather_resources.py).
  2. 在此文件中定义资源函数。
  3. 创建注册功能(例如。, register_weather_resources).
  4. 在中导入并调用此注册函数 app/resources/__init__.py.

例子:

# app/resources/weather_resources.py
def register_weather_resources(mcp):
    mcp.resource("weather://forecast")(get_weather_forecast)

def get_weather_forecast():
    """Get weather forecast"""
    # Implementation
    return "5-day weather forecast data"

# app/resources/__init__.py
from app.resources.langgraph_resources import register_langgraph_resources
from app.resources.weather_resources import register_weather_resources

def register_resources(mcp):
    register_langgraph_resources(mcp)
    register_weather_resources(mcp)

运行服务器

要运行服务器,请执行以下操作:

python -m app.server

这种架构的好处

  1. 模块化:每个组成部分都有一个单一的职责。
  2. 可扩展性:无需修改现有代码,即可轻松添加新工具和资源。
  3. 可维护性:有组织的结构使调试更容易。
  4. 可扩展性:随着更多功能的添加,可以处理增长。
  5. 可测试性:组件可以单独测试。

目录标签

目录标签

工具管理Python模块化设计LangGraph服务器架构本地部署模型上下文协议

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

运行时(runtime,运行环境)

Python

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP