Files
Pietro Zullo be9942a4d4 feat/python/server (#559)
* feat: server first implementation

* docs: docs for server and images

* chore: locked langchain dependencies in pyproject.toml (#321)

* python/release/1.3.13

* catch uvicorn logs && log session id

* fix debug logic

* docs: logging update

* fix: icon of elicitation

* fix installation paths for local clones

* docs: minor restructuring

* docs: reorganization, killed non existing pages

* docs: beta tag on server

* chore: example servers

* feat: inspector autopopulated and client only

* feat: enhance MCP logging system with customizable formats and improved middleware

* feat: implement weather alert and forecast tools in FastMCP example server

* mcp path configurable

* fix inspector

* export as FastMCP too

* chore: update fastmcp migration example

* lock inspector version

* type runner

* unhide docs and remove dangers

* migration diff

* docs and context example

* export context

* logging improvement

* pretty JSON RPC

* autoConnect url param in inspecotr

* move logging

* type check

* Server Router

* show response logs

* fallback tool name to function name in router registration

* compatibility export

* Introduced ty and prek as type checker and precommit engine respectively - moved ruff config in pyproject toml

* add ty check

* ty runs only on staged files

* ty configuration fix

* move startup info in logging

* remove bug from action

* update claude rules

* fix resource serialization

* comments on inspector errors

* abstracted runner transports

* remove redunant call for network

* fix ip getter

* add inspector mcp path

* response limit logging

* disable ty check in action

* moved transport type to types

* support sse

* show transport type in logs

* change default transport

* refactored tests to use mcp server

* removed fastmcp

* file restructuring

* test table

* sampling, elicitation, tool disabling enabling

* deprecte sse server side

* simplified report

* fix action

* remove sse deprecated test

* move tests files to allow for server integration tests

* docs

* reorg integration test files

* api-reference-doxs

* fix broken links

* telemetry

* remove feature useage from scarf
2025-12-01 14:12:16 +01:00

53 lines
1.4 KiB
Python

"""
mcp_use - An MCP library for LLMs.
This library provides a unified interface for connecting different LLMs
to MCP tools through existing LangChain adapters.
"""
from importlib.metadata import version
# Import logging FIRST to ensure it's configured before other modules
# This MUST happen before importing observability to ensure loggers are configured
from .logging import MCP_USE_DEBUG, Logger, logger # isort: skip
# Now import other modules - observability must come after logging
from .agents import observability # noqa: E402
from .agents.mcpagent import MCPAgent
from .client import MCPClient
from .client.prompts import CODE_MODE_AGENT_PROMPT
from .config import load_config_file
from .connectors import BaseConnector, HttpConnector, StdioConnector, WebSocketConnector
from .server import MCPServer
from .session import MCPSession
__version__ = version("mcp-use")
__all__ = [
"MCPAgent",
"MCPClient",
"MCPSession",
"MCPServer",
"BaseConnector",
"StdioConnector",
"WebSocketConnector",
"HttpConnector",
"load_config_file",
"logger",
"MCP_USE_DEBUG",
"Logger",
"set_debug",
"observability",
"CODE_MODE_AGENT_PROMPT",
]
# Helper function to set debug mode
def set_debug(debug=2):
"""Set the debug mode for mcp_use.
Args:
debug: Whether to enable debug mode (default: True)
"""
Logger.set_debug(debug)