{"id":31774388,"url":"https://github.com/monatis/gemma-mcp","last_synced_at":"2025-10-10T04:51:58.745Z","repository":{"id":299248690,"uuid":"1002486831","full_name":"monatis/gemma-mcp","owner":"monatis","description":"MCP Client for Gemma-3","archived":false,"fork":false,"pushed_at":"2025-06-15T17:25:53.000Z","size":48,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-17T16:55:26.132Z","etag":null,"topics":["function-calling","gemma","gemma3","llm","mcp"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/monatis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-15T15:24:28.000Z","updated_at":"2025-08-16T14:33:13.000Z","dependencies_parsed_at":"2025-06-15T15:50:57.564Z","dependency_job_id":"cc732813-4646-42b8-8ec0-a504b2939a6d","html_url":"https://github.com/monatis/gemma-mcp","commit_stats":null,"previous_names":["monatis/gemma-mcp"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/monatis/gemma-mcp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monatis%2Fgemma-mcp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monatis%2Fgemma-mcp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monatis%2Fgemma-mcp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monatis%2Fgemma-mcp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/monatis","download_url":"https://codeload.github.com/monatis/gemma-mcp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monatis%2Fgemma-mcp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002653,"owners_count":26083442,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["function-calling","gemma","gemma3","llm","mcp"],"created_at":"2025-10-10T04:51:46.671Z","updated_at":"2025-10-10T04:51:58.739Z","avatar_url":"https://github.com/monatis.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gemma MCP Client\r\n\r\nA Python package that combines Google's Gemma language model with MCP (Model Content Protocol) server integration, enabling powerful function calling capabilities across both local functions and remote MCP tools.\r\n\r\n## Features\r\n\r\n- Seamless integration with Google's Gemma language model\r\n- Support for both local Python functions and remote MCP tools\r\n- Automatic tool discovery and registration from MCP servers\r\n- Python-style function calling syntax\r\n- Proper resource management with async context managers\r\n- Support for multiple MCP servers\r\n- Easy testing through test server support\r\n\r\n## Installation\r\n\r\n```bash\r\nuv add gemma-mcp # or pip install gemma-mcp if you love the old way\r\n```\r\n\r\n## Requirements\r\n\r\n- Python 3.10+\r\n- `google-genai`: Google Generative AI Python SDK\r\n- `FastMCP` MCP utilities\r\n\r\n## Usage\r\n\r\n### Basic Usage\r\n\r\n```python\r\nfrom gemma_mcp import GemmaMCPClient\r\n\r\n# a standard MCP configuration\r\nmcp_config = {\r\n    \"mcpServers\": {\r\n        \"weather\": {\r\n            \"url\": \"https://weather-api.example.com/mcp\"\r\n        },\r\n        \"assistant\": {\r\n            \"command\": \"python\",\r\n            \"args\": [\"./assistant_server.py\"]\r\n        }\r\n    }\r\n}\r\n\r\n# Initialize client with MCP support\r\nasync with GemmaMCPClient(mcp_config=mcp_config).managed() as client:\r\n    # Chat with automatic function execution\r\n    response = await client.chat(\r\n        \"What's the weather like in London?\",\r\n        execute_functions=True\r\n    )\r\n    print(response)\r\n```\r\n\r\n### Adding Local Functions\r\n\r\nYou can add local functions in three ways:\r\n\r\n1. Using a callable:\r\n\r\n```python\r\nasync def my_function(param1: str, param2: int = 0):\r\n    \"\"\"Function description.\"\"\"\r\n    return {\"result\": param1 + str(param2)}\r\n\r\nclient.add_function(my_function)\r\n```\r\n\r\n2. Using a dictionary:\r\n\r\n```python\r\nfunction_def = {\r\n    \"name\": \"my_function\",\r\n    \"description\": \"Function description\",\r\n    \"parameters\": {\r\n        \"type\": \"object\",\r\n        \"properties\": {\r\n            \"param1\": {\"type\": \"string\"},\r\n            \"param2\": {\"type\": \"integer\", \"default\": 0}\r\n        },\r\n        \"required\": [\"param1\"]\r\n    }\r\n}\r\nclient.add_function(function_def)\r\n```\r\n\r\n3. Using a FunctionDefinition object:\r\n\r\n```python\r\nfrom gemma_mcp import FunctionDefinition\r\n\r\nfunction_def = FunctionDefinition(\r\n    name=\"my_function\",\r\n    description=\"Function description\",\r\n    parameters={\r\n        \"type\": \"object\",\r\n        \"properties\": {\r\n            \"param1\": {\"type\": \"string\"},\r\n            \"param2\": {\"type\": \"integer\", \"default\": 0}\r\n        },\r\n        \"required\": [\"param1\"]\r\n    },\r\n    required=[\"param1\"]\r\n)\r\nclient.add_function(function_def)\r\n```\r\n\r\n### MCP Server Configuration\r\n\r\nThe MCP configuration supports multiple server types:\r\n\r\n1. servers with SSE transport:\r\n\r\n```python\r\nmcp_config = {\r\n    \"mcpServers\": {\r\n        \"server_name\": {\r\n            \"url\": \"https://server-url/mcp\"\r\n        }\r\n    }\r\n}\r\n```\r\n\r\n2. servers with STDIO transport:\r\n\r\n```python\r\nmcp_config = {\r\n    \"mcpServers\": {\r\n        \"server_name\": {\r\n            \"command\": \"python\",\r\n            \"args\": [\"./server.py\"]\r\n        }\r\n    }\r\n}\r\n```\r\n\r\n### Testing\r\n\r\nThe package includes support for testing with in-memory MCP servers:\r\n\r\n```python\r\nfrom fastmcp import FastMCP\r\nfrom gemma_mcp import GemmaMCPClient\r\n\r\n# Create test server\r\nmcp = FastMCP(\"Test Server\")\r\n\r\n# Initialize client with test server\r\nclient = GemmaMCPClient()\r\nclient.mcp_client.add_test_server(mcp)\r\n\r\n# Use the client as normal\r\nasync with client.managed():\r\n    response = await client.chat(\"Test message\", execute_functions=True)\r\n```\r\n\r\n## API Reference\r\n\r\n### GemmaMCPClient\r\n\r\nThe main client class that handles both Gemma model interactions and MCP tool integration.\r\n\r\n#### Parameters\r\n\r\n- `api_key` (str, optional): Gemini API key. If not provided, will look for GEMINI_API_KEY env var\r\n- `model` (str): Model to use, defaults to \"gemma-3-27b-it\"\r\n- `temperature` (float): Generation temperature, defaults to 0.7\r\n- `system_prompt` (str, optional): Custom system prompt\r\n- `mcp_config` (dict, optional): MCP configuration dictionary\r\n\r\n#### Methods\r\n\r\n- `add_function(function)`: Add a function definition\r\n- `chat(message, execute_functions=False)`: Send a message and get response\r\n- `initialize()`: Initialize the client and all components\r\n- `cleanup()`: Clean up all resources\r\n\r\n### FunctionDefinition\r\n\r\nA dataclass for representing function definitions.\r\n\r\n#### Parameters\r\n\r\n- `name` (str): Function name\r\n- `description` (str): Function description\r\n- `parameters` (dict): Function parameters schema\r\n- `required` (list): List of required parameters\r\n- `callable` (callable, optional): The actual callable function\r\n\r\n## License\r\n\r\nMIT License\r\n\r\n## Contributing\r\n\r\nContributions are welcome! Please feel free to submit a Pull Request.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonatis%2Fgemma-mcp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmonatis%2Fgemma-mcp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonatis%2Fgemma-mcp/lists"}