-
-
Notifications
You must be signed in to change notification settings - Fork 852
feat: MCP server 2.0 #2384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat: MCP server 2.0 #2384
Changes from 39 commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
fa3bdc5
Initial scaffolding
ericallam c7674cc
MCP auth and list_projects tool
ericallam 4c03033
Add a few more tools
ericallam 832707d
Remove the .mcp.log file
ericallam 8e4d680
Ignore .mcp.log
ericallam e4a7314
Adding initialize project tool
ericallam 43ace92
Add vscode installation
ericallam a240b30
Adding getTasks and triggerTask tools
ericallam 0197742
Add dev connection message
ericallam 3c21be3
Restructure transport
ericallam 045c092
Add the install-mcp command
ericallam 1f86fa6
Added cline support
ericallam 268a778
Amp support
ericallam eaa1578
Added getRunDetails tools
ericallam d33aaca
Background worker -> Local worker
ericallam 166a254
Add install mcp prompt to init and dev, and add support for codex-cli…
ericallam d62886c
Add Zed support
ericallam 181acff
Deploying with MCP
ericallam a47ed15
opencode support
ericallam aa2dae3
Add list runs tool
ericallam e0f1e17
Add support for getting the trace of a run in get_run_details
ericallam b3bb61f
Add cancel_run tool
ericallam 8bcf320
Add list deploys tool
ericallam 361e2bb
Support for preview branches
ericallam 088c3a9
Improve the MCP authentication message
ericallam ee1725f
fix asking about installing the MCP server after already answering
ericallam ca993fe
fix overriding all of settings
ericallam d45ad5d
Massive MCP cleanup
ericallam 98e7c66
a couple of coderabbit fixes
ericallam 4100a9e
Improve date parsing from search query
ericallam 21639e0
more coderabbit
ericallam a8ca773
fix error message
ericallam d4e78d7
Improve the deploy experience
ericallam 03aec5a
Add project redirect for /projects/$ref
ericallam 599f6a2
Improved the get tasks tool, fixed mintlify MCP search
ericallam f60056e
Much better get run details tool output with more detailed trace data
ericallam 62a08b4
format the runs list
ericallam 6b8704b
add install-rules command
ericallam 8f34277
make updating rules files idempotent
ericallam 08cd20a
clients -> targets in the install-rules command
ericallam 8bb9f31
Add the install rules wizard to the mcp install command
ericallam 1efecdd
add rules
ericallam f6c5aa2
Add changeset
ericallam 220c610
Some tweaks to the rules and how they are installed
ericallam f25e90a
various coderabbit fixes
ericallam cb1ff21
fix PR review issues
ericallam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
{ | ||
"mcpServers": { | ||
"trigger.dev": { | ||
"url": "http://localhost:3333/sse" | ||
} | ||
} | ||
} | ||
"mcpServers": {} | ||
} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
138 changes: 138 additions & 0 deletions
138
apps/webapp/app/routes/api.v1.orgs.$orgParam.projects.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
import type { ActionFunctionArgs, LoaderFunctionArgs } from "@remix-run/server-runtime"; | ||
import { json } from "@remix-run/server-runtime"; | ||
import { | ||
CreateProjectRequestBody, | ||
GetProjectResponseBody, | ||
GetProjectsResponseBody, | ||
} from "@trigger.dev/core/v3"; | ||
import { z } from "zod"; | ||
import { prisma } from "~/db.server"; | ||
import { createProject } from "~/models/project.server"; | ||
import { logger } from "~/services/logger.server"; | ||
import { authenticateApiRequestWithPersonalAccessToken } from "~/services/personalAccessToken.server"; | ||
import { isCuid } from "cuid"; | ||
|
||
const ParamsSchema = z.object({ | ||
orgParam: z.string(), | ||
}); | ||
|
||
export async function loader({ request, params }: LoaderFunctionArgs) { | ||
logger.info("get projects", { url: request.url }); | ||
|
||
const authenticationResult = await authenticateApiRequestWithPersonalAccessToken(request); | ||
|
||
if (!authenticationResult) { | ||
return json({ error: "Invalid or Missing Access Token" }, { status: 401 }); | ||
} | ||
|
||
const { orgParam } = ParamsSchema.parse(params); | ||
|
||
const projects = await prisma.project.findMany({ | ||
where: { | ||
organization: { | ||
...orgParamWhereClause(orgParam), | ||
deletedAt: null, | ||
members: { | ||
some: { | ||
userId: authenticationResult.userId, | ||
}, | ||
}, | ||
}, | ||
version: "V3", | ||
ericallam marked this conversation as resolved.
Show resolved
Hide resolved
|
||
deletedAt: null, | ||
}, | ||
include: { | ||
organization: true, | ||
}, | ||
}); | ||
ericallam marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
if (!projects) { | ||
return json({ error: "Projects not found" }, { status: 404 }); | ||
} | ||
|
||
const result: GetProjectsResponseBody = projects.map((project) => ({ | ||
id: project.id, | ||
externalRef: project.externalRef, | ||
name: project.name, | ||
slug: project.slug, | ||
createdAt: project.createdAt, | ||
organization: { | ||
id: project.organization.id, | ||
title: project.organization.title, | ||
slug: project.organization.slug, | ||
createdAt: project.organization.createdAt, | ||
}, | ||
})); | ||
|
||
return json(result); | ||
} | ||
|
||
export async function action({ request, params }: ActionFunctionArgs) { | ||
const authenticationResult = await authenticateApiRequestWithPersonalAccessToken(request); | ||
|
||
if (!authenticationResult) { | ||
return json({ error: "Invalid or Missing Access Token" }, { status: 401 }); | ||
} | ||
|
||
const { orgParam } = ParamsSchema.parse(params); | ||
|
||
const organization = await prisma.organization.findFirst({ | ||
where: { | ||
...orgParamWhereClause(orgParam), | ||
deletedAt: null, | ||
members: { | ||
some: { | ||
userId: authenticationResult.userId, | ||
}, | ||
}, | ||
}, | ||
}); | ||
|
||
if (!organization) { | ||
return json({ error: "Organization not found" }, { status: 404 }); | ||
} | ||
|
||
const body = await request.json(); | ||
const parsedBody = CreateProjectRequestBody.safeParse(body); | ||
|
||
if (!parsedBody.success) { | ||
return json({ error: "Invalid request body" }, { status: 400 }); | ||
} | ||
ericallam marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
const project = await createProject({ | ||
organizationSlug: organization.slug, | ||
name: parsedBody.data.name, | ||
userId: authenticationResult.userId, | ||
version: "v3", | ||
}); | ||
|
||
const result: GetProjectResponseBody = { | ||
id: project.id, | ||
externalRef: project.externalRef, | ||
name: project.name, | ||
slug: project.slug, | ||
createdAt: project.createdAt, | ||
organization: { | ||
id: project.organization.id, | ||
title: project.organization.title, | ||
slug: project.organization.slug, | ||
createdAt: project.organization.createdAt, | ||
}, | ||
}; | ||
|
||
return json(result); | ||
} | ||
|
||
function orgParamWhereClause(orgParam: string) { | ||
// If the orgParam is an ID, or if it's a slug | ||
// IDs are cuid | ||
if (isCuid(orgParam)) { | ||
return { | ||
id: orgParam, | ||
}; | ||
} | ||
|
||
return { | ||
slug: orgParam, | ||
}; | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.