codemie-mcp-assistants 0.1.227__py3-none-any.whl → 0.1.302__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: codemie-mcp-assistants
3
- Version: 0.1.227
3
+ Version: 0.1.302
4
4
  Summary: MCP server for connecting to CodeMie Assistants API
5
5
  Author: Vadym Vlasenko
6
6
  Author-email: vadym_vlasenko@epam.com
@@ -8,7 +8,7 @@ Requires-Python: >=3.12,<4.0
8
8
  Classifier: Programming Language :: Python :: 3
9
9
  Classifier: Programming Language :: Python :: 3.12
10
10
  Requires-Dist: certifi (>=2025.1.31,<2026.0.0)
11
- Requires-Dist: codemie-sdk-python (==0.1.227)
11
+ Requires-Dist: codemie-sdk-python (==0.1.302)
12
12
  Requires-Dist: httpx (>=0.28.1,<0.29.0)
13
13
  Requires-Dist: mcp (>=1.6.0,<2.0.0)
14
14
  Requires-Dist: pydantic (>=2.11.2,<3.0.0)
@@ -41,6 +41,8 @@ Returns generated assistant response as text
41
41
 
42
42
  Ensure you have `Python 3.12` or later installed.
43
43
 
44
+ **Important:** Before running the MCP server, you must configure the required environment variables (see [Environment Variables](#environment-variables) section below).
45
+
44
46
  ### Using uv (recommended)
45
47
 
46
48
  When using [`uv`](https://docs.astral.sh/uv/) no specific installation is needed. We will
@@ -73,51 +75,99 @@ Add to your Claude settings:
73
75
  <details>
74
76
  <summary>Using uvx</summary>
75
77
 
78
+ **Required variables:**
76
79
  ```json
77
80
  "mcpServers": {
78
81
  "codemie": {
79
82
  "command": "uvx",
80
83
  "args": ["codemie-mcp-assistants"],
81
84
  "env": {
82
- "CODEMIE_ASSISTANT_ID": "your-assistant-id"
85
+ "CODEMIE_ASSISTANT_ID": "your-assistant-id",
83
86
  "CODEMIE_USERNAME": "your-username",
84
87
  "CODEMIE_PASSWORD": "your-password"
85
88
  }
86
89
  }
87
90
  }
88
91
  ```
92
+
93
+ **Optional variables (with defaults):**
94
+ ```json
95
+ "env": {
96
+ "CODEMIE_API_DOMAIN": "https://codemie.lab.epam.com/code-assistant-api",
97
+ "CODEMIE_AUTH_CLIENT_ID": "codemie-sdk",
98
+ "CODEMIE_AUTH_SERVER_URL": "https://keycloak.eks-core.aws.main.edp.projects.epam.com/auth",
99
+ "CODEMIE_AUTH_REALM_NAME": "codemie-prod"
100
+ }
101
+ ```
89
102
  </details>
90
103
 
91
104
  <details>
92
105
  <summary>Using poetry installation</summary>
93
106
 
107
+ **Required variables:**
94
108
  ```json
95
109
  "mcpServers": {
96
110
  "codemie": {
97
111
  "command": "poetry",
98
112
  "args": ["run", "codemie-mcp-assistants"],
99
113
  "env": {
100
- "CODEMIE_ASSISTANT_ID": "your-assistant-id"
114
+ "CODEMIE_ASSISTANT_ID": "your-assistant-id",
101
115
  "CODEMIE_USERNAME": "your-username",
102
116
  "CODEMIE_PASSWORD": "your-password"
103
117
  }
104
118
  }
105
119
  }
106
120
  ```
121
+
122
+ **Optional variables (with defaults):**
123
+ ```json
124
+ "env": {
125
+ "CODEMIE_API_DOMAIN": "https://codemie.lab.epam.com/code-assistant-api",
126
+ "CODEMIE_AUTH_CLIENT_ID": "codemie-sdk",
127
+ "CODEMIE_AUTH_SERVER_URL": "https://keycloak.eks-core.aws.main.edp.projects.epam.com/auth",
128
+ "CODEMIE_AUTH_REALM_NAME": "codemie-prod"
129
+ }
130
+ ```
107
131
  </details>
108
132
 
109
133
  ### Environment Variables
110
134
 
111
- - `CODEMIE_ASSISTANT_ID`: "AI/Run CodeMie assistant UID"
135
+ #### Mandatory Variables
112
136
 
113
- The following environment variables are required for authentication:
137
+ The following environment variables **must** be configured before running the MCP server:
114
138
 
139
+ **Assistant Configuration:**
140
+ - `CODEMIE_ASSISTANT_ID`: Your CodeMie assistant ID (required)
141
+
142
+ **Authentication (choose one method):**
143
+
144
+ *Option 1: Username/Password*
115
145
  - `CODEMIE_USERNAME`: Your CodeMie username
116
146
  - `CODEMIE_PASSWORD`: Your CodeMie password
117
147
 
118
- Optional configuration:
119
- - `CODEMIE_AUTH_CLIENT_ID`: Auth client ID (default: "codemie-sdk")
120
- - `CODEMIE_AUTH_REALM_NAME`: Auth realm name (default: "codemie-prod")
148
+ *Option 2: Client Credentials*
149
+ - `CODEMIE_AUTH_CLIENT_SECRET`: Auth client secret
150
+
151
+ #### Optional Variables (Environment-Specific)
152
+
153
+ By default, the server connects to the **production environment** with these settings:
154
+ - `CODEMIE_API_DOMAIN`: `https://codemie.lab.epam.com/code-assistant-api`
155
+ - `CODEMIE_AUTH_CLIENT_ID`: `codemie-sdk`
156
+ - `CODEMIE_AUTH_SERVER_URL`: `https://keycloak.eks-core.aws.main.edp.projects.epam.com/auth`
157
+ - `CODEMIE_AUTH_REALM_NAME`: `codemie-prod`
158
+
159
+ You can override these variables to point to a different environment.
160
+
161
+ **Example: Preview Environment Configuration**
162
+ ```bash
163
+ CODEMIE_API_DOMAIN="https://codemie-preview.lab.epam.com/code-assistant-api"
164
+ CODEMIE_AUTH_CLIENT_ID="codemie-preview-sdk"
165
+ CODEMIE_AUTH_SERVER_URL="https://keycloak.eks-core.aws.main.edp.projects.epam.com/auth"
166
+ CODEMIE_AUTH_REALM_NAME="codemie-prod"
167
+ ```
168
+
169
+ **Other Optional Variables:**
170
+ - `CODEMIE_VERIFY_SSL`: SSL verification flag (default: `true`)
121
171
 
122
172
  ## Build
123
173
 
@@ -0,0 +1,6 @@
1
+ src/model.py,sha256=_mPLj0Kvr6eQJUPRio7i69dxv1BEB1DYeDe4aHpQxBk,4304
2
+ src/server.py,sha256=LXnjrr3gdH029DuP-lRnw2erVXab0pybF0Z1EXUiUhQ,7982
3
+ codemie_mcp_assistants-0.1.302.dist-info/METADATA,sha256=awdHr1MNGUtrVj6I2iM1bQja7bWF2DLuSfD6zdaUwks,4783
4
+ codemie_mcp_assistants-0.1.302.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
5
+ codemie_mcp_assistants-0.1.302.dist-info/entry_points.txt,sha256=mialsNMpA-NT-iPWuPimHMzE0OZcT3c7Fv7xmUcx_IU,58
6
+ codemie_mcp_assistants-0.1.302.dist-info/RECORD,,
src/server.py CHANGED
@@ -1,5 +1,6 @@
1
1
  import sys
2
2
  import uuid
3
+ import re
3
4
  from typing import Dict, List
4
5
 
5
6
  from codemie_sdk import CodeMieClient
@@ -45,6 +46,37 @@ def get_client() -> CodeMieClient:
45
46
  raise
46
47
 
47
48
 
49
+ def sanitize_tool_name(name: str) -> str:
50
+ """
51
+ Sanitize a tool name to match MCP requirements.
52
+
53
+ MCP tool names must match pattern: ^[a-zA-Z0-9_-]{1,64}$
54
+ - Only alphanumeric characters, underscores, and hyphens allowed
55
+ - Must be 1-64 characters long
56
+
57
+ Args:
58
+ name: The original name to sanitize
59
+
60
+ Returns:
61
+ str: Sanitized name matching the pattern
62
+ """
63
+ # Convert to lowercase and replace spaces with underscores
64
+ sanitized = name.lower().replace(" ", "_")
65
+
66
+ # Remove any characters that are not alphanumeric, underscore, or hyphen
67
+ sanitized = re.sub(r"[^a-z0-9_-]", "", sanitized)
68
+
69
+ # Ensure name is not empty after sanitization
70
+ if not sanitized:
71
+ sanitized = "assistant"
72
+
73
+ # Truncate to 64 characters if needed
74
+ if len(sanitized) > 60:
75
+ sanitized = sanitized[:64]
76
+
77
+ return sanitized
78
+
79
+
48
80
  def get_assistant_info(assistant_id: str) -> AssistantInfo:
49
81
  """
50
82
  Retrieve and validate assistant information.
@@ -84,7 +116,7 @@ mcp = FastMCP("codemie-assistants")
84
116
  # Get and validate assistant by identifier.
85
117
  codemie_assistant = get_assistant_info(settings.assistant_id)
86
118
 
87
- chat_tool_name = "ask_" + codemie_assistant.name.lower().replace(" ", "_")
119
+ chat_tool_name = "ask_" + sanitize_tool_name(codemie_assistant.name)
88
120
  chat_assistant_tool_description = (
89
121
  f"""
90
122
  This tool allows to ask and communicate with '{codemie_assistant.name}'.
@@ -1,6 +0,0 @@
1
- src/model.py,sha256=_mPLj0Kvr6eQJUPRio7i69dxv1BEB1DYeDe4aHpQxBk,4304
2
- src/server.py,sha256=C3MD3QfnUFV1gmLPATaqkuJvZNGuHEc7xK-mIW8R37M,7107
3
- codemie_mcp_assistants-0.1.227.dist-info/METADATA,sha256=MI9QqIKjuxfKiYgb6u53M93rDkcoW8Gktl-_fxLnGFI,2987
4
- codemie_mcp_assistants-0.1.227.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
5
- codemie_mcp_assistants-0.1.227.dist-info/entry_points.txt,sha256=mialsNMpA-NT-iPWuPimHMzE0OZcT3c7Fv7xmUcx_IU,58
6
- codemie_mcp_assistants-0.1.227.dist-info/RECORD,,