MCPcopy
hub / github.com/ComposioHQ/composio / create

Method create

python/composio/core/models/mcp.py:129–232  ·  view source on GitHub ↗

Create a new MCP server configuration with specified toolkits and authentication settings. :param name: Unique name for the MCP configuration :param toolkits: List of toolkit configurations. Can be either: - MCPToolkitConfig objects with detailed con

(
        self,
        name: str,
        toolkits: t.List[t.Union[ConfigToolkit, str]],
        manually_manage_connections: bool = False,
        allowed_tools: t.Optional[t.List[str]] = None,
    )

Source from the content-addressed store, hash-verified

127 super().__init__(client)
128
129 def create(
130 self,
131 name: str,
132 toolkits: t.List[t.Union[ConfigToolkit, str]],
133 manually_manage_connections: bool = False,
134 allowed_tools: t.Optional[t.List[str]] = None,
135 ) -> MCPCreateResponse:
136 """
137 Create a new MCP server configuration with specified toolkits and authentication settings.
138
139 :param name: Unique name for the MCP configuration
140 :param toolkits: List of toolkit configurations. Can be either:
141 - MCPToolkitConfig objects with detailed configuration
142 - Strings representing toolkit names (for simple cases)
143 :param manually_manage_connections: Whether to manually manage account connections (default: False)
144 :param allowed_tools: List of specific tools to enable across all toolkits (default: None for all tools)
145 :return: Created server details with generate method
146
147 Examples:
148 >>> # Using toolkit configuration objects with auth
149 >>> server = composio.experimental.mcp.create(
150 ... 'personal-mcp-server',
151 ... toolkits=[
152 ... {
153 ... 'toolkit': 'github',
154 ... 'auth_config_id': 'ac_xyz',
155 ... },
156 ... {
157 ... 'toolkit': 'slack',
158 ... 'auth_config_id': 'ac_abc',
159 ... },
160 ... ],
161 ... allowed_tools=['GITHUB_CREATE_ISSUE', 'GITHUB_LIST_REPOS', 'SLACK_SEND_MESSAGE'],
162 ... manually_manage_connections=False
163 ... )
164 >>>
165 >>> # Using simple toolkit names (most common usage)
166 >>> server = composio.experimental.mcp.create(
167 ... 'simple-mcp-server',
168 ... toolkits=['composio_search', 'text_to_pdf'],
169 ... allowed_tools=['COMPOSIO_SEARCH_DUCK_DUCK_GO_SEARCH', 'TEXT_TO_PDF_CONVERT_TEXT_TO_PDF']
170 ... )
171 >>>
172 >>> # Using all tools from toolkits (default behavior)
173 >>> server = composio.experimental.mcp.create(
174 ... 'all-tools-server',
175 ... toolkits=['composio_search', 'text_to_pdf']
176 ... # allowed_tools=None means all tools from these toolkits
177 ... )
178 >>>
179 >>> # Get server instance for a user
180 >>> mcp = server.generate('user_12345')
181 """
182 if not toolkits:
183 raise ValidationError("At least one toolkit configuration is required")
184
185 try:
186 # Normalize toolkits to MCPToolkitConfig format

Callers 15

gemini_demo.pyFile · 0.45
anthropic_demo.pyFile · 0.45
openai_demo.pyFile · 0.45
initiateMethod · 0.45
linkMethod · 0.45
_get_auth_config_idMethod · 0.45

Calls 5

ValidationErrorClass · 0.90
none_to_omitFunction · 0.90
ConfigToolkitClass · 0.85
_add_generate_methodFunction · 0.85
appendMethod · 0.65