Skip to content
This repository was archived by the owner on Oct 27, 2025. It is now read-only.

Commit a874604

Browse files
Init MCP (#1)
* feat: init * feat: add readme * feat: use commander to parse argv * refactor: use package.json information * Refacto * Add CI config --------- Co-authored-by: BruceWouaigne <denis@linkup.so>
1 parent 5bacf56 commit a874604

File tree

14 files changed

+6999
-0
lines changed

14 files changed

+6999
-0
lines changed

.github/workflows/_run-tests.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Run Tests
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
run-tests:
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
node-version: ["18.x", "19.x", "20.x"]
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-node@v4
15+
with:
16+
node-version: ${{ matrix.node-version }}
17+
- name: Install
18+
run: npm install
19+
- name: Build
20+
run: npm run build
21+
- name: Lint
22+
run: npm run lint
23+
- name: Test
24+
run: npm run test

.github/workflows/pr.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: PR targeting Main
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches: main
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
run-tests:
14+
uses: ./.github/workflows/_run-tests.yaml

.github/workflows/push-main.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: Push on Main
2+
3+
on:
4+
push:
5+
branches: main
6+
7+
jobs:
8+
run-tests:
9+
uses: ./.github/workflows/_run-tests.yaml

.github/workflows/release.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Publish to npm
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
run-tests:
9+
uses: ./.github/workflows/_run-tests.yaml
10+
11+
build-and-publish:
12+
needs: run-tests
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
# Setup .npmrc file to publish to npm
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: '20.x'
20+
registry-url: 'https://registry.npmjs.org'
21+
- run: npm ci
22+
- run: npm run build
23+
- run: npm publish --access public
24+
env:
25+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ yarn-error.log*
77
lerna-debug.log*
88
.pnpm-debug.log*
99

10+
# Distribution / packaging
11+
build/
12+
1013
# Diagnostic reports (https://nodejs.org/api/report.html)
1114
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
1215

.prettierrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"semi": true,
3+
"trailingComma": "all",
4+
"singleQuote": true,
5+
"printWidth": 80,
6+
"useTabs": false,
7+
"tabWidth": 2,
8+
"endOfLine": "lf"
9+
}

README.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Linkup Model Context Protocol
2+
3+
This package provides a [Model Context Protocol](https://modelcontextprotocol.com/) server for integrating Linkup's web search functionality with AI models that support function calling through MCP.
4+
5+
## Installation & Usage
6+
7+
You can run the Linkup MCP server directly using npx:
8+
9+
```bash
10+
npx -y linkup-mcp --api-key=YOUR_LINKUP_API_KEY
11+
```
12+
13+
Alternatively, you can set your API key as an environment variable:
14+
15+
```bash
16+
export LINKUP_API_KEY=YOUR_LINKUP_API_KEY
17+
npx -y linkup-mcp
18+
```
19+
20+
# Command Line Options
21+
22+
| Option | Description |
23+
| ------------ | ----------------------------------------------------------------- |
24+
| `--api-key` | Your Linkup API key (required unless `LINKUP_API_KEY` env is set) |
25+
| `--base-url` | Custom API base URL (default: `https://api.linkup.so/v1`) |
26+
| `--help, -h` | Show help text |
27+
28+
# Usage with Claude
29+
30+
Add the following to your `claude_desktop_config.json`. See the [MCP documentation](https://modelcontextprotocol.io/quickstart/user) for more details.
31+
32+
To ensure compatibility with Claude, we recommend that `npx` command be accessible within the same environment. A common location for this is `/usr/local/bin/node` (on mac)
33+
34+
```json
35+
{
36+
"mcpServers": {
37+
"linkup": {
38+
"command": "npx",
39+
"args": ["-y", "linkup-mcp"],
40+
"env": {
41+
"LINKUP_API_KEY": "YOUR_LINKUP_API_KEY"
42+
}
43+
}
44+
}
45+
}
46+
```
47+
48+
or
49+
50+
```json
51+
{
52+
"mcpServers": {
53+
"linkup": {
54+
"command": "npx",
55+
"args": ["-y", "linkup-mcp", "--api-key=YOUR_LINKUP_API_KEY"]
56+
}
57+
}
58+
}
59+
```
60+
61+
## Available Tools
62+
63+
| Tool | Description |
64+
| ------------ | --------------------------------------- |
65+
| `search-web` | Perform a web search query using Linkup |
66+
67+
## Development
68+
69+
Clone the repository and install dependencies:
70+
71+
```bash
72+
git clone git@github.com:LinkupPlatform/linkup-js-mcp.git
73+
cd linkup-js-mcp
74+
npm install
75+
```
76+
77+
# Available Scripts
78+
79+
| Script | Description |
80+
| -------------------- | ---------------------------- |
81+
| `npm run build` | Build the TypeScript project |
82+
| `npm run lint` | Run ESLint |
83+
| `npm run format` | Format code with Prettier |
84+
| `npm run test` | Run tests |
85+
| `npm run test:watch` | Run tests in watch mode |
86+
87+
# License
88+
89+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

eslint.config.mjs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import js from '@eslint/js';
2+
import typescript from '@typescript-eslint/eslint-plugin';
3+
import tsParser from '@typescript-eslint/parser';
4+
import prettier from 'eslint-plugin-prettier';
5+
import eslintConfigPrettier from 'eslint-config-prettier';
6+
import globals from 'globals';
7+
8+
export default [
9+
js.configs.recommended,
10+
{
11+
files: ['**/*.ts'],
12+
languageOptions: {
13+
parser: tsParser,
14+
ecmaVersion: 2022,
15+
sourceType: 'module',
16+
globals: {
17+
...globals.node,
18+
...globals.jest,
19+
},
20+
},
21+
plugins: {
22+
'@typescript-eslint': typescript,
23+
prettier: prettier,
24+
},
25+
rules: {
26+
...typescript.configs.recommended.rules,
27+
...eslintConfigPrettier.rules,
28+
'prettier/prettier': [
29+
'error',
30+
{
31+
useTabs: false,
32+
tabWidth: 2,
33+
},
34+
],
35+
'no-tabs': 'error',
36+
indent: ['error', 2, { SwitchCase: 1 }],
37+
},
38+
},
39+
];

jest.config.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module.exports = {
2+
preset: 'ts-jest',
3+
testEnvironment: 'node',
4+
testMatch: ['**/__tests__/**/*.ts'],
5+
moduleFileExtensions: ['ts', 'js', 'json', 'node'],
6+
collectCoverage: true,
7+
coverageDirectory: 'coverage',
8+
coverageReporters: ['text', 'lcov'],
9+
transform: {
10+
'^.+\\.ts$': ['ts-jest', { tsconfig: 'tsconfig.json' }],
11+
},
12+
};

0 commit comments

Comments
 (0)