Skip to content

feat: MCP server for trueforge - #1047

Open
heerambavi1998 wants to merge 17 commits into
mainfrom
ha/tf-mcp
Open

heerambavi1998 wants to merge 17 commits into
mainfrom
ha/tf-mcp

Conversation

@heerambavi1998

@heerambavi1998 heerambavi1998 commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

MCP server for trueforge

Changes

How was this tested?

manual testing

Checklist

  • I have read the contributing guidelines
  • pnpm build, pnpm test, pnpm typecheck, pnpm lint:ci, and pnpm format:check pass locally
  • Tests added/updated where it makes sense
  • No hand-edits to generated code (packages/trueforge-sdk, python/trueforge_sdk, .github/fern/openapi/openapi.json, docs/openapi.json) — fork PRs omit SDK regen; maintainers regenerate after merge
  • Docs / .env.example updated if configuration or behavior changed

Note

Medium Risk
Introduces a new authenticated MCP surface and refactors MCP resolution/remote networking; misconfiguration could affect turn-time MCP auth or internal fetch policy, though draft-only gating and manifest persistence guards limit blast radius.

Overview
Adds a built-in trueforge MCP server (Streamable HTTP at /mcp) so browser draft sessions can configure agents and related resources via MCP tools (agents, schedules, sandbox envs, models, MCP servers, skills). Access is gated by x-trueforge-client: browser on both the /mcp endpoint and the frontend’s createAuthAwareFetch.

Draft vs saved agents: the UI adapter auto-attaches the trueforge MCP to inline/draft session specs and strips it on save; the agents API rejects persisting that connector in stored manifests. Validation treats trueforge as a virtual server that does not need a DB row.

MCP plumbing refactor: persistence (IMcpServerStore), OAuth client storage, and invoke/auth behavior are split behind IMcpServerResolver / McpServerResolver, with a request-scoped TrueForgeMcpServerResolver for the built-in connector. Remote MCP connections now use a RemoteMcpEndpoint plus optional trusted-internal network policy (mTLS-aware fetch, no redirects) for loopback to the first-party MCP. Reserved resource names now include trueforge / truefoundry.

Reviewed by Cursor Bugbot for commit 9ccf905. Bugbot is set up for automated code reviews on this repo. Configure here.

@changeset-bot

changeset-bot Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9ccf905

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@truefoundry/trueforge-core Patch
@truefoundry/trueforge Patch
@truefoundry/trueforge-ui Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread packages/trueforge/src/mcp/server/trueforge/tools/agents.ts
Comment thread packages/trueforge/src/mcp/server/trueforge/tools/agents.ts
Comment thread packages/trueforge/src/mcp/server/trueforge/route.ts

@thesujai thesujai left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can define a trueforge mcp like:

{
"type": ...,
"name": "trueforge"
"url": localhost,
"auth" :{
"type": "header",
"headers: "user_token"
}
}

Now from all the mcp stores(tfy, postgres and sqlite) we will inject the above.

So fronend will add trueforge in the inilne agent spec, and we can have custom logic in all the store to handle the trueforge mcp case. This way we will not need to spread the logic

This would simply the design(this is what being done for the default environment case in sandbox environments)

cc @chiragjn

@heerambavi1998

Copy link
Copy Markdown
Contributor Author

We can define a trueforge mcp like:

{
"type": ...,
"name": "trueforge"
"url": localhost,
"auth" :{
"type": "header",
"headers: "user_token"
}
}

Now from all the mcp stores(tfy, postgres and sqlite) we will inject the above.

So fronend will add trueforge in the inilne agent spec, and we can have custom logic in all the store to handle the trueforge mcp case. This way we will not need to spread the logic

This would simply the design(this is what being done for the default environment case in sandbox environments)

cc @chiragjn

We are doing the exact same approach ( except naming). Persistence store should not resolve this mcp though, since those are pure DB reads. It can cause issues later in sorting , pagination.
Instead the resolver backed by persistence store does the look up for us.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread packages/trueforge/src/runtime/sessionResources.ts Outdated
@heerambavi1998
heerambavi1998 force-pushed the ha/tf-mcp branch 2 times, most recently from 5c0f7ba to b5803c9 Compare October 19, 2026 20:49

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b5803c9. Configure here.

Comment thread packages/trueforge/src/apis/mcpServers.ts
Heer Ambavi and others added 5 commits October 21, 2026 02:26
Trusted MCP fetches now live on the connection network policy, so the outbound options no longer accept trustedEndpoint.

Co-authored-by: Cursor <cursoragent@cursor.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants