AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
import { createPiece, PieceAuth, tryCatch } from '@activepieces/pieces-framework';
import { PieceCategory } from '@activepieces/pieces-framework';
import { LinearClient } from '@linear/sdk';
import { linearCreateComment } from './lib/actions/comments/create-comment';
import { linearCreateIssue } from './lib/actions/issues/create-issue';
import { linearUpdateIssue } from './lib/actions/issues/update-issue';
import { linearCreateProject } from './lib/actions/projects/create-project';
import { linearUpdateProject } from './lib/actions/projects/update-project';
import { linearRawGraphqlQuery } from './lib/actions/raw-graphql-query';
import { linearNewComment } from './lib/triggers/new-comment';
import { linearNewIssue } from './lib/triggers/new-issue';
import { linearUpdatedIssue } from './lib/triggers/updated-issue';
import { linearRemovedIssue } from './lib/triggers/removed-issue';
import { linearNewProject } from './lib/triggers/new-project';
import { linearUpdatedProject } from './lib/triggers/updated-project';
import { linearRemovedProject } from './lib/triggers/removed-project';
import { linearGetIssue } from './lib/actions/issues/get-issue';
import { linearSearchIssues } from './lib/actions/issues/search-issues';
import { linearAddLabelToIssue } from './lib/actions/issues/add-label-to-issue';
import { linearRemoveLabelFromIssue } from './lib/actions/issues/remove-label-from-issue';
import { linearDeleteIssue } from './lib/actions/issues/delete-issue';
import { linearAttachLink } from './lib/actions/attachments/attach-link';
import { linearCreateProjectStatusUpdate } from './lib/actions/projects/create-project-status-update';
import { linearNewProjectStatusUpdate } from './lib/triggers/new-project-status-update';
import { linearAtomics } from './lib/actions/atomics';
const markdown = `
To get your API key:
1. In Linear, open **Settings** from the workspace menu at the top left.
2. Go to **Security & access**.
3. Under **Personal API keys**, enter a label and click **Create key**.
4. Copy the key (it starts with \`lin_api_\`) and paste it here.
Triggers need a key created by a workspace admin.`;
export const linearAuth = PieceAuth.SecretText({
displayName: 'API Key',
required: true,
description: markdown,
validate: async ({ auth }) => {
if (!auth.startsWith('lin_api_')) {
return {
valid: false,
error: 'Invalid API Key',
};
}
const { error } = await tryCatch(() => new LinearClient({ apiKey: auth }).viewer);
if (!error) {
return {
valid: true,
};
}
if (isUnauthorized(error)) {
return {
valid: false,
error: 'Linear did not accept this API key. It may have been revoked or rotated. Create a new personal API key under Settings, Security & access in Linear, then try again.',
};
}
return {
valid: false,
error: 'Could not reach Linear to check this API key. Please try again.',
};
},
});
export const linear = createPiece({
displayName: 'Linear',
description: 'Issue tracking for modern software teams',
auth: linearAuth,
minimumSupportedRelease: '0.88.2',
logoUrl: 'https://cdn.activepieces.com/pieces/linear.png',
authors: ['lldiegon', 'kishanprmr', 'abuaboud'],
categories: [PieceCategory.PRODUCTIVITY],
actions: [
linearCreateIssue,
linearUpdateIssue,
linearCreateProject,
linearUpdateProject,
linearCreateComment,
linearGetIssue,
linearSearchIssues,
linearAddLabelToIssue,
linearRemoveLabelFromIssue,
linearDeleteIssue,
linearAttachLink,
linearCreateProjectStatusUpdate,
linearRawGraphqlQuery,
...linearAtomics,
],
triggers: [
linearNewComment,
linearNewIssue,
linearUpdatedIssue,
linearRemovedIssue,
linearNewProject,
linearUpdatedProject,
linearRemovedProject,
linearNewProjectStatusUpdate,
],
});
function isUnauthorized(error: unknown): boolean {
return typeof error === 'object' && error !== null && 'status' in error && error.status === 401;
}