Commit Graph

63 Commits

Author SHA1 Message Date
Hektor Jacynycz Garcia
90134a9206 fix: missing slash on SSE /messages path (#71) 2025-05-31 09:04:33 +02:00
Sam
b25056fadd feat: support proxying multiple MCP stdio servers to SSE (#65)
This PR adds support for running multiple MCP (STDIO) servers and
serving them up via a single mcp-proxy instance, each with a named path
in the URL.

Example usage:

```
mcp-proxy --port 8080 --named-server fetch 'uvx mcp-server-fetch' --named-server github 'npx -y @modelcontextprotocol/server-github'
```

Would serve:

- `http://localhost:8080/servers/fetch`
- `http://localhost:8080/servers/github`

I've also added the ability to provide a standard mcp client config file
with accompanying tests.

Please feel free to make any changes as you see fit, or reject the PR if
it does not align with your goals.

Thank you,

---------

Co-authored-by: Magnus Tidemann <magnustidemann@gmail.com>
Co-authored-by: Sergey Parfenyuk <sergey.parfenyuk@gmail.com>
2025-05-27 11:48:25 +02:00
Sergey Parfenyuk
f31cd3e73c feat: support streamable transport in client mode (#70)
When running in client mode, use `--transport=streamablehttp` to enforce the new communication method between `mcp-proxy` and remote MCP servers.
2025-05-26 09:50:35 +02:00
Jack Wong
27a16279ef fix: correct debug logging typo (#68)
Co-authored-by: jack.wong <jack.wong@bytedance.com>
2025-05-17 22:53:52 +02:00
Magnuti
6a888cbe09 docs: README updates on --env
`--env` takes in `FOO BAR` and not `FOO=BAR`
2025-05-17 14:06:04 +02:00
Sergey Parfenyuk
774b4aaa2a chore: bump version 2025-05-13 08:44:49 +02:00
caydenwei
2980a50ad2 feat: support passing 'stateless' and 'cwd' arguments (#62)
1. Add support for --stateless parameter configuration
2. Add support for --cwd parameter passing working directory to mcp
stdio server
3. Use StreamableHTTPSessionManager from the latest python-mcp-sdk
release to manage sessions, simplifying code
4. Optimize test cases
2025-05-11 13:26:37 +02:00
caydenwei
8fee3d9833 feat: support streamable http proxy (#60) 2025-05-09 19:03:26 +02:00
Sergey Parfenyuk
e9fe649fe8 chore: upgrade deps (#49) 2025-04-13 12:16:01 +02:00
Sergey Parfenyuk
a4633d7609 chore: upgrade pre-commit hooks (#48) 2025-04-13 11:57:55 +02:00
Sergey Parfenyuk
357c8c23f0 feat: support --debug argument for verbose output (#47)
Closes #34
2025-04-13 11:55:10 +02:00
Sergey Parfenyuk
73e90cb649 Update README (#46)
Closes #42
2025-04-13 11:22:16 +02:00
Sergey Parfenyuk
79670a4afa chore: bump all deps (#38) 2025-03-25 09:38:18 +01:00
Sergey Parfenyuk
b4f35330f0 docs: use latest tag
skip-checks: true
2025-03-10 20:33:11 +01:00
Sergey Parfenyuk
78783f3aec docs: notes on docker-compose use 2025-03-05 18:28:12 +01:00
Fedir Zadniprovskyi
209268a361 feat: expose CORS configuration (#31)
Allow specifying CORS configuration so that a client can call the proxy from a different host/port.

Co-authored-by: Fedir Zadniprovskyi <github.g1k56@simplelogin.com>
Co-authored-by: Sergey Parfenyuk <myseverality@gmail.com>
2025-03-05 18:10:15 +01:00
Sergey Parfenyuk
7eb4a09d9a ci: use local cache 2025-03-01 08:26:08 +01:00
Sergey Parfenyuk
8cc29a2ec8 ci: improve github workflows 2025-03-01 08:05:01 +01:00
Ross Masters
cc8a4fac87 feat: Allow passing through all environment variables to server (#27)
This PR adds the ability to pass through all environment variables to
the server, using the flag `--pass-environment` (default off).

This change allows a compose spec like this to access all environment
variables from an env_file (as well as PATH):

```yaml
server-brave-search:
  image: mcp-proxy:latest
  env_file: .brave.env
  # ENTRYPOINT from custom SSE-only image, for context
  entrypoint: ["mcp-proxy", "--sse-host=0.0.0.0", "--sse-port=8080", "--pass-environment", "--"]
  command: ["npx", "--yes", "@modelcontextprotocol/server-brave-search"]
```

The motivation behind this is I am developing in Docker Compose, with a
custom client and multiple servers. I made a debian-based mcp-proxy
image, with an entrypoint that set some SSE settings. When it came to
adding brave search, I spent a bit of time struggling against var
interpolation and an overridden entrypoint (cause: you can't access env
vars in entrypoints, I think). I figured passing through all environment
variables would be easier (and safe in a container).

I started adding tests for this, but found myself refactoring
\_\_main\_\_.py quite a bit to make it more testable. I've left that for
now in the aim of an easy-to-review PR, but am happy to continue that
effort if you'd like? Essentially breaking out the argument parser and
the SSE client/server parts into functions and validating their config.

Thanks again for this tool - it's made adding support for stdio servers
in our client much easier!

---------

Co-authored-by: Sergey Parfenyuk <myseverality@gmail.com>
2025-03-01 00:03:30 +01:00
Sergey Parfenyuk
b84e7745f5 fix: annotate multi-arch image before pushing to ghcr 2025-02-07 21:30:38 +01:00
Sergey Parfenyuk
cff379061e chore: sync uv.lock 2025-02-07 20:56:40 +01:00
Sergey Parfenyuk
e6f9f3db98 feat: support multi-arch Docker image 2025-02-07 20:54:31 +01:00
andersenthomas98
1de8394767 feat: support 'headers' argument for SSE server connection (#23)
I have replaced the `--api-access-token` argument with the more generic
`--headers` argument for SSE. This will allow for other auth mechanisms
such as api keys as well. Intended usage:

```sh
# API key
mcp-proxy http://example.io/sse --headers x-api-key my-super-secret-api-key

# Bearer token
mcp-proxy http://example.io/sse --headers Authorization 'Bearer my-super-secret-bearer-token'

# Multiple headers
mcp-proxy http://example.io/sse --headers Authorization 'Bearer my-super-secret-bearer-token' --headers x-api-key my-super-secret-api-key
```
2025-02-07 20:49:27 +01:00
Sergey Parfenyuk
da9cbf7386 docs: readme correction 2025-01-26 19:30:18 +01:00
Sergey Parfenyuk
c1edc1fd29 fix: add workflow permissions 2025-01-26 19:24:59 +01:00
Sergey Parfenyuk
b56e574cd9 docs: update README on how to use container 2025-01-26 19:24:59 +01:00
Sergey Parfenyuk
842ee7099e chore: sync uv.lock 2025-01-26 19:24:59 +01:00
Sergey Parfenyuk
55025ce381 build: add Docker steps to github workflows 2025-01-26 19:24:59 +01:00
Henry Mao
ac30164de1 ci: add Dockerfile and Smithery config (#21)
This pull request introduces the following updates:

- **Dockerfile**: Introduces a Dockerfile to package the MCP for
deployment across various environments.
- **Smithery Configuration**: Adds a Smithery YAML file, which specifies
how to start the MCP and the configuration options it supports. It
allows you to [deploy](https://smithery.ai/docs/deployments) your MCP to
[Smithery](https://smithery.ai?utm_campaign=pr), serving it over SSE so
end-users do not need to install additional dependencies. To deploy,
merge this PR, then visit your [server
page](https://smithery.ai/server/mcp-proxy?utm_campaign=pr&modal=claim)
and click "Deploy" under the deployments page.

Please review these updates to verify their accuracy for your server and
feel free to customize it to your needs. Let me know if you have any
questions. 🙂

---------

Co-authored-by: Sergey Parfenyuk <myseverality@gmail.com>
2025-01-26 18:04:41 +01:00
Sergey Parfenyuk
6bc49735cc chore: ping github actions 2025-01-19 16:25:35 +01:00
Sergey Parfenyuk
2a20b8191a chore: use latest git-auto-commit-action@v5.1.0 2025-01-18 10:11:12 +01:00
Sergey Parfenyuk
74ab711929 chore: use latest pre-commit/action@v3.0.1 2025-01-18 10:11:12 +01:00
Sergey Parfenyuk
7e29ee4f26 chore: use latest actions/checkout@v4.2.2 2025-01-18 10:11:12 +01:00
Sergey Parfenyuk
ed72117b86 chore: use latest astral-sh/setup-uv 5.2.1 2025-01-18 10:11:12 +01:00
Sergey Parfenyuk
1401dbfd4b chore: configure dependabot 2025-01-18 08:45:37 +01:00
Sergey Parfenyuk
542b2db7f5 chore: use py3.12 to validate changes 2025-01-18 08:45:37 +01:00
Sergey Parfenyuk
787ba896e7 chore: add Python 3.10 support (#17)
- Add badges
- Use codecov.io
- Change classifiers to include 3.10
2025-01-13 19:04:14 +01:00
Sergey Parfenyuk
d4ada000b1 chore: bump mcp version (#16)
- Bump mcp: 1.1.2 -> 1.2.0
- Assume version constraints
- Update imports
2025-01-08 19:18:40 +01:00
Sergey Parfenyuk
e0954341a3 fix: connect other github actions with mypy job (#14) 2025-01-02 22:01:28 +01:00
Henry Mao
4cfe76a59a chore: add Smithery CLI installation instructions and badge (#12) 2025-01-02 21:25:12 +01:00
Sergey Parfenyuk
874ae38087 docs: update readme and --help output (#13)
* Refine CLI and reflect the change in the documentation
* Update README.md with concise examples
* Bump version

---------

Co-authored-by: Allen Porter <allen.porter@gmail.com>
2025-01-02 21:22:59 +01:00
Allen Porter
1b9880bc56 feat: add functionality to start an SSE server to proxy a local stdio server (#11)
* Add CLI for starting the SSE server

* Update README.md 

* Fix lint errors

* Update debug signature

* Minor fixes

---------

Co-authored-by: Sergey Parfenyuk <sergey.parfenyuk@gmail.com>
2025-01-01 09:50:52 +01:00
Sergey Parfenyuk
c065900c12 chore: add mypy for advanced type checks 2024-12-31 19:59:45 +01:00
Allen Porter
44b09ec954 feat: serve a SSE server proxying a STDIO server (#8)
* Add library for serving an sse server proxying a stdio server

* Change context manager for running server in the background thread

* Fix lint errors in new test fixture

* Update starlette response routing

* Fix ruff format errors

* Fix ruff format errors

* Fix typos in SseServerSettigs

* Rename host to bind host and update to localhost

* Update for new import location

* Update imports based on ruff rules

* Update src/mcp_proxy/sse_server.py

Co-authored-by: Guillaume Raille <guillaume.raille@gmail.com>
2024-12-31 19:08:31 +01:00
Sergey Parfenyuk
1b5b05b1ea docs: mention pypi package (#10) 2024-12-31 10:44:34 +01:00
Guillaume Raille
3fe24f9cbd chore: enforce docstring convention 2024-12-31 10:23:48 +01:00
Allen Porter
8423905ca2 refactor: separate client and proxy server in preparation for more client behaviors (#7)
* Refactor to separate client and proxy server in preparation for more client behaviors

* Fix incorrect package names
2024-12-31 10:10:33 +01:00
Sergey Parfenyuk
c132722d66 chore: remove non-standard classifiers 2024-12-29 17:56:02 +01:00
Sergey Parfenyuk
614f146532 chore: update project info (#6) 2024-12-29 17:24:20 +01:00
Sergey Parfenyuk
f44c9cd123 chore: add pypi deployment step (#5)
Bump version to 0.2.1
2024-12-29 16:16:29 +01:00