[feat]: add MCP server#131
Conversation
📝 WalkthroughWalkthroughThis PR introduces ChangesMCP Server Implementation
🎯 3 (Moderate) | ⏱️ ~20 minutes
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
View your CI Pipeline Execution ↗ for commit de02a31
☁️ Nx Cloud last updated this comment at |
commit: |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
packages/intent-mcp/tests/server.test.ts (1)
1-7: 💤 Low valueReorder imports to satisfy ESLint.
The linter expects Node.js built-in imports (
node:path,node:url) to come before external package imports. This is a style convention that improves consistency.♻️ Suggested import order
+import { dirname, join } from 'node:path' +import { fileURLToPath } from 'node:url' import { Client } from '@modelcontextprotocol/sdk/client/index.js' import { InMemoryTransport } from '@modelcontextprotocol/sdk/inMemory.js' import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js' -import { dirname, join } from 'node:path' -import { fileURLToPath } from 'node:url' import { afterEach, beforeEach, describe, expect, it } from 'vitest' import { createIntentMcpServer } from '../src/server.js'As per coding guidelines indicated by ESLint import/order rule.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/intent-mcp/tests/server.test.ts` around lines 1 - 7, Reorder the import statements so Node built-ins come first: move the node:path import (dirname, join) and node:url import (fileURLToPath) above external package imports (Client from '@modelcontextprotocol/sdk/client/index.js' and InMemoryTransport from '@modelcontextprotocol/sdk/inMemory.js'), then keep type imports (McpServer) and testing imports (afterEach, beforeEach, describe, expect, it) followed by the local createIntentMcpServer import; this satisfies ESLint import/order without changing any identifiers or functionality.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@package.json`:
- Line 30: The npm script "test:intent-mcp" currently uses a POSIX-style env
assignment (TMPDIR=/tmp ...) which fails on Windows; update the script value in
package.json to use cross-env (e.g., prefix with "cross-env TMPDIR=/tmp") and
ensure "cross-env" is added to devDependencies so the script is portable across
platforms; keep the rest of the script ("vitest run --root packages/intent-mcp")
unchanged.
In `@packages/intent-mcp/src/server.ts`:
- Around line 1-11: The import block violates lint rules: reorder and normalize
imports and use explicit type-only imports; group external modules first (node
built-ins then third-party packages) then local/internal modules, sort imports
alphabetically within each group, and convert type imports to "import type" for
IntentCoreOptions, IntentSkillList, and IntentSkillSummary; ensure McpServer is
imported from '@modelcontextprotocol/sdk/server/mcp.js' and non-type symbols
(IntentCoreError, listIntentSkills, loadIntentSkill) are regular imports so the
import/order, sort-imports, and import/consistent-type-specifier-style rules are
satisfied.
---
Nitpick comments:
In `@packages/intent-mcp/tests/server.test.ts`:
- Around line 1-7: Reorder the import statements so Node built-ins come first:
move the node:path import (dirname, join) and node:url import (fileURLToPath)
above external package imports (Client from
'@modelcontextprotocol/sdk/client/index.js' and InMemoryTransport from
'@modelcontextprotocol/sdk/inMemory.js'), then keep type imports (McpServer) and
testing imports (afterEach, beforeEach, describe, expect, it) followed by the
local createIntentMcpServer import; this satisfies ESLint import/order without
changing any identifiers or functionality.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 8d575a83-bb89-4863-8155-b6ae46889886
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (10)
docs/config.jsondocs/getting-started/mcp-server.mdpackage.jsonpackages/intent-mcp/package.jsonpackages/intent-mcp/src/index.tspackages/intent-mcp/src/server.tspackages/intent-mcp/tests/fixtures/empty/package.jsonpackages/intent-mcp/tests/fixtures/workspace/package.jsonpackages/intent-mcp/tests/server.test.tspackages/intent-mcp/tsconfig.json
| "generate-docs": "node scripts/generate-docs.ts", | ||
| "test:docs": "node scripts/verify-links.ts", | ||
| "test:eslint": "nx affected --target=test:eslint --exclude=examples/**", | ||
| "test:intent-mcp": "TMPDIR=/tmp vitest run --root packages/intent-mcp", |
There was a problem hiding this comment.
Make test:intent-mcp cross-platform.
Line 30 uses POSIX-style env var assignment, which won’t run on Windows shells.
Portable option
- "test:intent-mcp": "TMPDIR=/tmp vitest run --root packages/intent-mcp",
+ "test:intent-mcp": "cross-env TMPDIR=/tmp vitest run --root packages/intent-mcp",And add cross-env to devDependencies if it isn’t already present.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@package.json` at line 30, The npm script "test:intent-mcp" currently uses a
POSIX-style env assignment (TMPDIR=/tmp ...) which fails on Windows; update the
script value in package.json to use cross-env (e.g., prefix with "cross-env
TMPDIR=/tmp") and ensure "cross-env" is added to devDependencies so the script
is portable across platforms; keep the rest of the script ("vitest run --root
packages/intent-mcp") unchanged.
| import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js' | ||
| import { | ||
| IntentCoreError, | ||
| listIntentSkills, | ||
| loadIntentSkill, | ||
| type IntentCoreOptions, | ||
| type IntentSkillList, | ||
| type IntentSkillSummary, | ||
| } from '@tanstack/intent/core' | ||
| import { resolve } from 'node:path' | ||
| import { z } from 'zod' |
There was a problem hiding this comment.
Fix import style/order to satisfy current lint rules.
Line 1–Line 11 currently violate import/order, sort-imports, and import/consistent-type-specifier-style. This will keep lint red for the new package.
Proposed fix
+import { resolve } from 'node:path'
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
import {
IntentCoreError,
listIntentSkills,
loadIntentSkill,
- type IntentCoreOptions,
- type IntentSkillList,
- type IntentSkillSummary,
} from '@tanstack/intent/core'
-import { resolve } from 'node:path'
+import type {
+ IntentCoreOptions,
+ IntentSkillList,
+ IntentSkillSummary,
+} from '@tanstack/intent/core'
import { z } from 'zod'📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js' | |
| import { | |
| IntentCoreError, | |
| listIntentSkills, | |
| loadIntentSkill, | |
| type IntentCoreOptions, | |
| type IntentSkillList, | |
| type IntentSkillSummary, | |
| } from '@tanstack/intent/core' | |
| import { resolve } from 'node:path' | |
| import { z } from 'zod' | |
| import { resolve } from 'node:path' | |
| import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js' | |
| import { | |
| IntentCoreError, | |
| listIntentSkills, | |
| loadIntentSkill, | |
| } from '@tanstack/intent/core' | |
| import type { | |
| IntentCoreOptions, | |
| IntentSkillList, | |
| IntentSkillSummary, | |
| } from '@tanstack/intent/core' | |
| import { z } from 'zod' |
🧰 Tools
🪛 ESLint
[error] 6-6: Member 'IntentCoreOptions' of the import declaration should be sorted alphabetically.
(sort-imports)
[error] 6-6: Prefer using a top-level type-only import instead of inline type specifiers.
(import/consistent-type-specifier-style)
[error] 7-7: Prefer using a top-level type-only import instead of inline type specifiers.
(import/consistent-type-specifier-style)
[error] 8-8: Prefer using a top-level type-only import instead of inline type specifiers.
(import/consistent-type-specifier-style)
[error] 10-10: node:path import should occur before import of @modelcontextprotocol/sdk/server/mcp.js
(import/order)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/intent-mcp/src/server.ts` around lines 1 - 11, The import block
violates lint rules: reorder and normalize imports and use explicit type-only
imports; group external modules first (node built-ins then third-party packages)
then local/internal modules, sort imports alphabetically within each group, and
convert type imports to "import type" for IntentCoreOptions, IntentSkillList,
and IntentSkillSummary; ensure McpServer is imported from
'@modelcontextprotocol/sdk/server/mcp.js' and non-type symbols (IntentCoreError,
listIntentSkills, loadIntentSkill) are regular imports so the import/order,
sort-imports, and import/consistent-type-specifier-style rules are satisfied.
Summary
Adds a new
@tanstack/intent-mcppackage that exposes Intent skill discovery/loading through a read-only stdio MCP server.intent_search,intent_load, andintent_statustoolstools/list<skill_content>block@tanstack/intentpackageSummary by CodeRabbit
Documentation
New Features
intent-mcpCLI tool enabling agents to search Intent skills, load individual skill details, and monitor server status via MCP protocol.Tests
Chores