@pipeworx/mcp-linear 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +34 -0
- package/package.json +20 -0
- package/server.json +18 -0
- package/src/index.ts +294 -0
- package/tsconfig.json +14 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Pipeworx
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# mcp-linear
|
|
2
|
+
|
|
3
|
+
Linear MCP — wraps the Linear GraphQL API (OAuth)
|
|
4
|
+
|
|
5
|
+
Part of the [Pipeworx](https://pipeworx.io) open MCP gateway.
|
|
6
|
+
|
|
7
|
+
## Tools
|
|
8
|
+
|
|
9
|
+
| Tool | Description |
|
|
10
|
+
|------|-------------|
|
|
11
|
+
|
|
12
|
+
## Quick Start
|
|
13
|
+
|
|
14
|
+
Add to your MCP client config:
|
|
15
|
+
|
|
16
|
+
```json
|
|
17
|
+
{
|
|
18
|
+
"mcpServers": {
|
|
19
|
+
"linear": {
|
|
20
|
+
"url": "https://gateway.pipeworx.io/linear/mcp"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Or use the CLI:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npx pipeworx use linear
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## License
|
|
33
|
+
|
|
34
|
+
MIT
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pipeworx/mcp-linear",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Linear MCP — wraps the Linear GraphQL API (OAuth)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"types": "src/index.ts",
|
|
8
|
+
"keywords": ["mcp", "mcp-server", "model-context-protocol", "pipeworx", "linear"],
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/pipeworx-io/mcp-linear"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"typecheck": "tsc --noEmit"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"typescript": "^5.7.0"
|
|
19
|
+
}
|
|
20
|
+
}
|
package/server.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
|
+
"name": "io.github.pipeworx-io/linear",
|
|
4
|
+
"title": "linear",
|
|
5
|
+
"description": "Linear MCP — wraps the Linear GraphQL API (OAuth)",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"websiteUrl": "https://pipeworx.io/packs/linear",
|
|
8
|
+
"repository": {
|
|
9
|
+
"url": "https://github.com/pipeworx-io/mcp-linear",
|
|
10
|
+
"source": "github"
|
|
11
|
+
},
|
|
12
|
+
"remotes": [
|
|
13
|
+
{
|
|
14
|
+
"type": "streamable-http",
|
|
15
|
+
"url": "https://gateway.pipeworx.io/linear/mcp"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
interface McpToolDefinition {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
inputSchema: {
|
|
5
|
+
type: 'object';
|
|
6
|
+
properties: Record<string, unknown>;
|
|
7
|
+
required?: string[];
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface McpToolExport {
|
|
12
|
+
tools: McpToolDefinition[];
|
|
13
|
+
callTool: (name: string, args: Record<string, unknown>) => Promise<unknown>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Linear MCP — wraps the Linear GraphQL API (OAuth)
|
|
18
|
+
*
|
|
19
|
+
* Tools:
|
|
20
|
+
* - linear_list_issues: query issues with optional filter
|
|
21
|
+
* - linear_get_issue: get a single issue by ID
|
|
22
|
+
* - linear_create_issue: create a new issue
|
|
23
|
+
* - linear_list_teams: list all teams in the workspace
|
|
24
|
+
* - linear_search: search issues by query text
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
const API = 'https://api.linear.app/graphql';
|
|
29
|
+
|
|
30
|
+
interface LinearContext {
|
|
31
|
+
linear?: { accessToken: string };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// ── Tool definitions ──────────────────────────────────────────────────
|
|
35
|
+
|
|
36
|
+
const tools: McpToolExport['tools'] = [
|
|
37
|
+
{
|
|
38
|
+
name: 'linear_list_issues',
|
|
39
|
+
description:
|
|
40
|
+
'List issues from Linear with optional filtering. Returns issue ID, title, state, priority, assignee, and URL.',
|
|
41
|
+
inputSchema: {
|
|
42
|
+
type: 'object' as const,
|
|
43
|
+
properties: {
|
|
44
|
+
filter: {
|
|
45
|
+
type: 'string',
|
|
46
|
+
description:
|
|
47
|
+
'Optional filter object as JSON string (e.g., {"state":{"name":{"eq":"In Progress"}}}). Passed directly to the Linear issues query filter.',
|
|
48
|
+
},
|
|
49
|
+
first: {
|
|
50
|
+
type: 'number',
|
|
51
|
+
description: 'Number of issues to return (default 20, max 50)',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'linear_get_issue',
|
|
58
|
+
description:
|
|
59
|
+
'Get a single Linear issue by its ID (e.g., "ABC-123"). Returns full issue details including title, description, state, priority, assignee, labels, and comments.',
|
|
60
|
+
inputSchema: {
|
|
61
|
+
type: 'object' as const,
|
|
62
|
+
properties: {
|
|
63
|
+
id: { type: 'string', description: 'Issue identifier (e.g., "ABC-123")' },
|
|
64
|
+
},
|
|
65
|
+
required: ['id'],
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: 'linear_create_issue',
|
|
70
|
+
description:
|
|
71
|
+
'Create a new issue in Linear. Returns the created issue ID, identifier, title, and URL.',
|
|
72
|
+
inputSchema: {
|
|
73
|
+
type: 'object' as const,
|
|
74
|
+
properties: {
|
|
75
|
+
title: { type: 'string', description: 'Issue title' },
|
|
76
|
+
description: { type: 'string', description: 'Issue description (markdown supported)' },
|
|
77
|
+
teamId: { type: 'string', description: 'Team ID to create the issue in' },
|
|
78
|
+
priority: {
|
|
79
|
+
type: 'number',
|
|
80
|
+
description: 'Priority level: 0 (none), 1 (urgent), 2 (high), 3 (medium), 4 (low)',
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
required: ['title', 'teamId'],
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: 'linear_list_teams',
|
|
88
|
+
description:
|
|
89
|
+
'List all teams in the Linear workspace. Returns team ID, name, key, and description.',
|
|
90
|
+
inputSchema: {
|
|
91
|
+
type: 'object' as const,
|
|
92
|
+
properties: {},
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: 'linear_search',
|
|
97
|
+
description:
|
|
98
|
+
'Search Linear issues by text query. Returns matching issues with ID, title, state, priority, and URL.',
|
|
99
|
+
inputSchema: {
|
|
100
|
+
type: 'object' as const,
|
|
101
|
+
properties: {
|
|
102
|
+
query: { type: 'string', description: 'Search query text' },
|
|
103
|
+
first: {
|
|
104
|
+
type: 'number',
|
|
105
|
+
description: 'Number of results to return (default 20, max 50)',
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
required: ['query'],
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
];
|
|
112
|
+
|
|
113
|
+
// ── Helpers ───────────────────────────────────────────────────────────
|
|
114
|
+
|
|
115
|
+
function getToken(args: Record<string, unknown>): string {
|
|
116
|
+
const context = (args._context ?? {}) as LinearContext;
|
|
117
|
+
const token = context.linear?.accessToken;
|
|
118
|
+
if (!token) throw new Error('Linear OAuth token required. Connect Linear via OAuth first.');
|
|
119
|
+
return token;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
async function graphql(token: string, query: string, variables?: Record<string, unknown>): Promise<unknown> {
|
|
123
|
+
const res = await fetch(API, {
|
|
124
|
+
method: 'POST',
|
|
125
|
+
headers: {
|
|
126
|
+
'Content-Type': 'application/json',
|
|
127
|
+
Authorization: `Bearer ${token}`,
|
|
128
|
+
},
|
|
129
|
+
body: JSON.stringify({ query, variables }),
|
|
130
|
+
});
|
|
131
|
+
if (!res.ok) {
|
|
132
|
+
const text = await res.text();
|
|
133
|
+
throw new Error(`Linear API error ${res.status}: ${text}`);
|
|
134
|
+
}
|
|
135
|
+
const json = (await res.json()) as { data?: unknown; errors?: { message: string }[] };
|
|
136
|
+
if (json.errors?.length) {
|
|
137
|
+
throw new Error(`Linear GraphQL error: ${json.errors.map((e) => e.message).join(', ')}`);
|
|
138
|
+
}
|
|
139
|
+
return json.data;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// ── Tool implementations ─────────────────────────────────────────────
|
|
143
|
+
|
|
144
|
+
async function listIssues(token: string, filter?: string, first?: number) {
|
|
145
|
+
const count = Math.min(50, Math.max(1, first ?? 20));
|
|
146
|
+
const filterObj = filter ? JSON.parse(filter) : undefined;
|
|
147
|
+
const query = `
|
|
148
|
+
query ListIssues($first: Int!, $filter: IssueFilter) {
|
|
149
|
+
issues(first: $first, filter: $filter, orderBy: updatedAt) {
|
|
150
|
+
nodes {
|
|
151
|
+
id
|
|
152
|
+
identifier
|
|
153
|
+
title
|
|
154
|
+
state { name }
|
|
155
|
+
priority
|
|
156
|
+
priorityLabel
|
|
157
|
+
assignee { name email }
|
|
158
|
+
url
|
|
159
|
+
createdAt
|
|
160
|
+
updatedAt
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
`;
|
|
165
|
+
const data = (await graphql(token, query, { first: count, filter: filterObj })) as {
|
|
166
|
+
issues: { nodes: unknown[] };
|
|
167
|
+
};
|
|
168
|
+
return { issues: data.issues.nodes };
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
async function getIssue(token: string, id: string) {
|
|
172
|
+
const query = `
|
|
173
|
+
query GetIssue($id: String!) {
|
|
174
|
+
issue(id: $id) {
|
|
175
|
+
id
|
|
176
|
+
identifier
|
|
177
|
+
title
|
|
178
|
+
description
|
|
179
|
+
state { name }
|
|
180
|
+
priority
|
|
181
|
+
priorityLabel
|
|
182
|
+
assignee { name email }
|
|
183
|
+
labels { nodes { name color } }
|
|
184
|
+
comments { nodes { body user { name } createdAt } }
|
|
185
|
+
url
|
|
186
|
+
createdAt
|
|
187
|
+
updatedAt
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
`;
|
|
191
|
+
const data = (await graphql(token, query, { id })) as { issue: unknown };
|
|
192
|
+
return data.issue;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
async function createIssue(
|
|
196
|
+
token: string,
|
|
197
|
+
title: string,
|
|
198
|
+
teamId: string,
|
|
199
|
+
description?: string,
|
|
200
|
+
priority?: number,
|
|
201
|
+
) {
|
|
202
|
+
const query = `
|
|
203
|
+
mutation CreateIssue($input: IssueCreateInput!) {
|
|
204
|
+
issueCreate(input: $input) {
|
|
205
|
+
success
|
|
206
|
+
issue {
|
|
207
|
+
id
|
|
208
|
+
identifier
|
|
209
|
+
title
|
|
210
|
+
url
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
`;
|
|
215
|
+
const input: Record<string, unknown> = { title, teamId };
|
|
216
|
+
if (description) input.description = description;
|
|
217
|
+
if (priority !== undefined) input.priority = priority;
|
|
218
|
+
const data = (await graphql(token, query, { input })) as {
|
|
219
|
+
issueCreate: { success: boolean; issue: unknown };
|
|
220
|
+
};
|
|
221
|
+
return data.issueCreate;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
async function listTeams(token: string) {
|
|
225
|
+
const query = `
|
|
226
|
+
query ListTeams {
|
|
227
|
+
teams {
|
|
228
|
+
nodes {
|
|
229
|
+
id
|
|
230
|
+
name
|
|
231
|
+
key
|
|
232
|
+
description
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
`;
|
|
237
|
+
const data = (await graphql(token, query)) as { teams: { nodes: unknown[] } };
|
|
238
|
+
return { teams: data.teams.nodes };
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
async function searchIssues(token: string, queryText: string, first?: number) {
|
|
242
|
+
const count = Math.min(50, Math.max(1, first ?? 20));
|
|
243
|
+
const query = `
|
|
244
|
+
query SearchIssues($term: String!, $first: Int!) {
|
|
245
|
+
searchIssues(term: $term, first: $first) {
|
|
246
|
+
nodes {
|
|
247
|
+
id
|
|
248
|
+
identifier
|
|
249
|
+
title
|
|
250
|
+
state { name }
|
|
251
|
+
priority
|
|
252
|
+
priorityLabel
|
|
253
|
+
assignee { name }
|
|
254
|
+
url
|
|
255
|
+
updatedAt
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
`;
|
|
260
|
+
const data = (await graphql(token, query, { term: queryText, first: count })) as {
|
|
261
|
+
searchIssues: { nodes: unknown[] };
|
|
262
|
+
};
|
|
263
|
+
return { issues: data.searchIssues.nodes };
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// ── callTool dispatcher ──────────────────────────────────────────────
|
|
267
|
+
|
|
268
|
+
async function callTool(name: string, args: Record<string, unknown>): Promise<unknown> {
|
|
269
|
+
const token = getToken(args);
|
|
270
|
+
delete args._context;
|
|
271
|
+
|
|
272
|
+
switch (name) {
|
|
273
|
+
case 'linear_list_issues':
|
|
274
|
+
return listIssues(token, args.filter as string | undefined, args.first as number | undefined);
|
|
275
|
+
case 'linear_get_issue':
|
|
276
|
+
return getIssue(token, args.id as string);
|
|
277
|
+
case 'linear_create_issue':
|
|
278
|
+
return createIssue(
|
|
279
|
+
token,
|
|
280
|
+
args.title as string,
|
|
281
|
+
args.teamId as string,
|
|
282
|
+
args.description as string | undefined,
|
|
283
|
+
args.priority as number | undefined,
|
|
284
|
+
);
|
|
285
|
+
case 'linear_list_teams':
|
|
286
|
+
return listTeams(token);
|
|
287
|
+
case 'linear_search':
|
|
288
|
+
return searchIssues(token, args.query as string, args.first as number | undefined);
|
|
289
|
+
default:
|
|
290
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export default { tools, callTool, meter: { credits: 10 }, provider: 'linear' } satisfies McpToolExport;
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"outDir": "dist",
|
|
10
|
+
"rootDir": "src",
|
|
11
|
+
"declaration": true
|
|
12
|
+
},
|
|
13
|
+
"include": ["src"]
|
|
14
|
+
}
|