Skip to content

Support json configs in Claude format #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
node_modules/
build/
*.log
.env*
*.db
config.json
/tmp
/out-tsc

/node_modules
npm-debug.log*
yarn-debug.log*
yarn-error.log*
/.pnp
.pnp.js

.vscode/*
34 changes: 33 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,32 @@ The server requires a JSON configuration file that specifies the MCP servers to
cp config.example.json config.json
```

Example config structure:
### MCP-Style Configuration (Recommended)

The proxy server now supports the standard MCP configuration format used by Claude, Cursor, and other MCP clients. This makes it easier to copy and paste existing configurations:

```json
{
"mcpServers": {
"server1": {
"command": "/path/to/server1/build/index.js"
},
"server2": {
"command": "server2-command",
"args": ["--option1", "value1"],
"env": ["SECRET_API_KEY"]
},
"server3": {
"url": "http://localhost:8080/sse"
}
}
}
```

### Legacy Configuration Format

For backward compatibility, the original configuration format is still supported:

```json
{
"servers": [
Expand Down Expand Up @@ -62,6 +87,13 @@ Example config structure:
}
```

### Configuration Notes

- **MCP-Style Format**: Server names are defined as object keys, and transport configuration is flattened
- **SSE Servers**: Use the `url` property directly (no need to specify `type: "sse"`)
- **Stdio Servers**: Use `command`, `args`, and `env` properties directly
- **Environment Variables**: The `env` array lists environment variable names to pass to the server process

The config file must be provided when running the server:
```bash
MCP_CONFIG_PATH=./config.json mcp-proxy-server
Expand Down
36 changes: 13 additions & 23 deletions config.example.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,18 @@
{
"servers": [
{
"name": "Example Server 1",
"transport": {
"command": "/path/to/server1/build/index.js"
}
"mcpServers": {
"example-server-1": {
"command": "/path/to/server1/build/index.js"
},
{
"name": "Example Server 2",
"transport": {
"command": "npx",
"args": [
"@example/mcp-server",
"--option",
"value"
]
}
"example-server-2": {
"command": "npx",
"args": [
"@example/mcp-server",
"--option",
"value"
]
},
{
"name": "Example Server 3",
"transport": {
"type": "sse",
"url": "http://example.com/mcp"
}
"example-server-3": {
"url": "http://example.com/mcp"
}
]
}
}
28 changes: 28 additions & 0 deletions config.legacy.example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"servers": [
{
"name": "Example Server 1",
"transport": {
"command": "/path/to/server1/build/index.js"
}
},
{
"name": "Example Server 2",
"transport": {
"command": "npx",
"args": [
"@example/mcp-server",
"--option",
"value"
]
}
},
{
"name": "Example Server 3",
"transport": {
"type": "sse",
"url": "http://example.com/mcp"
}
}
]
}
Loading