UNPKG

@onecompiler/onecompiler-mcp-server

Version:
113 lines (81 loc) 3.11 kB
# MCP Server for Onecompiler [Onecompiler](https://onecompiler.com?utm_source=dx&utm_medium=onecompiler-mcp-server) takes care of executing code with one unified API that does it all. This is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) server that provides tools for interacting with the Onecompiler APIs. ## Features - Execute code in Onecompiler ## Installation To use the MCP server, you'll need an API key. You can create and manage API keys in **RapidAPI > OneCompiler APIs**: - Live: https://rapidapi.com/onecompiler-onecompiler-default/api/onecompiler-apis You can run the Onecompiler MCP server using `npx` with the following command: ```bash npx -y @onecompiler/onecompiler-mcp-server --api-key=ONECOMPILER_API_KEY --provider=rapidapi ``` Replace `ONECOMPILER_API_KEY` with your API key retrieved from [rapidapi](https://rapidapi.com/onecompiler-onecompiler-default/api/onecompiler-apis) If you have retrieved your API key from [onecompiler](https://onecompiler.com) instead of [rapidapi](https://rapidapi.com/onecompiler-onecompiler-default/api/onecompiler-apis), you can run the server using the following command: ```bash npx -y @onecompiler/onecompiler-mcp-server --api-key=ONECOMPILER_API_KEY --provider=onecompiler ``` To run the server in a client like Claude Desktop, Cursor, Cline or Windsurf, add the following to your MCP config: ```json { "mcpServers": { "onecompiler": { "command": "npx", "args": ["-y", "@onecompiler/onecompiler-mcp-server", "--api-key=ONECOMPILER_API_KEY", "--provider=rapidapi"] } } } ``` or pass as values in env variables, example: ```json { "mcpServers": { "onecompiler": { "command": "npx", "args": ["-y", "@onecompiler/onecompiler-mcp-server"], "env": { "ONECOMPILER_API_KEY": "your_api_key", "ONECOMPILER_PROVIDER": "rapidapi" } } } } ``` For detailed setup guides, see: - [Claude Desktop](https://modelcontextprotocol.io/quickstart/user) - [Cursor](https://docs.cursor.com/context/model-context-protocol) - [Windsurf](https://docs.codeium.com/windsurf/mcp) ## Development 1. Install dependencies: ```bash npm install ``` 2. Build the server: ```bash npm build ``` 3. Update client to use the local build: ```json { "mcpServers": { "onecompiler": { "command": "node", "args": ["path/to/onecompiler-mcp-server/build/index.js"], "env": { "ONECOMPILER_API_KEY": "your_api_key", "ONECOMPILER_PROVIDER": "(rapidapi | onecompiler)", "ONECOMPILER_ENVIRONMENT": "(sandbox | production)" } } } } ``` Note: Use `ONECOMPILER_ENVIRONMENT`, only if `ONECOMPILER_PROVIDER` is set to `onecompiler`. ## Debugging To debug the MCP server, you can use the MCP Inspector tool: 1. Run the server with the inspector: ```bash pnpm inspector ``` 2. Open the provided URL in your browser to view and debug the MCP requests and responses. 3. Include the `--api-key`, `--environment` or `--provider` arguments.