diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e170a94 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,37 @@ +name: CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '18.x' + + - name: Install dependencies + run: npm ci + + - name: Build + run: npm run build + + nix-build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@main + + - name: Build with Nix + run: nix build \ No newline at end of file diff --git a/.gitignore b/.gitignore index 7f106e9..28e284f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,8 @@ node_modules/ build/ *.log -.env* \ No newline at end of file +.env* +.direnv/ +.envrc +result +result-* \ No newline at end of file diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..e99ec39 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1740367490, + "narHash": "sha256-WGaHVAjcrv+Cun7zPlI41SerRtfknGQap281+AakSAw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "0196c0175e9191c474c26ab5548db27ef5d34b05", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..23e98c7 --- /dev/null +++ b/flake.nix @@ -0,0 +1,58 @@ +{ + description = "A Model Context Protocol server with Exa which does web search"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { inherit system; }; + in + { + packages.default = pkgs.buildNpmPackage { + pname = "exa-mcp-server"; + version = "0.1.0"; + src = ./.; + npmDepsHash = "sha256-/MIyf3tDnLrw4kEI2sEd6b92PhrSmzEjcxllbljE69c="; + makeCacheWritable = true; + + buildPhase = '' + # First run the build + npm run build + + # Make the output directory + mkdir -p $out/lib/node_modules/exa-mcp-server + ''; + + installPhase = '' + # Copy the entire package with node_modules + cp -r . $out/lib/node_modules/exa-mcp-server/ + + # Create bin directory and symlink + mkdir -p $out/bin + chmod +x $out/lib/node_modules/exa-mcp-server/build/index.js + ln -s $out/lib/node_modules/exa-mcp-server/build/index.js $out/bin/exa-mcp-server + ''; + + meta = with pkgs.lib; { + description = "A Model Context Protocol server with Exa which does web search"; + homepage = "https://github.com/exa-labs/exa-mcp-server"; + license = licenses.mit; + mainProgram = "exa-mcp-server"; + maintainers = []; + }; + }; + + devShells.default = pkgs.mkShell { + buildInputs = with pkgs; [ + nodejs_18 + nodePackages.typescript + nodePackages.npm + ]; + }; + } + ); +}