Skip to content

Commit 656f9c2

Browse files
committed
add mcpgateway wrapper
1 parent 1265bb9 commit 656f9c2

File tree

6 files changed

+857
-0
lines changed

6 files changed

+857
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ certs/
5252
__pycache__/
5353
*.py[cod]
5454
*$py.class
55+
mcpgateway-wrapper/src/mcp_gateway_wrapper/__pycache__/
5556

5657
# Bak
5758
*.bak

mcpgateway-wrapper/README.md

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
# MCP Gateway Wrapper
2+
3+
This mcp wrapper allows you to access and use all the tools present in the MCP gateway through any client that supports the MCP protocol, such as Claude and Cline. It connects to the server catalog in mcp gateway and dynamically retrieves tools from it and makes tool calls as required.
4+
If an MCP client doesn't support SSE but does support stdio, use this wrapper to connect to the gateway and access all of the gateway's features within the MCP client.
5+
6+
# Key Features
7+
1. Dynamic Tool Access: Connects to the server catalog and fetches available tools in real time.
8+
2. MCP Compatibility: Works seamlessly with any client supporting the MCP protocol (e.g., Claude, Cline).
9+
3. Centralized Management: A single interface to manage and utilize all tools available via the MCP gateway.
10+
4. stdio transport : Uses stdio transport for communication between MCP client and the mcpgateway
11+
12+
13+
## Components
14+
15+
### Tools
16+
17+
The server extends tools from the server catalogs of mcp gateway
18+
19+
### Resources
20+
21+
The server fetched resources from the server catalogs of mcp gateway
22+
23+
### Prompts
24+
25+
The server fetched prompts from the server catalogs of mcp gateway
26+
27+
28+
29+
30+
31+
## Quickstart
32+
33+
### Install
34+
35+
#### Claude Desktop
36+
37+
On MacOS: `~/Library/Application\ Support/Claude/claude_desktop_config.json`
38+
On Windows: `%APPDATA%/Claude/claude_desktop_config.json`
39+
40+
# Running the server from local source
41+
1. Clone the repository
42+
2. Go to cline/claude config file
43+
3. Add the following JSON configuration to the config file, and edit the following parameters:
44+
- Path to the `mcpgateway-wrapper` folder.
45+
- All necessary environment variables.
46+
47+
48+
```json
49+
{
50+
"mcpServers": {
51+
"mcpgateway-wrapper": {
52+
"command": "uv",
53+
"args": [
54+
"--directory",
55+
"path-to-folder/mcpgateway-wrapper",
56+
"run",
57+
"mcpgateway-wrapper"
58+
],
59+
"env": {
60+
"MCP_SERVER_CATALOG_URLS": "http://localhost:4444/servers/1",
61+
"MCP_AUTH_TOKEN": "your_bearer_token"
62+
}
63+
}
64+
}
65+
}
66+
```
67+
68+
69+
### MCP_SERVER_CATALOG_URLS
70+
This parameter specifies one or more URLs pointing to the MCP server catalog. URLs can be provided individually or as a comma-separated list.
71+
72+
3.1 Specific Server:
73+
```bash
74+
"MCP_SERVER_CATALOG_URLS": "http://localhost:4444/servers/1"
75+
```
76+
77+
3.2 Multiple Servers (comma separated servers):
78+
```bash
79+
"MCP_SERVER_CATALOG_URLS": "http://localhost:4444/servers/1,http://localhost:4444/servers/2,http://localhost:4444/servers/3"
80+
```
81+
3.3 All tools, prompts, resources (gateway URL):
82+
```bash
83+
"MCP_SERVER_CATALOG_URLS": "http://localhost:4444"
84+
```
85+
86+
87+
88+
89+
90+
91+
# TODO: Published Servers Configuration
92+
```json
93+
"mcpServers": {
94+
"mcpgateway-wrapper": {
95+
"command": "uvx",
96+
"args": [
97+
"mcpgateway-wrapper"
98+
]
99+
}
100+
}
101+
```
102+
103+
## Development
104+
105+
### Building and Publishing
106+
107+
To prepare the package for distribution:
108+
109+
1. Sync dependencies and update lockfile:
110+
```bash
111+
uv sync
112+
```
113+
114+
2. Build package distributions:
115+
```bash
116+
uv build
117+
```
118+
119+
This will create source and wheel distributions in the `dist/` directory.
120+
121+
3. Publish to PyPI:
122+
```bash
123+
uv publish
124+
```
125+
126+
Note: You'll need to set PyPI credentials via environment variables or command flags:
127+
- Token: `--token` or `UV_PUBLISH_TOKEN`
128+
- Or username/password: `--username`/`UV_PUBLISH_USERNAME` and `--password`/`UV_PUBLISH_PASSWORD`
129+
130+
### Debugging
131+
132+
133+
You can launch the MCP Inspector via [`npm`](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) with this command:
134+
135+
```bash
136+
npx @modelcontextprotocol/inspector uv --directory "path to mcpgateway-wrapper" run mcpgateway-wrapper
137+
```
138+
139+
140+
Upon launching, the Inspector will display a URL that you can access in your browser to begin debugging.

mcpgateway-wrapper/pyproject.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[project]
2+
name = "mcpgateway-wrapper"
3+
version = "0.1.0"
4+
description = "To use all the tools present in mcp gateway in any client supporting mcp. eg. Claude, Cline"
5+
readme = "README.md"
6+
requires-python = ">=3.11"
7+
dependencies = [
8+
"mcp>=1.3.0",
9+
"pyjwt==2.10.1"
10+
]
11+
12+
[build-system]
13+
requires = [ "hatchling",]
14+
build-backend = "hatchling.build"
15+
16+
[project.scripts]
17+
mcpgateway-wrapper = "mcpgateway_wrapper:main"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from . import server
2+
import asyncio
3+
4+
def main():
5+
"""Main entry point for the package."""
6+
asyncio.run(server.main())
7+
8+
# Optionally expose other important items at package level
9+
__all__ = ['main', 'server']

0 commit comments

Comments
 (0)