Skip to content

Commit 4f5571c

Browse files
toreleonhieutrtr
authored andcommitted
Toreleon cli (#22)
* Add CI/CD workflows for testing, version bumping, and PyPI publishing; enhance README with development and CI/CD details; implement comprehensive tests for MCPHub and MCPServers functionality. * Enhance CI workflow by installing all extras with Poetry * Refactor CI workflow to include version bumping and streamline package publishing using Poetry * Update README to clarify MCPHub installation options with framework-specific dependencies * Restrict pull request triggers to the release branch only * Update CI workflow to enable fail-fast strategy and restrict Python versions to 3.12 only * Refactor CI workflows to remove version bumping from CI and add tagging functionality; update README for clarity on automatic versioning and tagging process. * Refactor CI workflows to integrate version bumping and ensure proper versioning before publishing; update version-bump workflow to set outputs for new version. * Bump version to 0.1.6 in pyproject.toml * Refactor CI workflows: remove version-bump workflow and integrate version extraction and tagging directly in the publish job; update package version to 0.1.7 in pyproject.toml * Fix test data structure in TestMCPServersParams to match expected format Updated the mock data in the test for _load_predefined_servers_params to reflect the correct structure, ensuring that the "mcpServers" key wraps the predefined server details. This change enhances the accuracy of the test and aligns it with the actual implementation. * Add CLI commands and utilities for MCPHub configuration management - Implemented CLI commands for initializing, adding, removing, and listing MCP servers. - Created utility functions for loading and saving configuration files. - Added tests for CLI commands to ensure proper functionality and error handling.
1 parent d223ac2 commit 4f5571c

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

examples/with_config/test.py

Whitespace-only changes.

examples/without_config/test.py

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,34 @@
11
from mcphub import MCPHub
2-
import json
32

4-
async def main():
3+
server_name = "Gloomysunday28/mcp-server"
54

5+
async def framework_examples():
66
hub = MCPHub()
77

8+
# 1. OpenAI Agents Integration
89
async with hub.fetch_openai_mcp_server(
9-
mcp_name="MCP-Mirror/Automata-Labs-team_MCP-Server-Playwright",
10+
mcp_name=server_name,
1011
cache_tools_list=True
1112
) as server:
12-
# Step 3: List available tools from the MCP server
13-
# This shows what capabilities are available to your agent
1413
tools = await server.list_tools()
15-
16-
# Pretty print the tools for better readability
17-
tools_dict = [
18-
dict(tool) if hasattr(tool, "__dict__") else tool for tool in tools
19-
]
20-
print("Available MCP Tools:")
21-
print(json.dumps(tools_dict, indent=2))
14+
print(f"Tools from MCP server: {tools}")
15+
# 2. LangChain Tools Integration
16+
langchain_tools = await hub.fetch_langchain_mcp_tools(
17+
mcp_name=server_name,
18+
cache_tools_list=True
19+
)
20+
21+
print(f"LangChain tools from MCP server: {langchain_tools}")
22+
23+
# 3. Autogen Adapters Integration
24+
autogen_adapters = await hub.fetch_autogen_mcp_adapters(
25+
mcp_name=server_name
26+
)
27+
# Use adapters with Autogen
28+
29+
print(f"Autogen adapters from MCP server: {autogen_adapters}")
2230

2331

2432
if __name__ == "__main__":
2533
import asyncio
26-
asyncio.run(main())
34+
asyncio.run(framework_examples())

0 commit comments

Comments
 (0)