universal-mcp 0.1.23rc1__py3-none-any.whl → 0.1.24rc2__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.
Files changed (47) hide show
  1. universal_mcp/analytics.py +43 -11
  2. universal_mcp/applications/application.py +186 -239
  3. universal_mcp/applications/sample_tool_app.py +80 -0
  4. universal_mcp/cli.py +5 -228
  5. universal_mcp/client/agents/__init__.py +4 -0
  6. universal_mcp/client/agents/base.py +38 -0
  7. universal_mcp/client/agents/llm.py +115 -0
  8. universal_mcp/client/agents/react.py +67 -0
  9. universal_mcp/client/cli.py +181 -0
  10. universal_mcp/client/oauth.py +218 -0
  11. universal_mcp/client/token_store.py +91 -0
  12. universal_mcp/client/transport.py +277 -0
  13. universal_mcp/config.py +201 -28
  14. universal_mcp/exceptions.py +50 -6
  15. universal_mcp/integrations/__init__.py +1 -4
  16. universal_mcp/integrations/integration.py +220 -121
  17. universal_mcp/servers/__init__.py +1 -1
  18. universal_mcp/servers/server.py +114 -247
  19. universal_mcp/stores/store.py +126 -93
  20. universal_mcp/tools/adapters.py +16 -0
  21. universal_mcp/tools/func_metadata.py +1 -1
  22. universal_mcp/tools/manager.py +15 -3
  23. universal_mcp/tools/tools.py +2 -2
  24. universal_mcp/utils/agentr.py +3 -4
  25. universal_mcp/utils/installation.py +3 -4
  26. universal_mcp/utils/openapi/api_generator.py +28 -2
  27. universal_mcp/utils/openapi/api_splitter.py +8 -19
  28. universal_mcp/utils/openapi/cli.py +243 -0
  29. universal_mcp/utils/openapi/filters.py +114 -0
  30. universal_mcp/utils/openapi/openapi.py +45 -12
  31. universal_mcp/utils/openapi/preprocessor.py +62 -7
  32. universal_mcp/utils/prompts.py +787 -0
  33. universal_mcp/utils/singleton.py +4 -1
  34. universal_mcp/utils/testing.py +6 -6
  35. universal_mcp-0.1.24rc2.dist-info/METADATA +54 -0
  36. universal_mcp-0.1.24rc2.dist-info/RECORD +53 -0
  37. universal_mcp/applications/README.md +0 -122
  38. universal_mcp/integrations/README.md +0 -25
  39. universal_mcp/servers/README.md +0 -79
  40. universal_mcp/stores/README.md +0 -74
  41. universal_mcp/tools/README.md +0 -86
  42. universal_mcp-0.1.23rc1.dist-info/METADATA +0 -283
  43. universal_mcp-0.1.23rc1.dist-info/RECORD +0 -46
  44. /universal_mcp/{utils → tools}/docstring_parser.py +0 -0
  45. {universal_mcp-0.1.23rc1.dist-info → universal_mcp-0.1.24rc2.dist-info}/WHEEL +0 -0
  46. {universal_mcp-0.1.23rc1.dist-info → universal_mcp-0.1.24rc2.dist-info}/entry_points.txt +0 -0
  47. {universal_mcp-0.1.23rc1.dist-info → universal_mcp-0.1.24rc2.dist-info}/licenses/LICENSE +0 -0
@@ -1,283 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: universal-mcp
3
- Version: 0.1.23rc1
4
- Summary: Universal MCP acts as a middle ware for your API applications. It can store your credentials, authorize, enable disable apps on the fly and much more.
5
- Author-email: Manoj Bajaj <manojbajaj95@gmail.com>
6
- License: MIT
7
- License-File: LICENSE
8
- Requires-Python: >=3.11
9
- Requires-Dist: black>=25.1.0
10
- Requires-Dist: cookiecutter>=2.6.0
11
- Requires-Dist: gql[all]>=3.5.2
12
- Requires-Dist: jinja2>=3.1.3
13
- Requires-Dist: jsonref>=1.1.0
14
- Requires-Dist: keyring>=25.6.0
15
- Requires-Dist: langchain-mcp-adapters>=0.0.3
16
- Requires-Dist: litellm>=1.30.7
17
- Requires-Dist: loguru>=0.7.3
18
- Requires-Dist: mcp>=1.9.0
19
- Requires-Dist: posthog>=3.24.0
20
- Requires-Dist: pydantic-settings>=2.8.1
21
- Requires-Dist: pydantic>=2.11.1
22
- Requires-Dist: pyyaml>=6.0.2
23
- Requires-Dist: rich>=14.0.0
24
- Requires-Dist: typer>=0.15.2
25
- Provides-Extra: dev
26
- Requires-Dist: litellm>=1.30.7; extra == 'dev'
27
- Requires-Dist: pre-commit>=4.2.0; extra == 'dev'
28
- Requires-Dist: pyright>=1.1.398; extra == 'dev'
29
- Requires-Dist: pytest-asyncio>=0.26.0; extra == 'dev'
30
- Requires-Dist: pytest>=8.3.5; extra == 'dev'
31
- Requires-Dist: ruff>=0.11.4; extra == 'dev'
32
- Provides-Extra: playground
33
- Requires-Dist: langchain-openai>=0.3.12; extra == 'playground'
34
- Requires-Dist: langgraph-checkpoint-sqlite>=2.0.6; extra == 'playground'
35
- Requires-Dist: langgraph>=0.3.24; extra == 'playground'
36
- Requires-Dist: litellm>=1.30.7; extra == 'playground'
37
- Requires-Dist: python-dotenv>=1.0.1; extra == 'playground'
38
- Requires-Dist: streamlit>=1.44.1; extra == 'playground'
39
- Requires-Dist: watchdog>=6.0.0; extra == 'playground'
40
- Description-Content-Type: text/markdown
41
-
42
- # Universal MCP
43
-
44
- Universal MCP acts as a middleware layer for your API applications, enabling seamless integration with various services through the Model Control Protocol (MCP). It simplifies credential management, authorization, dynamic app enablement, and provides a robust framework for building and managing AI-powered tools.
45
-
46
- ## 🌟 Features
47
-
48
- - **MCP (Model Control Protocol) Integration**: Seamlessly works with MCP server architecture for standardized agent-tool communication.
49
- - **Simplified API Integration**: Connect to services like GitHub, Google Calendar, Gmail, Reddit, Tavily, and more with minimal code. See [AgentR](https://agentr.dev) for a list of available applications.
50
- - **Managed Authentication**: Built-in support for API keys and OAuth-based authentication flows, often managed via the AgentR platform.
51
- - **Extensible Architecture**: Easily build and add new app integrations with minimal boilerplate using provided base classes and generation tools.
52
- - **Credential Management**: Flexible and secure storage options for API credentials (memory, environment variables, system keyring).
53
- - **Comprehensive Tool Management**: Robust tool registration, Pydantic-based validation, automatic docstring parsing, and execution capabilities. Supports conversion between MCP, LangChain, and OpenAI tool formats.
54
- - **Multiple Server Types**: Configurations for local development, AgentR-connected dynamic app loading, and single-application servers.
55
- - **Playground Environment**: Includes an interactive Streamlit-based playground for testing agents and tools.
56
-
57
- ## 🔧 Installation
58
-
59
- Install Universal MCP using pip:
60
-
61
- ```bash
62
- pip install universal-mcp
63
- ```
64
-
65
- ## 🚀 Quick Start
66
-
67
- **Important Prerequisite: AgentR API Key (If Using AgentR Integration)**
68
-
69
- If you plan to use integrations with `type: "agentr"` (for services like GitHub, Gmail, Notion via the AgentR platform), or if you run the MCP server itself with `type: "agentr"`, you first need an AgentR API key:
70
-
71
- 1. Visit [https://agentr.dev](https://agentr.dev) to create an account and generate an API key from your dashboard.
72
- 2. Set it as an environment variable _before_ running the MCP server:
73
- ```bash
74
- export AGENTR_API_KEY="your_api_key_here"
75
- ```
76
-
77
- **1. Create a Configuration File (e.g., `config.json`)**
78
-
79
- This file defines the server settings, credential stores, and the applications to load with their respective integrations.
80
-
81
- ```json
82
- {
83
- "name": "My Local MCP Server",
84
- "description": "A server for testing applications locally",
85
- "type": "local", // "local" or "agentr"
86
- "transport": "sse", // "sse", "stdio", or "http"
87
- "port": 8005, // Relevant for "sse" or "http"
88
- "store": {
89
- // Default store for integrations
90
- "name": "my_mcp_store",
91
- "type": "keyring" // "keyring", "environment", or "memory"
92
- },
93
- "apps": [
94
- {
95
- "name": "zenquotes", // App slug (e.g., from agentr.dev)
96
- "integration": null // No authentication needed for this app
97
- },
98
- {
99
- "name": "tavily",
100
- "integration": {
101
- "name": "TAVILY_API_KEY", // Unique name for this credential if type is "api_key"
102
- "type": "api_key",
103
- "store": {
104
- // Override default store for this specific app
105
- "type": "environment" // Looks for TAVILY_API_KEY env var
106
- }
107
- }
108
- },
109
- {
110
- "name": "github",
111
- "integration": {
112
- "name": "github", // Matches the service name in AgentR
113
- "type": "agentr" // Uses AgentR platform for auth/creds
114
- }
115
- }
116
- ]
117
- }
118
- ```
119
-
120
- _Notes on `config.json`:_
121
-
122
- - `type: "local"`: Runs applications defined directly in the config's `apps` list.
123
- - `type: "agentr"`: Connects to the AgentR platform to dynamically load user-enabled apps (ignores the `apps` list in the config) and handle credentials. Requires `AGENTR_API_KEY` environment variable.
124
- - `store`: Defines credential storage.
125
- - `environment`: Looks for an environment variable named `<INTEGRATION_NAME_UPPERCASE>` (e.g., `TAVILY_API_KEY` for the example above).
126
- - `keyring`: Uses the system's secure credential storage.
127
- - `memory`: Transient storage, lost when the server stops.
128
- - `integration`: Configures authentication for each app.
129
- - `type: "agentr"`: Uses the AgentR platform for OAuth/credential management.
130
- - `type: "api_key"`: Uses the specified `store` to retrieve the key.
131
-
132
- **2. Run the Server via CLI**
133
-
134
- Ensure any required environment variables (like `TAVILY_API_KEY` for the Tavily example, or `AGENTR_API_KEY` if using `"agentr"` type server/integrations) are set.
135
-
136
- ```bash
137
- universal_mcp run -c config.json
138
- ```
139
-
140
- The server will start, load the configured applications (or connect to AgentR if `type: "agentr"`), and listen for connections based on the `transport` type.
141
-
142
- ## 🛠️ Using the Playground
143
-
144
- The `playground` directory provides a runnable Streamlit application for interacting with agents that can use tools from an MCP server.
145
-
146
- **Prerequisites:**
147
-
148
- - **`local_config.json`**: This file must exist in the **project root directory** (the same directory as this `README.md`). It configures the _local_ MCP server that the playground's agent can connect to if you choose to run one. For an example, see the `local_config.json` structure in the [Playground README](playground/README.md).
149
- - **Dependencies**: Install playground-specific dependencies. If you have the project cloned, you might install them via:
150
- ```bash
151
- pip install -e .[playground]
152
- # or manually install fastapi, streamlit, uvicorn, langchain-openai, etc.
153
- ```
154
-
155
- **Running the Playground:**
156
-
157
- The easiest way is to use the automated startup script from the **project root directory**:
158
-
159
- ```bash
160
- python playground
161
- ```
162
-
163
- This script will:
164
-
165
- 1. Optionally start a local MCP server (based on your `local_config.json`) if you confirm.
166
- 2. Launch the Streamlit application.
167
-
168
- For more detailed setup, manual startup instructions, and an explanation of the `local_config.json` for the playground, please refer to the [Playground README](playground/README.md).
169
-
170
- ## 🧩 Available Applications
171
-
172
- Universal MCP can integrate with a wide variety of applications. For a list of publicly available applications and their slugs (e.g., "github", "google-calendar"), please visit [AgentR Applications](https://agentr.dev).
173
- Applications are typically installed dynamically by Universal MCP from their respective repositories when first referenced by slug.
174
-
175
- _Authentication Type Notes:_
176
-
177
- - _OAuth (via AgentR)_: Usually requires configuring the app's integration with `type: "agentr"` in your `ServerConfig`. This leverages the AgentR platform for the OAuth flow and requires the `AGENTR_API_KEY` to be set.
178
- - _API Key (via Integration)_: Requires configuring `type: "api_key"` for the app's integration in your `ServerConfig`, along with a `store` (like `environment` or `keyring`) to specify where the API key is located.
179
-
180
- ## 🔐 Integration Types
181
-
182
- Universal MCP supports different ways to handle authentication for applications:
183
-
184
- ### 1. API Key Integration (`type: "api_key"`)
185
-
186
- For services that authenticate via simple API keys.
187
-
188
- ```json
189
- // In your ServerConfig apps array:
190
- {
191
- "name": "tavily",
192
- "integration": {
193
- "name": "TAVILY_API_KEY", // Used by the store (e.g., as env var name)
194
- "type": "api_key",
195
- "store": {
196
- "type": "environment" // Or "keyring", "memory"
197
- }
198
- }
199
- }
200
- ```
201
-
202
- ### 2. AgentR Integration (`type: "agentr"`)
203
-
204
- Recommended for services integrated with the AgentR platform, which typically handles OAuth flows or centrally managed credentials. Requires the `AGENTR_API_KEY` environment variable to be set for the MCP server process.
205
-
206
- ```json
207
- // In your ServerConfig apps array:
208
- {
209
- "name": "github",
210
- "integration": {
211
- "name": "github", // Matches the service name configured in AgentR
212
- "type": "agentr"
213
- }
214
- }
215
- ```
216
-
217
- When an action requiring authorization is called, the `AgentRIntegration` will prompt the user (via the MCP client) to visit a URL to complete the OAuth flow managed by AgentR. This is also the default integration type for apps if the main server config is `type: "agentr"`.
218
-
219
- ### 3. Direct OAuth Integration (`type: "oauth"`)
220
-
221
- While `AgentRIntegration` is generally preferred for OAuth, a direct `OAuthIntegration` class exists. However, it requires manual configuration of client IDs, secrets, and callback handling, which is more complex to set up outside the AgentR platform.
222
-
223
- ## 🤖 CLI Usage
224
-
225
- Universal MCP includes a powerful command-line interface:
226
-
227
- ```bash
228
- # Run the MCP server using a configuration file
229
- universal_mcp run -c config.json
230
-
231
- # Initialize a new MCP application project structure
232
- universal_mcp init --app-name my-cool-app --o ./my-apps --integration-type api_key
233
-
234
- # Generate API client code and application structure from an OpenAPI schema
235
- universal_mcp generate -s <path_to_schema.json_or_yaml> -o <path/to/app_output_directory> --c CustomAppClassName
236
- # Example: universal_mcp generate -s notion_api.yaml -o ./custom_apps/notion --c MyNotionApp
237
-
238
- # Preprocess an OpenAPI schema using an LLM to fill/enhance descriptions
239
- universal_mcp preprocess -s <path_to_input_schema.json_or_yaml> -o <path_to_processed_schema.json_or_yaml>
240
-
241
- # Generate Google-style docstrings for functions in a Python file using an LLM
242
- universal_mcp docgen <path/to/app_file.py>
243
-
244
- # Generate a README.md for a generated application file
245
- universal_mcp readme <path/to/app_file.py>
246
-
247
- # Install MCP configuration for supported desktop apps (e.g., Claude, Cursor)
248
- # Requires an AgentR API key for configuration.
249
- universal_mcp install claude
250
- universal_mcp install cursor
251
-
252
- # Check installed version (standard typer command)
253
- universal_mcp --version
254
- ```
255
-
256
- ## 📋 Requirements
257
-
258
- - Python 3.10+
259
- - Key Dependencies (installed automatically via pip, see `pyproject.toml` for full list):
260
- - `mcp-server`
261
- - `loguru`
262
- - `typer`
263
- - `httpx`
264
- - `pydantic`
265
- - `pyyaml`
266
- - `keyring` (for `KeyringStore`)
267
- - `litellm` (for `docgen` and `preprocess` commands)
268
- - `uv` (used internally for dynamic package installation)
269
-
270
- ## 📚 Documentation
271
-
272
- For more detailed information about specific components:
273
-
274
- - [Applications Framework](src/universal_mcp/applications/README.md)
275
- - [Tool Management](src/universal_mcp/tools/README.md)
276
- - [Server Implementations](src/universal_mcp/servers/README.md)
277
- - [Credential Stores](src/universal_mcp/stores/README.md)
278
- - [Integration & Authentication](src/universal_mcp/integrations/README.md)
279
- - [Playground Usage](playground/README.md)
280
-
281
- ## 📝 License
282
-
283
- This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
@@ -1,46 +0,0 @@
1
- universal_mcp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- universal_mcp/analytics.py,sha256=Dkv8mkc_2T2t5NxLSZzcr3BlmOispj1RKtbB86V1i4M,2306
3
- universal_mcp/cli.py,sha256=-MVcqDEL_0AefmEgjq3ZCa2tySxXwi-Tfoat2kboX_U,10311
4
- universal_mcp/config.py,sha256=HaAZvf-XzQZpqGGWUuT5zojWloO8GL5Acfa5_0sDs_Q,3321
5
- universal_mcp/exceptions.py,sha256=-pbeZhpNieJfnSd2-WM80pU8W8mK8VHXcSjky0BHwdk,665
6
- universal_mcp/logger.py,sha256=VmH_83efpErLEDTJqz55Dp0dioTXfGvMBLZUx5smOLc,2116
7
- universal_mcp/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- universal_mcp/applications/README.md,sha256=eqbizxaTxKH2O1tyIJR2yI0Db5TQxtgPd_vbpWyCa2Y,3527
9
- universal_mcp/applications/__init__.py,sha256=l19_sMs5766VFWU_7O2niamvvvfQOteysqylbqvjjGQ,3500
10
- universal_mcp/applications/application.py,sha256=-5uHUJORRjRnOwDbqJO4qSJLrFSGRghaUWOKMqhN5vo,22891
11
- universal_mcp/integrations/README.md,sha256=lTAPXO2nivcBe1q7JT6PRa6v9Ns_ZersQMIdw-nmwEA,996
12
- universal_mcp/integrations/__init__.py,sha256=X8iEzs02IlXfeafp6GMm-cOkg70QdjnlTRuFo24KEfo,916
13
- universal_mcp/integrations/integration.py,sha256=2Wv9g5fJ4cbsTNsp4WcFNKdQCnj6rbBhgNQgMDAQ1Os,13057
14
- universal_mcp/servers/README.md,sha256=ytFlgp8-LO0oogMrHkMOp8SvFTwgsKgv7XhBVZGNTbM,2284
15
- universal_mcp/servers/__init__.py,sha256=eBZCsaZjiEv6ZlRRslPKgurQxmpHLQyiXv2fTBygHnM,532
16
- universal_mcp/servers/server.py,sha256=K7sPdCixYgJmQRxOL1icscL7-52sVsghpRX_D_uREu4,12329
17
- universal_mcp/stores/README.md,sha256=jrPh_ow4ESH4BDGaSafilhOVaN8oQ9IFlFW-j5Z5hLA,2465
18
- universal_mcp/stores/__init__.py,sha256=quvuwhZnpiSLuojf0NfmBx2xpaCulv3fbKtKaSCEmuM,603
19
- universal_mcp/stores/store.py,sha256=mxnmOVlDNrr8OKhENWDtCIfK7YeCBQcGdS6I2ogRCsU,6756
20
- universal_mcp/tools/README.md,sha256=RuxliOFqV1ZEyeBdj3m8UKfkxAsfrxXh-b6V4ZGAk8I,2468
21
- universal_mcp/tools/__init__.py,sha256=Fatza_R0qYWmNF1WQSfUZZKQFu5qf-16JhZzdmyx3KY,333
22
- universal_mcp/tools/adapters.py,sha256=nMoZ9jnv1uKhfq6NmBJ5-a6uwdB_H8RqkdNLIacCRfM,2978
23
- universal_mcp/tools/func_metadata.py,sha256=7kUWArtUDa2Orr7VGzpwPVfyf2LM3UFA_9arMpl7Zn8,10838
24
- universal_mcp/tools/manager.py,sha256=ao_ovTyca8HR4uwHdL_lTWNdquxcqRx6FaLA4U1lZvQ,11242
25
- universal_mcp/tools/tools.py,sha256=8S_KzARYbG9xbyqhZcI4Wk46tXiZcWlcAMgjChXNEI4,3698
26
- universal_mcp/utils/__init__.py,sha256=8wi4PGWu-SrFjNJ8U7fr2iFJ1ktqlDmSKj1xYd7KSDc,41
27
- universal_mcp/utils/agentr.py,sha256=-brwvgCZgPjvF7wPXw0QfpEsl1ekXQxmcF07-1AQMR4,3663
28
- universal_mcp/utils/common.py,sha256=HEZC2Mhilb8DrGXQG2tboAIw1r4veGilGWjfnPF1lyA,888
29
- universal_mcp/utils/docstring_parser.py,sha256=efEOE-ME7G5Jbbzpn7pN2xNuyu2M5zfZ1Tqu1lRB0Gk,8392
30
- universal_mcp/utils/installation.py,sha256=ItOfBFhKOh4DLz237jgAz_Fn0uOMdrKXw0n5BaUZZNs,7286
31
- universal_mcp/utils/singleton.py,sha256=kolHnbS9yd5C7z-tzaUAD16GgI-thqJXysNi3sZM4No,733
32
- universal_mcp/utils/testing.py,sha256=0znYkuFi8-WjOdbwrTbNC-UpMqG3EXcGOE0wxlERh_A,1464
33
- universal_mcp/utils/openapi/__inti__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
- universal_mcp/utils/openapi/api_generator.py,sha256=FjtvbnWuI1P8W8wXuKLCirUtsqQ4HI_TuQrhpA4SqTs,4749
35
- universal_mcp/utils/openapi/api_splitter.py,sha256=hED34exwKcBtKzkz-3jVWzNeFBNGgjxANQeu1FibuOU,21818
36
- universal_mcp/utils/openapi/docgen.py,sha256=DNmwlhg_-TRrHa74epyErMTRjV2nutfCQ7seb_Rq5hE,21366
37
- universal_mcp/utils/openapi/openapi.py,sha256=tUD3HNLGAF808AszHLGGKPqpqLT-PZB_8LwagyvsWKQ,50828
38
- universal_mcp/utils/openapi/preprocessor.py,sha256=PPIM3Uu8DYi3dRKdqi9thr9ufeUgkr2K08ri1BwKpoQ,60835
39
- universal_mcp/utils/openapi/readme.py,sha256=R2Jp7DUXYNsXPDV6eFTkLiy7MXbSULUj1vHh4O_nB4c,2974
40
- universal_mcp/utils/templates/README.md.j2,sha256=Mrm181YX-o_-WEfKs01Bi2RJy43rBiq2j6fTtbWgbTA,401
41
- universal_mcp/utils/templates/api_client.py.j2,sha256=972Im7LNUAq3yZTfwDcgivnb-b8u6_JLKWXwoIwXXXQ,908
42
- universal_mcp-0.1.23rc1.dist-info/METADATA,sha256=qsh7rNBIpaSDFBkw7vmIUpDgM4YYkriK9HYeDOLJpwE,12154
43
- universal_mcp-0.1.23rc1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
44
- universal_mcp-0.1.23rc1.dist-info/entry_points.txt,sha256=QlBrVKmA2jIM0q-C-3TQMNJTTWOsOFQvgedBq2rZTS8,56
45
- universal_mcp-0.1.23rc1.dist-info/licenses/LICENSE,sha256=NweDZVPslBAZFzlgByF158b85GR0f5_tLQgq1NS48To,1063
46
- universal_mcp-0.1.23rc1.dist-info/RECORD,,
File without changes