Skip to content

OpenMCPTools/mcp_extensions_python

Repository files navigation

MCP Extensions — Python

Extensions for the MCP (Model Context Protocol) Python SDK.

Server-Side Grouping

The org.openmcptools.extensions.groups module provides an MCP extension to support hierarchical server-side grouping based upon the python sdk.

What's in here

The project defines a tree-based data model to organize tools, prompts, and resources into hierarchical groups — like folders inside folders.

Core model (src/common.py)

  • Group — a tree node. Can contain other groups, tools, prompts, and resources. Each group knows its parent and computes its fully qualified name (e.g. com.example.api).
  • Tool — an MCP tool. Can belong to multiple groups at once.
  • Prompt — an MCP prompt with typed arguments.
  • Resource — an MCP resource (URI, size, MIME type).
  • Converter — generic interface to convert between the internal model and any external format.

Extension identifier constants (org.openmcptools/groups) and the pydantic model definition for the Group type and all the common types.

Schema

The python pydantic model implementation is based upon this json-schema

        "Group": {
            "properties": {
                "name": {
                    "type": "string"
                },
                "parent": {
                    "$ref": "#/definitions/Group",
                },
                "description": {
                    "type": "string"
                },
                "title": {
                    "type": "string"
                },
                "_meta": {
                    "additionalProperties": {},
                    "type": "object"
                }
            },
            "required": [
                "name"
            ],
            "type": "object"
        }

This schema for hierarchical grouping was initially proposed as a MCP protocol enhancement. For a discussion specifically of the 'parent' field, and it's role in hierarchical grouping, please see this and subsequent postings.

The same schema is used for the mcp_extensions_java group extension (Java SDK Extension) and the mcp_extensions_typescript group extension (Typescript SDK Extension)

About

MCP Extensions for Python SDK

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages